



/* Final Text/Chat visual coverage for runtime-generated document/file cards and
   legacy primary actions. Geometry/behaviour stay in chat.css / text-page.css. */

body.page-text .chat-sidebar,
body.page-text .chat-header,
body.page-text .chat-input-area,
body.page-text .chat-preview-panel {
  background: var(--aidc-bg-panel) !important;
  border-color: var(--aidc-border-subtle) !important;
}

body.page-text .chat-main,
body.page-text .chat-messages {
  background: var(--aidc-workspace-bg) !important;
}

body.page-text .chat-message--user .chat-message__bubble,
body.page-text .chat-message--assistant .chat-message__bubble {
  background: var(--aidc-bg-card) !important;
  border-color: var(--aidc-border-default) !important;
  color: var(--aidc-text-secondary) !important;
}

body.page-text .chat-message--user .chat-message__bubble {
  color: var(--aidc-text-primary) !important;
}

body.page-text :where(
  .chat-doc-card,
  .chat-file-card,
  .chat-attachment-card,
  .chat-message__file,
  .chat-message__attachment
) {
  background: var(--aidc-bg-card) !important;
  border-color: var(--aidc-border-default) !important;
  color: var(--aidc-text-secondary) !important;
  box-shadow: none !important;
}

body.page-text :where(
  .chat-doc-card,
  .chat-file-card,
  .chat-attachment-card,
  .chat-message__file,
  .chat-message__attachment
)::before,
body.page-text :where(
  .chat-doc-card,
  .chat-file-card,
  .chat-attachment-card,
  .chat-message__file,
  .chat-message__attachment
)::after {
  background: linear-gradient(transparent, var(--aidc-bg-card)) !important;
  color: var(--aidc-text-secondary) !important;
}

body.page-text .chat-doc-card__title,
body.page-text :where(.chat-file-card,.chat-attachment-card,.chat-message__file,.chat-message__attachment) strong {
  color: var(--aidc-text-primary) !important;
}

body.page-text .chat-doc-card__meta,
body.page-text .chat-doc-card__preview,
body.page-text :where(.chat-file-card,.chat-attachment-card,.chat-message__file,.chat-message__attachment) small {
  color: var(--aidc-text-secondary) !important;
}

body.page-text .chat-preview-panel__body {
  background: var(--aidc-bg-card) !important;
  color: var(--aidc-text-secondary) !important;
}

body.page-text .chat-preview-panel__body :where(h1,h2,h3,h4,h5,h6,strong,b) {
  color: var(--aidc-text-primary) !important;
}

body.page-text .chat-preview-panel__body :where(p,li,blockquote,td) {
  color: var(--aidc-text-secondary) !important;
}

/* Large solid fuchsia actions feel foreign on the light application chrome.
   Keep the dark theme expressive and make light mode use the shared quiet CTA. */
html[data-aidc-color-mode="light"] body.page-text :where(
  .chat-sidebar__new-btn,
  .chat-send-btn,
  .chat-settings-modal__save,
  .chat-expand-modal__send
) {
  background: var(--aidc-btn-primary-bg) !important;
  border: 1px solid var(--aidc-btn-primary-border) !important;
  color: var(--aidc-btn-primary-text) !important;
  box-shadow: var(--aidc-btn-primary-shadow) !important;
  filter: none !important;
}

html[data-aidc-color-mode="light"] body.page-text :where(
  .chat-sidebar__new-btn,
  .chat-send-btn,
  .chat-settings-modal__save,
  .chat-expand-modal__send
):hover:not(:disabled) {
  background: var(--aidc-btn-primary-bg-hover) !important;
  border-color: var(--aidc-btn-primary-border-hover) !important;
  color: var(--aidc-btn-primary-text) !important;
  box-shadow: none !important;
  filter: none !important;
}

body.page-text :where(
  .chat-message__copy,
  .chat-message__reply-btn,
  .chat-attach-btn,
  .chat-mic-btn,
  .chat-expand-btn,
  .chat-header__select-btn,
  .chat-preview-panel__btn,
  .chat-doc-card__expand
) {
  background: var(--aidc-btn-secondary-bg) !important;
  border-color: var(--aidc-btn-secondary-border) !important;
  color: var(--aidc-text-secondary) !important;
}

body.page-text :where(
  .chat-message__copy,
  .chat-message__reply-btn,
  .chat-attach-btn,
  .chat-mic-btn,
  .chat-expand-btn,
  .chat-header__select-btn,
  .chat-preview-panel__btn,
  .chat-doc-card__expand
):hover {
  background: var(--aidc-btn-secondary-bg-hover) !important;
  border-color: var(--aidc-border-strong) !important;
  color: var(--aidc-text-primary) !important;
}

/* Runtime controls that still receive legacy dark visual declarations from chat.css.
   This adapter is intentionally token-only so the same DOM remains readable in both modes. */
body.page-text .chat-effort-trigger {
  background: var(--aidc-btn-secondary-bg) !important;
  border-color: var(--aidc-border-default) !important;
  color: var(--aidc-text-primary) !important;
  -webkit-text-fill-color: var(--aidc-text-primary) !important;
}

body.page-text .chat-effort-trigger :where(svg,span) {
  color: inherit !important;
}

body.page-text :where(
  .chat-attach-btn,
  .chat-mic-btn,
  .chat-expand-btn,
  .chat-effort-trigger
):disabled {
  background: var(--aidc-btn-secondary-bg) !important;
  border-color: var(--aidc-border-default) !important;
  color: var(--aidc-text-secondary) !important;
  -webkit-text-fill-color: var(--aidc-text-secondary) !important;
  opacity: .78 !important;
}

/* Folder hover actions must stay visible against the light sidebar. */
body.page-text :where(
  .chat-folder__add-sub,
  .chat-folder__settings,
  .chat-folder__delete,
  .chat-sidebar__item-menu,
  .chat-sidebar__item-delete
) {
  color: var(--aidc-text-secondary) !important;
  -webkit-text-fill-color: var(--aidc-text-secondary) !important;
}

body.page-text .chat-folder__header:hover :where(
  .chat-folder__add-sub,
  .chat-folder__settings,
  .chat-folder__delete
) {
  opacity: 1 !important;
}

body.page-text :where(
  .chat-folder__add-sub,
  .chat-folder__settings,
  .chat-sidebar__item-menu
):hover {
  background: var(--aidc-btn-secondary-bg-hover) !important;
  color: var(--aidc-text-primary) !important;
  -webkit-text-fill-color: var(--aidc-text-primary) !important;
}

body.page-text :where(
  .chat-folder__delete,
  .chat-sidebar__item-delete
):hover {
  background: color-mix(in srgb,var(--aidc-red-500) 10%,transparent) !important;
  color: var(--aidc-red-500) !important;
  -webkit-text-fill-color: var(--aidc-red-500) !important;
}

/* Workspace settings: legacy children kept dark-mode colors after the modal surface switched. */
body.page-text .chat-settings-modal__content {
  background: var(--aidc-bg-modal) !important;
  border-color: var(--aidc-border-default) !important;
  color: var(--aidc-text-primary) !important;
  box-shadow: var(--aidc-shadow-modal) !important;
}

body.page-text .chat-settings-modal__header,
body.page-text .chat-settings-modal__footer {
  border-color: var(--aidc-border-subtle) !important;
}

body.page-text .chat-settings-modal__header h3 {
  color: var(--aidc-text-primary) !important;
  -webkit-text-fill-color: var(--aidc-text-primary) !important;
}

body.page-text .chat-settings-modal__header h3 svg {
  width: 18px !important;
  height: 18px !important;
  max-width: 18px !important;
  max-height: 18px !important;
  vertical-align: -3px !important;
  color: var(--aidc-text-secondary) !important;
}

body.page-text :where(
  .chat-settings__label,
  .chat-settings__hint,
  .chat-settings__description,
  .chat-settings__meta
) {
  color: var(--aidc-text-secondary) !important;
  -webkit-text-fill-color: var(--aidc-text-secondary) !important;
}

body.page-text :where(
  .chat-settings__input,
  .chat-settings-modal input,
  .chat-settings-modal textarea,
  .chat-settings-modal select,
  .chat-settings-custom-select__trigger
) {
  background: var(--aidc-bg-elevated) !important;
  border-color: var(--aidc-border-default) !important;
  color: var(--aidc-text-primary) !important;
  -webkit-text-fill-color: var(--aidc-text-primary) !important;
}

body.page-text :where(
  .chat-settings__input,
  .chat-settings-modal input,
  .chat-settings-modal textarea,
  .chat-settings-custom-select__trigger
)::placeholder {
  color: var(--aidc-text-muted) !important;
  -webkit-text-fill-color: var(--aidc-text-muted) !important;
  opacity: 1 !important;
}

body.page-text :where(
  .chat-settings__input,
  .chat-settings-modal input,
  .chat-settings-modal textarea,
  .chat-settings-modal select,
  .chat-settings-custom-select__trigger
):focus,
body.page-text .chat-settings-custom-select__trigger:focus-visible {
  border-color: var(--aidc-action-focus) !important;
  box-shadow: 0 0 0 3px var(--aidc-action-focus-ring) !important;
  outline: none !important;
}

body.page-text .chat-settings-custom-select__trigger > span {
  color: var(--aidc-text-primary) !important;
  -webkit-text-fill-color: var(--aidc-text-primary) !important;
}

body.page-text .chat-settings-custom-select__trigger > span:last-child {
  color: var(--aidc-text-secondary) !important;
  -webkit-text-fill-color: var(--aidc-text-secondary) !important;
}

body.page-text :where(
  .chat-settings-custom-select__dropdown,
  .chat-settings-custom-select__menu,
  .chat-settings-custom-select__options
) {
  background: var(--aidc-bg-popover) !important;
  border-color: var(--aidc-border-default) !important;
  color: var(--aidc-text-primary) !important;
  box-shadow: var(--aidc-shadow-popover) !important;
}

body.page-text :where(
  .chat-settings-custom-select__option,
  .chat-settings-custom-select__item
) {
  background: transparent !important;
  color: var(--aidc-text-secondary) !important;
  -webkit-text-fill-color: var(--aidc-text-secondary) !important;
}

body.page-text :where(
  .chat-settings-custom-select__option,
  .chat-settings-custom-select__item
):hover {
  background: var(--aidc-btn-secondary-bg-hover) !important;
  color: var(--aidc-text-primary) !important;
  -webkit-text-fill-color: var(--aidc-text-primary) !important;
}

body.page-text .chat-settings-modal__close {
  background: var(--aidc-btn-secondary-bg) !important;
  border-color: var(--aidc-border-default) !important;
  color: var(--aidc-text-secondary) !important;
}

body.page-text .chat-settings-modal__close:hover {
  background: var(--aidc-btn-secondary-bg-hover) !important;
  color: var(--aidc-text-primary) !important;
}

/* Model capability/detail dialog is runtime-created and had no desktop theme owner. */
body.page-text .chat-model-info-modal__backdrop {
  background: var(--aidc-backdrop) !important;
}

body.page-text .chat-model-info-modal__box {
  background: var(--aidc-bg-modal) !important;
  border-color: var(--aidc-border-default) !important;
  color: var(--aidc-text-primary) !important;
  box-shadow: var(--aidc-shadow-modal) !important;
}

body.page-text .chat-model-info-modal__head,
body.page-text .chat-model-info-modal__foot {
  background: var(--aidc-bg-modal) !important;
  border-color: var(--aidc-border-subtle) !important;
}

body.page-text .chat-model-info-modal__body {
  background: var(--aidc-bg-modal) !important;
  color: var(--aidc-text-secondary) !important;
}

body.page-text :where(
  .chat-model-info-modal__title,
  .chat-model-info__label,
  .chat-model-info__file-lab
) {
  color: var(--aidc-text-primary) !important;
  -webkit-text-fill-color: var(--aidc-text-primary) !important;
}

body.page-text :where(
  .chat-model-info-modal__tagline,
  .chat-model-info__list,
  .chat-model-info__web,
  .chat-model-info__file-val,
  .chat-model-info__meta,
  .chat-model-info__plan
) {
  color: var(--aidc-text-secondary) !important;
  -webkit-text-fill-color: var(--aidc-text-secondary) !important;
}

body.page-text .chat-model-info__section--web,
body.page-text .chat-model-info__files {
  background: var(--aidc-bg-elevated) !important;
  border-color: var(--aidc-border-default) !important;
}

body.page-text .chat-model-info__tag {
  background: color-mix(in srgb,var(--aidc-action-primary-from) 10%,var(--aidc-bg-card)) !important;
  border-color: color-mix(in srgb,var(--aidc-action-primary-from) 30%,var(--aidc-border-default)) !important;
  color: var(--aidc-action-primary-from) !important;
  -webkit-text-fill-color: var(--aidc-action-primary-from) !important;
}

body.page-text .chat-model-info__meta-row {
  border-color: var(--aidc-border-subtle) !important;
  color: var(--aidc-text-secondary) !important;
}

body.page-text .chat-model-info__meta-row b,
body.page-text .chat-model-info__web b {
  color: var(--aidc-action-primary-from) !important;
  -webkit-text-fill-color: var(--aidc-action-primary-from) !important;
}

body.page-text .chat-model-info-modal__close,
body.page-text .chat-model-info-modal__btn--secondary {
  background: var(--aidc-btn-secondary-bg) !important;
  border-color: var(--aidc-border-default) !important;
  color: var(--aidc-text-secondary) !important;
}

body.page-text .chat-model-info-modal__close:hover,
body.page-text .chat-model-info-modal__btn--secondary:hover {
  background: var(--aidc-btn-secondary-bg-hover) !important;
  border-color: var(--aidc-border-strong) !important;
  color: var(--aidc-text-primary) !important;
}

body.page-text .chat-model-info-modal__btn--primary {
  background: var(--aidc-btn-primary-bg) !important;
  border-color: var(--aidc-btn-primary-border) !important;
  color: var(--aidc-btn-primary-text) !important;
  box-shadow: var(--aidc-btn-primary-shadow) !important;
}

/* Other runtime popovers/menu surfaces found during the same audit. */
body.page-text :where(
  .chat-attach-chooser,
  .chat-model-menu,
  .chat-model-dropdown,
  .chat-image-aspect__menu,
  .chat-trash-modal__content
) {
  background: var(--aidc-bg-popover) !important;
  border-color: var(--aidc-border-default) !important;
  color: var(--aidc-text-primary) !important;
  box-shadow: var(--aidc-shadow-popover) !important;
}

body.page-text :where(
  .chat-attach-chooser__title,
  .chat-trash-modal__title
) {
  color: var(--aidc-text-primary) !important;
  -webkit-text-fill-color: var(--aidc-text-primary) !important;
}

body.page-text :where(
  .chat-attach-chooser__desc,
  .chat-trash-modal__empty
) {
  color: var(--aidc-text-secondary) !important;
  -webkit-text-fill-color: var(--aidc-text-secondary) !important;
}



/* Text route runtime surfaces that still originate from the legacy chat.css.
   This file owns visuals only; layout, state and behaviour remain in chat.css. */

body.page-text .chat-container * {
  scrollbar-color: var(--aidc-border-default) transparent !important;
}

body.page-text .chat-container *::-webkit-scrollbar-thumb {
  background: var(--aidc-border-default) !important;
}

body.page-text .chat-container *::-webkit-scrollbar-thumb:hover {
  background: var(--aidc-border-strong) !important;
}

body.page-text .chat-sidebar__item-time {
  color: var(--aidc-text-muted) !important;
  -webkit-text-fill-color: var(--aidc-text-muted) !important;
}

body.page-text .chat-sidebar__item--active .chat-sidebar__item-time {
  color: var(--aidc-text-secondary) !important;
  -webkit-text-fill-color: var(--aidc-text-secondary) !important;
}

/* Full-screen custom-instructions editor was still pinned to a dark canvas. */
body.page-text .chat-settings__label.is-fullscreen {
  background: var(--aidc-bg-page) !important;
  color: var(--aidc-text-primary) !important;
  -webkit-text-fill-color: var(--aidc-text-primary) !important;
}

body.page-text .chat-settings__label.is-fullscreen > .chat-settings__textarea {
  background: var(--aidc-bg-card) !important;
  border-color: var(--aidc-border-default) !important;
  color: var(--aidc-text-primary) !important;
  -webkit-text-fill-color: var(--aidc-text-primary) !important;
}

body.page-text .chat-settings__hint-icon {
  background: var(--aidc-btn-secondary-bg) !important;
  border-color: var(--aidc-border-default) !important;
  color: var(--aidc-text-secondary) !important;
  -webkit-text-fill-color: var(--aidc-text-secondary) !important;
}

body.page-text .chat-settings__hint-icon:hover,
body.page-text .chat-settings__hint-icon:focus-visible {
  background: var(--aidc-btn-secondary-bg-hover) !important;
  border-color: var(--aidc-action-focus) !important;
  color: var(--aidc-text-primary) !important;
  -webkit-text-fill-color: var(--aidc-text-primary) !important;
  outline: none !important;
}

/* Variant chooser has its own legacy popover and is separate from the model picker. */
body.page-text .chat-variant-popup {
  background: var(--aidc-bg-popover) !important;
  border-color: var(--aidc-border-default) !important;
  color: var(--aidc-text-primary) !important;
  box-shadow: var(--aidc-shadow-popover) !important;
}

body.page-text .chat-variant-popup :where(button,.chat-variant-btn) {
  background: transparent !important;
  border-color: transparent !important;
  color: var(--aidc-text-secondary) !important;
  -webkit-text-fill-color: var(--aidc-text-secondary) !important;
}

body.page-text .chat-variant-popup .chat-variant-btn span {
  color: var(--aidc-text-secondary) !important;
  -webkit-text-fill-color: var(--aidc-text-secondary) !important;
}

body.page-text .chat-variant-popup :where(button,.chat-variant-btn):hover,
body.page-text .chat-variant-popup :where(button,.chat-variant-btn):focus-visible {
  background: var(--aidc-btn-secondary-bg-hover) !important;
  color: var(--aidc-text-primary) !important;
  -webkit-text-fill-color: var(--aidc-text-primary) !important;
  outline: none !important;
}

body.page-text .chat-variant-popup .chat-variant-btn:hover span,
body.page-text .chat-variant-popup .chat-variant-btn:focus-visible span {
  color: var(--aidc-text-primary) !important;
  -webkit-text-fill-color: var(--aidc-text-primary) !important;
}

/* Trash is a runtime modal: the shell/backdrop was themed, but rows and text were not. */
body.page-text .chat-trash-modal__body,
body.page-text .chat-trash-modal__footer {
  background: var(--aidc-bg-modal) !important;
  border-color: var(--aidc-border-subtle) !important;
  color: var(--aidc-text-primary) !important;
}

body.page-text .chat-trash-modal__item {
  background: var(--aidc-bg-card) !important;
  border-color: var(--aidc-border-default) !important;
  color: var(--aidc-text-secondary) !important;
}

body.page-text .chat-trash-modal__item:hover {
  background: var(--aidc-btn-secondary-bg-hover) !important;
  border-color: var(--aidc-border-strong) !important;
}

body.page-text .chat-trash-modal__item-title {
  color: var(--aidc-text-primary) !important;
  -webkit-text-fill-color: var(--aidc-text-primary) !important;
}

body.page-text .chat-trash-modal__item-meta,
body.page-text .chat-trash-modal__empty {
  color: var(--aidc-text-secondary) !important;
  -webkit-text-fill-color: var(--aidc-text-secondary) !important;
}

body.page-text .chat-trash-modal__btn,
body.page-text .chat-trash-modal__close-btn {
  background: var(--aidc-btn-secondary-bg) !important;
  border-color: var(--aidc-border-default) !important;
  color: var(--aidc-text-secondary) !important;
  -webkit-text-fill-color: var(--aidc-text-secondary) !important;
}

body.page-text .chat-trash-modal__btn:hover,
body.page-text .chat-trash-modal__close-btn:hover {
  background: var(--aidc-btn-secondary-bg-hover) !important;
  border-color: var(--aidc-border-strong) !important;
  color: var(--aidc-text-primary) !important;
  -webkit-text-fill-color: var(--aidc-text-primary) !important;
}

body.page-text .chat-trash-modal__btn--restore:hover {
  background: var(--aidc-status-success-bg) !important;
  border-color: var(--aidc-status-success-border) !important;
  color: var(--aidc-green-500) !important;
  -webkit-text-fill-color: var(--aidc-green-500) !important;
}

body.page-text .chat-trash-modal__btn--delete:hover,
body.page-text .chat-trash-modal__clear-all {
  background: color-mix(in srgb,var(--aidc-red-500) 10%,var(--aidc-bg-card)) !important;
  border-color: var(--aidc-action-danger-border) !important;
  color: var(--aidc-red-500) !important;
  -webkit-text-fill-color: var(--aidc-red-500) !important;
}

body.page-text .chat-trash-modal__clear-all:hover {
  background: color-mix(in srgb,var(--aidc-red-500) 16%,var(--aidc-bg-card)) !important;
  border-color: var(--aidc-red-500) !important;
}



/* Text workspace/folder controls are persistent actions, not hover affordances.
   Keep this contract shared by desktop and Telegram Text surfaces. */
body.page-text :where(
  .chat-folder__add-sub,
  .chat-folder__settings,
  .chat-folder__delete
) {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

/* Workspace settings close control must retain a stable hit target and a visible
   icon in both light and dark themes. Legacy chat.css only colors the button and
   can collapse it to the SVG's intrinsic box. */
body.page-text .chat-settings-modal__close {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 32px !important;
  width: 32px !important;
  min-width: 32px !important;
  height: 32px !important;
  min-height: 32px !important;
  padding: 0 !important;
  border: 1px solid var(--aidc-border-default) !important;
  border-radius: 8px !important;
  background: var(--aidc-btn-secondary-bg) !important;
  color: var(--aidc-text-secondary) !important;
  opacity: 1 !important;
  visibility: visible !important;
  -webkit-text-fill-color: currentColor !important;
}

body.page-text .chat-settings-modal__close svg {
  display: block !important;
  width: 16px !important;
  min-width: 16px !important;
  height: 16px !important;
  min-height: 16px !important;
  color: currentColor !important;
  stroke: currentColor !important;
  opacity: 1 !important;
}

body.page-text .chat-settings-modal__close :where(path,line,polyline) {
  stroke: currentColor !important;
  opacity: 1 !important;
}

body.page-text .chat-settings-modal__close:hover {
  background: var(--aidc-btn-secondary-bg-hover) !important;
  border-color: var(--aidc-border-strong) !important;
  color: var(--aidc-text-primary) !important;
}

body.page-text .chat-settings-modal__close:focus-visible {
  outline: none !important;
  border-color: var(--aidc-action-focus) !important;
  box-shadow: 0 0 0 3px var(--aidc-action-focus-ring) !important;
}


/* Text/Chat route shell visual adapter.
   Chat component visuals remain owned by chat-theme.css. */

html,
body.page-text{
  background:var(--aidc-bg-page)!important;
  color:var(--aidc-text-primary)!important
}

body.page-text .chat-main,
body.page-text .chat-messages{
  background:var(--aidc-workspace-bg)!important
}

body.page-text .chat-preview-panel{
  background:var(--aidc-bg-card)!important;
  border-color:var(--aidc-border-default)!important;
  color:var(--aidc-text-secondary)!important
}

body.page-text .chat-preview-panel__header,
body.page-text .chat-preview-panel__toolbar,
body.page-text .chat-preview-panel__footer{
  background:var(--aidc-bg-panel)!important;
  border-color:var(--aidc-border-subtle)!important;
  color:var(--aidc-text-primary)!important
}

body.page-text .chat-preview-panel__title,
body.page-text .chat-preview-panel__body h1,
body.page-text .chat-preview-panel__body h2,
body.page-text .chat-preview-panel__body h3,
body.page-text .chat-preview-panel__body h4,
body.page-text .chat-preview-panel__body strong,
body.page-text .chat-preview-panel__body b{
  color:var(--aidc-text-primary)!important
}

body.page-text .chat-preview-panel__body,
body.page-text .chat-preview-panel__body p,
body.page-text .chat-preview-panel__body li,
body.page-text .chat-preview-panel__body blockquote,
body.page-text .chat-preview-panel__body td{
  color:var(--aidc-text-secondary)!important
}

body.page-text .chat-preview-panel__body small,
body.page-text .chat-preview-panel__body .muted,
body.page-text .chat-preview-panel__meta{
  color:var(--aidc-text-muted)!important
}

body.page-text .chat-preview-panel__body hr,
body.page-text .chat-preview-panel__body table,
body.page-text .chat-preview-panel__body th,
body.page-text .chat-preview-panel__body td{
  border-color:var(--aidc-border-default)!important
}

body.page-text .chat-preview-panel__body pre,
body.page-text .chat-preview-panel__body code{
  background:var(--aidc-bg-elevated)!important;
  color:var(--aidc-text-primary)!important;
  border-color:var(--aidc-border-default)!important
}

/* Document/file cards inside the conversation historically carried a black
   fade authored for dark mode. Route it through workspace surfaces instead. */
body.page-text :where(.chat-file-card,.chat-attachment-card,.chat-message__file,.chat-message__attachment,.chat-doc-card){
  background:var(--aidc-bg-card)!important;
  border-color:var(--aidc-border-default)!important;
  color:var(--aidc-text-secondary)!important;
  box-shadow:none!important
}

body.page-text :where(.chat-file-card,.chat-attachment-card,.chat-message__file,.chat-message__attachment,.chat-doc-card)::after{
  background:linear-gradient(transparent,var(--aidc-bg-card))!important
}

body.page-text :where(.chat-file-card,.chat-attachment-card,.chat-message__file,.chat-message__attachment,.chat-doc-card) strong{
  color:var(--aidc-text-primary)!important
}



/* Desktop Text Chat visual adapter.
   chat.css keeps layout, responsive geometry and TG-specific behavior.
*/

body .chat-container{
  background:var(--aidc-bg-page);
  color:var(--aidc-text-primary)
}

body .chat-container *{
  scrollbar-color:var(--aidc-border-default) transparent
}
body .chat-container *::-webkit-scrollbar-thumb{
  background:var(--aidc-border-default)
}
body .chat-container *::-webkit-scrollbar-thumb:hover{
  background:var(--aidc-border-strong)
}

body .chat-sidebar,
body .chat-input-area,
body .chat-preview-panel{
  background:var(--aidc-bg-panel)
}

body .chat-main,
body .chat-messages{
  background:color-mix(in srgb,var(--aidc-bg-card) 92%,black 8%)
}

body .chat-preview-panel{
  background:color-mix(in srgb,var(--aidc-bg-card) 96%,white 4%)
}

body .chat-custom-select__dropdown{
  background:var(--aidc-bg-popover);
  border-color:var(--aidc-border-default);
  box-shadow:var(--aidc-shadow-popover)
}

body .chat-custom-select__item{color:var(--aidc-text-secondary)}
body .chat-custom-select__item:hover{background:var(--aidc-btn-secondary-bg-hover);color:var(--aidc-text-primary)}
body .chat-custom-select__item.active{background:color-mix(in srgb,var(--aidc-action-primary-from) 10%,transparent);color:var(--aidc-action-primary-from)}

body .chat-sidebar{
  border-right-color:var(--aidc-border-subtle)
}
body .chat-sidebar__header,
body .chat-sidebar__footer,
body .chat-header,
body .chat-input-area,
body .chat-settings-modal__footer{
  border-color:var(--aidc-border-subtle)
}

body .chat-sidebar__resizer:hover,
body .chat-sidebar__resizer--active{
  background:color-mix(in srgb,var(--aidc-action-primary-from) 34%,transparent)
}

body .chat-sidebar__new-btn,
body .chat-send-btn,
body .chat-settings-modal__save{
  background:linear-gradient(135deg,var(--aidc-action-primary-from),var(--aidc-action-primary-to));
  color:var(--aidc-text-inverse);
  box-shadow:0 0 16px var(--aidc-action-primary-glow)
}

body .chat-sidebar__new-btn:hover,
body .chat-send-btn:hover,
body .chat-settings-modal__save:hover{
  filter:brightness(1.08);
  opacity:1
}

body .chat-sidebar__trash-btn,
body .chat-sidebar__item,
body .chat-sidebar__new-folder-btn,
body .chat-sidebar__settings-btn,
body .chat-folder__header,
body .chat-folder__count,
body .chat-folder__toggle,
body .chat-folder__icon,
body .chat-folder__settings,
body .chat-sidebar__item-delete,
body .chat-sidebar__item-menu{
  color:var(--aidc-text-muted)
}

body .chat-workspace-section--selected{
  background:var(--aidc-bg-panel);
  border-color:var(--aidc-border-subtle)
}

body .chat-sidebar__trash-btn:hover,
body .chat-sidebar__item:hover,
body .chat-sidebar__new-folder-btn:hover,
body .chat-sidebar__settings-btn:hover,
body .chat-folder__header:hover{
  background:var(--aidc-btn-secondary-bg-hover);
  color:var(--aidc-text-primary)
}

body .chat-sidebar__new-folder-btn,
body .chat-sidebar__settings-btn,
body .chat-folder__count{
  background:var(--aidc-btn-secondary-bg);
  border-color:var(--aidc-border-subtle)
}

body .chat-sidebar__item--active,
body .chat-folder--selected>.chat-folder__header,
body .chat-folder--dragover>.chat-folder__header{
  background:color-mix(in srgb,var(--aidc-action-primary-from) 12%,transparent);
  color:var(--aidc-text-primary)
}

body .chat-folder--selected>.chat-folder__header .chat-folder__icon,
body .chat-folder--selected>.chat-folder__header .chat-folder__toggle{
  color:var(--aidc-action-primary-from)
}

body .chat-folder--dragover>.chat-folder__header{
  outline-color:color-mix(in srgb,var(--aidc-action-primary-from) 48%,transparent)
}

body .chat-folder__delete:hover,
body .chat-sidebar__item-delete:hover{
  color:var(--aidc-red-500)
}

body .chat-ctx-menu,
body .chat-picker-popup,
body .chat-effort-popup,
body .chat-attach-popover{
  background:var(--aidc-bg-popover);
  border-color:var(--aidc-border-default);
  box-shadow:var(--aidc-shadow-popover);
  color:var(--aidc-text-primary)
}

body .chat-ctx-menu__item,
body .chat-picker-popup__item,
body .chat-effort-btn{
  background:transparent;
  color:var(--aidc-text-secondary)
}

body .chat-ctx-menu__item:hover,
body .chat-picker-popup__item:hover,
body .chat-effort-btn:hover{
  background:var(--aidc-btn-secondary-bg-hover);
  color:var(--aidc-text-primary)
}

body .chat-ctx-menu__item--danger:hover{
  background:color-mix(in srgb,var(--aidc-red-500) 12%,transparent);
  color:color-mix(in srgb,var(--aidc-red-500) 64%,white 36%)
}

body .chat-settings-modal,
body .chat-folder-settings-modal,
body .chat-chat-settings-modal,
body .chat-trash-modal,
body .chat-expand-modal,
body .chat-preview-backdrop.open,
body .chat-sidebar-backdrop.open{
  background:var(--aidc-backdrop)
}

body .chat-settings-modal__content,
body .chat-expand-modal__container{
  background:var(--aidc-bg-modal);
  border-color:var(--aidc-border-default);
  box-shadow:var(--aidc-shadow-modal);
  color:var(--aidc-text-primary)
}

body .chat-settings__hint-icon{
  background:color-mix(in srgb,var(--aidc-action-primary-from) 12%,transparent);
  color:var(--aidc-action-primary-from);
  border-color:color-mix(in srgb,var(--aidc-action-primary-from) 36%,transparent)
}
body .chat-settings__hint-icon:hover,
body .chat-settings__hint-icon:focus{
  background:color-mix(in srgb,var(--aidc-action-primary-from) 20%,transparent);
  color:var(--aidc-text-primary)
}
body .chat-settings__hint{color:var(--aidc-text-muted)}
body .chat-settings__hint b{color:var(--aidc-action-primary-from)}

body .chat-header__title,
body .chat-expand-modal__title{
  color:var(--aidc-text-primary)
}
body .chat-header__model{
  color:var(--aidc-action-primary-from);
  background:color-mix(in srgb,var(--aidc-action-primary-from) 12%,transparent)
}

body .chat-messages{
  scrollbar-color:var(--aidc-border-default) transparent
}
body .chat-messages::-webkit-scrollbar-thumb,
body .chat-sidebar__list::-webkit-scrollbar-thumb{
  background:var(--aidc-border-default)
}
body .chat-messages::-webkit-scrollbar-thumb:hover{
  background:var(--aidc-border-strong)
}

body .chat-message--user .chat-message__avatar,
body .chat-message--assistant .chat-message__avatar{
  background:var(--aidc-bg-elevated)
}

body .chat-message--user .chat-message__bubble{
  background:var(--aidc-bg-card);
  border-color:var(--aidc-border-default);
  color:var(--aidc-text-primary)
}
body .chat-message--assistant .chat-message__bubble{
  background:color-mix(in srgb,var(--aidc-bg-card) 92%,white 8%);
  border-color:var(--aidc-border-subtle);
  color:var(--aidc-text-secondary)
}
body .chat-message--assistant .chat-message__bubble strong,
body .chat-message--assistant .chat-message__bubble b,
body .chat-message--assistant .chat-message__bubble h1,
body .chat-message--assistant .chat-message__bubble h2,
body .chat-message--assistant .chat-message__bubble h3{
  color:var(--aidc-text-primary)
}

body .chat-message__tokens{
  border-top-color:var(--aidc-border-subtle);
  color:var(--aidc-text-muted)
}
body .chat-message__tokens .tok-in::before{background:var(--aidc-action-primary-from)}
body .chat-message__tokens .tok-out::before{background:var(--aidc-green-500)}
body .chat-message__tokens .tok-cost::before{background:var(--aidc-red-500)}
body .chat-message__tokens .tok-cache{color:var(--aidc-cyan-500);background:transparent}
body .chat-message__tokens .tok-cache::before{background:var(--aidc-cyan-500)}
body .chat-message__tokens .tok-model{color:var(--aidc-violet-500)}
body .chat-message__tokens .tok-model::before{background:var(--aidc-violet-500)}
body .chat-message__time{color:var(--aidc-text-muted)}

body .chat-message__copy,
body .chat-message__reply-btn,
body .chat-attach-btn,
body .chat-mic-btn,
body .chat-expand-btn,
body .chat-header__select-btn,
body .chat-expand-modal__close,
body .chat-expand-modal__done,
body .chat-preview-panel__btn{
  background:var(--aidc-btn-secondary-bg);
  border-color:var(--aidc-border-default);
  color:var(--aidc-text-secondary)
}

body .chat-message__copy:hover,
body .chat-message__reply-btn:hover,
body .chat-attach-btn:hover,
body .chat-mic-btn:hover,
body .chat-expand-btn:hover,
body .chat-header__select-btn:hover,
body .chat-expand-modal__close:hover,
body .chat-expand-modal__done:hover,
body .chat-preview-panel__btn:hover{
  background:var(--aidc-btn-secondary-bg-hover);
  border-color:var(--aidc-border-strong);
  color:var(--aidc-text-primary);
  box-shadow:none
}

body .chat-message__copy.copied{
  color:var(--aidc-green-500);
  border-color:color-mix(in srgb,var(--aidc-green-500) 34%,transparent)
}

body .chat-message__reply-quote,
body .chat-reply-bar{
  background:color-mix(in srgb,var(--aidc-action-primary-from) 8%,transparent);
  border-color:color-mix(in srgb,var(--aidc-action-primary-from) 42%,transparent);
  color:var(--aidc-text-secondary)
}
body .chat-message__reply-label,
body .chat-reply-bar__icon{
  color:var(--aidc-action-primary-from)
}
body .chat-reply-bar__close{color:var(--aidc-text-muted)}
body .chat-reply-bar__close:hover{color:var(--aidc-text-primary)}

body .chat-header__select-btn.active,
body .chat-messages--select-mode .chat-message--selected{
  background:color-mix(in srgb,var(--aidc-action-primary-from) 10%,transparent);
  color:var(--aidc-action-primary-from)
}
body .chat-messages--select-mode .chat-message--selected::before{
  background:var(--aidc-action-primary-from)
}

body .chat-select-bar{
  background:var(--aidc-bg-panel);
  border-top-color:var(--aidc-border-subtle)
}
body .chat-select-bar__count{color:var(--aidc-text-secondary)}
body .chat-select-bar__delete{
  background:color-mix(in srgb,var(--aidc-red-500) 12%,transparent);
  color:color-mix(in srgb,var(--aidc-red-500) 64%,white 36%)
}
body .chat-select-bar__delete:hover{background:color-mix(in srgb,var(--aidc-red-500) 20%,transparent)}
body .chat-select-bar__cancel{
  background:var(--aidc-btn-secondary-bg);
  color:var(--aidc-text-secondary)
}
body .chat-select-bar__cancel:hover{
  background:var(--aidc-btn-secondary-bg-hover);
  color:var(--aidc-text-primary)
}
body .chat-select-bar__move{
  background:color-mix(in srgb,var(--aidc-cyan-500) 10%,transparent);
  color:var(--aidc-cyan-500)
}
body .chat-select-bar__copy{
  background:color-mix(in srgb,var(--aidc-green-500) 10%,transparent);
  color:var(--aidc-green-500)
}

body .chat-picker-popup__header,
body .chat-picker-popup__loading,
body .chat-picker-popup__empty{
  color:var(--aidc-text-muted)
}
body .chat-picker-popup__search{
  background:var(--aidc-bg-elevated);
  border-color:var(--aidc-border-default);
  color:var(--aidc-text-primary)
}
body .chat-picker-popup__search:focus{
  border-color:var(--aidc-action-focus);
  box-shadow:0 0 0 3px var(--aidc-action-focus-ring)
}

body .chat-message__bubble pre{
  background:var(--aidc-bg-elevated);
  border-color:var(--aidc-border-subtle)
}
body .chat-message__bubble a,
body .chat-preview-panel__body a{
  color:var(--aidc-action-primary-from);
  text-decoration-color:color-mix(in srgb,var(--aidc-action-primary-from) 42%,transparent)
}
body .chat-message__bubble a:hover,
body .chat-preview-panel__body a:hover{
  color:var(--aidc-action-primary-to)
}

body .chat-input-area{background:var(--aidc-bg-panel);border-top-color:var(--aidc-border-subtle)}
body .chat-input{
  background:var(--aidc-bg-elevated);
  border-color:var(--aidc-border-default);
  color:var(--aidc-text-primary)
}
body .chat-input:focus{
  border-color:var(--aidc-action-focus);
  box-shadow:0 0 0 3px var(--aidc-action-focus-ring)
}
body .chat-input::placeholder{color:var(--aidc-text-muted)}

body .chat-effort-select,
body .chat-effort-trigger{
  background:var(--aidc-btn-secondary-bg);
  border-color:var(--aidc-border-default)
}
body .chat-effort-btn.active,
body .chat-effort-select--open .chat-effort-trigger{
  background:color-mix(in srgb,var(--aidc-action-primary-from) 12%,transparent);
  border-color:color-mix(in srgb,var(--aidc-action-primary-from) 36%,transparent);
  color:var(--aidc-text-primary);
  box-shadow:none
}

body .chat-mic-btn--recording{
  background:color-mix(in srgb,var(--aidc-red-500) 12%,transparent);
  border-color:var(--aidc-action-danger-border);
  color:var(--aidc-red-500)
}
body .chat-mic-btn--busy{background:var(--aidc-btn-secondary-bg);color:var(--aidc-text-muted)}
body .chat-mic-btn--busy::after{border-top-color:var(--aidc-text-secondary)}
body .chat-mic-btn--blocked::before{background:var(--aidc-red-500);box-shadow:0 0 0 2px var(--aidc-bg-panel)}

body .chat-expand-modal__container{background:var(--aidc-bg-modal)}
body .chat-expand-modal__header,
body .chat-expand-modal__footer{border-color:var(--aidc-border-subtle)}
body .chat-expand-modal__textarea{color:var(--aidc-text-primary)}
body .chat-expand-modal__textarea::placeholder,
body .chat-expand-modal__counter{color:var(--aidc-text-muted)}
body .chat-expand-modal__textarea::-webkit-scrollbar-thumb{background:var(--aidc-border-default)}
body .chat-expand-modal__send{
  background:linear-gradient(135deg,var(--aidc-action-primary-from),var(--aidc-action-primary-to));
  border-color:transparent;
  color:var(--aidc-text-inverse);
  box-shadow:0 0 16px var(--aidc-action-primary-glow)
}
body .chat-expand-modal__send:hover{filter:brightness(1.08);box-shadow:0 0 22px var(--aidc-action-primary-glow)}

body .chat-attached-file{
  background:var(--aidc-bg-card);
  border-color:var(--aidc-border-default);
  color:var(--aidc-text-secondary)
}
body .chat-attached-file__icon,
body .chat-attached-file__size,
body .chat-attached-file__remove{color:var(--aidc-text-muted)}
body .chat-attached-file__remove:hover{
  background:color-mix(in srgb,var(--aidc-red-500) 14%,transparent);
  color:var(--aidc-red-500)
}
body .chat-main--dragover::after{
  background:color-mix(in srgb,var(--aidc-action-primary-from) 8%,transparent);
  border-color:color-mix(in srgb,var(--aidc-action-primary-from) 42%,transparent);
  color:var(--aidc-action-primary-from)
}
body .chat-attach-hint{color:var(--aidc-text-muted)}

body .chat-attach-popover__title{color:var(--aidc-text-primary)}
body .chat-attach-popover__plan,
body .chat-attach-popover__section-title,
body .chat-attach-popover__table th,
body .chat-attach-popover__note,
body .chat-attach-popover__row--textonly td,
body .chat-attach-popover__foot{color:var(--aidc-text-muted)}
body .chat-attach-popover__plan b{color:var(--aidc-action-primary-from)}
body .chat-attach-popover__table th,
body .chat-attach-popover__table td,
body .chat-attach-popover__foot{border-color:var(--aidc-border-subtle)}
body .chat-attach-popover__ico,
body .chat-attach-popover__row--textonly td:first-child{color:var(--aidc-text-secondary)}

body .chat-stop-btn{
  background:var(--aidc-red-500);
  color:var(--aidc-text-inverse)
}
body .chat-typing span{background:var(--aidc-action-primary-from)}

body .chat-model-select{
  background:var(--aidc-bg-elevated);
  border-color:var(--aidc-border-default);
  color:var(--aidc-text-primary)
}
body .chat-model-select option{
  background:var(--aidc-bg-popover);
  color:var(--aidc-text-primary)
}

body .chat-empty{color:var(--aidc-text-muted)}
body .chat-empty__icon{color:var(--aidc-text-secondary)}
body .chat-empty__hint{color:var(--aidc-text-muted)}

body .chat-doc-card{
  background:var(--aidc-bg-card);
  border-color:var(--aidc-border-subtle)
}
body .chat-doc-card:hover{
  background:color-mix(in srgb,var(--aidc-bg-card) 94%,white 6%);
  border-color:var(--aidc-border-strong)
}
body .chat-doc-card__icon{
  background:color-mix(in srgb,var(--aidc-action-primary-from) 10%,transparent);
  color:var(--aidc-action-primary-from)
}
body .chat-doc-card__title{color:var(--aidc-text-primary)}
body .chat-doc-card__meta,
body .chat-doc-card__preview{color:var(--aidc-text-muted)}
body .chat-doc-card__preview::after{background:linear-gradient(transparent,var(--aidc-bg-card))}
body .chat-message__content :is(.md-h1,.md-h2,.md-h3,.md-h4,.md-h5,.md-h6),
body .chat-preview-panel__body :is(.md-h1,.md-h2,.md-h3,.md-h4,.md-h5,.md-h6){
  color:var(--aidc-text-primary);
  border-color:var(--aidc-border-subtle)
}
body .chat-message__content .md-table :is(th,td),
body .chat-preview-panel__body .md-table :is(th,td){border-color:var(--aidc-border-default)}
body .chat-message__content .md-table th,
body .chat-preview-panel__body .md-table th{
  color:var(--aidc-text-primary);
  background:var(--aidc-bg-elevated)
}
body .chat-message__content .md-table tbody tr:nth-child(even) td,
body .chat-preview-panel__body .md-table tbody tr:nth-child(even) td{background:var(--aidc-bg-card)}
body .chat-doc-card__expand{
  background:var(--aidc-btn-secondary-bg);
  color:var(--aidc-text-muted)
}
body .chat-doc-card__expand:hover{
  background:var(--aidc-btn-secondary-bg-hover);
  color:var(--aidc-text-primary)
}

/* Auxiliary chat controls must follow the same theme as the composer. */
body .chat-attach-chooser,
body .chat-settings-custom-select__dropdown{
  background:var(--aidc-bg-popover);
  border-color:var(--aidc-border-default);
  box-shadow:var(--aidc-shadow-popover);
  color:var(--aidc-text-primary)
}
body .chat-attach-chooser__item,
body .chat-settings-custom-select__trigger{
  background:var(--aidc-btn-secondary-bg);
  border-color:var(--aidc-border-default);
  color:var(--aidc-text-primary)
}
body .chat-attach-chooser__title,
body .chat-attached-file__name,
body .chat-settings-modal__header h3{
  color:var(--aidc-text-primary)
}
body .chat-attach-chooser__desc,
body .chat-settings-custom-select__option{
  color:var(--aidc-text-secondary)
}
body .chat-attach-chooser__icon{
  background:var(--aidc-bg-elevated);
  color:var(--aidc-action-primary-from)
}
body .chat-attach-chooser__item:hover,
body .chat-settings-custom-select__option:hover{
  background:var(--aidc-btn-secondary-bg-hover);
  color:var(--aidc-text-primary)
}
body .chat-settings-custom-select__option.active{
  background:var(--aidc-control-selected-bg);
  color:var(--aidc-control-selected-text)
}
body .chat-folder-settings-modal__close,
body .chat-chat-settings-modal__close{
  background:transparent;
  color:var(--aidc-text-muted)
}
body .chat-folder-settings-modal__close:hover,
body .chat-chat-settings-modal__close:hover{
  background:var(--aidc-btn-secondary-bg-hover);
  color:var(--aidc-text-primary)
}
body .chat-settings__ks-btn{
  background:var(--aidc-btn-secondary-bg);
  border-color:var(--aidc-border-default);
  color:var(--aidc-text-primary)
}
body .chat-doc-card__preview::after{
  background:linear-gradient(transparent,var(--aidc-bg-card))
}
body .chat-doc-card:hover .chat-doc-card__preview::after{
  background:linear-gradient(transparent,color-mix(in srgb,var(--aidc-bg-card) 94%,white 6%))
}

body .chat-file-chip,
body .chat-file-chip__name,
body .chat-file-chip__icon{
  color:var(--aidc-text-primary);
  -webkit-text-fill-color:var(--aidc-text-primary)
}
body .chat-file-chip--doc{
  background:var(--aidc-bg-elevated);
  border-color:var(--aidc-border-default)
}
body .chat-file-chip__ext{
  background:var(--aidc-control-selected-bg);
  color:var(--aidc-control-selected-text);
  -webkit-text-fill-color:var(--aidc-control-selected-text)
}

body .chat-variant-trigger,body .chat-variant-trigger__label,
body .chat-variant-btn,body .chat-variant-btn strong{
  color:var(--aidc-text-primary);
  -webkit-text-fill-color:var(--aidc-text-primary)
}
body .chat-variant-popup{background:var(--aidc-bg-popover);border-color:var(--aidc-border-default)}
body .chat-variant-btn span{color:var(--aidc-text-secondary)}
body .chat-variant-trigger:hover,body .chat-variant-btn:hover{background:var(--aidc-btn-secondary-bg-hover)}
body .chat-variant-btn.active{background:var(--aidc-control-selected-bg)}
body .chat-message__content .md-table th,
body .chat-preview-panel__body .md-table th{
  background:var(--aidc-bg-elevated);
  color:var(--aidc-text-primary);
  -webkit-text-fill-color:var(--aidc-text-primary)
}
body .chat-message__content .md-table :is(th,td),
body .chat-preview-panel__body .md-table :is(th,td){border-color:var(--aidc-border-default)}
body .chat-preview-panel__body :is(strong,h1,h2,h3,h4,h5,h6){color:var(--aidc-text-primary)}



/* Text chat model picker theme adapter.
   Geometry remains owned by chat.css; visual state is routed through canonical tokens. */
body .chat-custom-select__trigger {
  background: var(--aidc-btn-secondary-bg);
  border-color: var(--aidc-border-default);
  color: var(--aidc-text-primary);
}

body .chat-custom-select__trigger:hover {
  background: var(--aidc-btn-secondary-bg-hover);
  border-color: var(--aidc-action-focus);
}

body .chat-custom-select__label {
  color: var(--aidc-text-primary);
}

body .chat-custom-select__arrow {
  color: var(--aidc-text-muted);
}

body .chat-custom-select__dropdown {
  background: var(--aidc-bg-popover);
  border-color: var(--aidc-border-default);
  box-shadow: var(--aidc-shadow-popover);
  color: var(--aidc-text-primary);
}

body .chat-custom-select__item {
  color: var(--aidc-text-secondary);
}

body .chat-custom-select__item:hover {
  background: var(--aidc-btn-secondary-bg-hover);
  color: var(--aidc-text-primary);
}

body .chat-custom-select__item.active {
  background: color-mix(in srgb, var(--aidc-action-primary-from) 10%, transparent);
  color: var(--aidc-action-primary-from);
}

body .chat-custom-select__item-info {
  border-color: var(--aidc-border-default);
  color: var(--aidc-text-muted);
}

body .chat-custom-select__item-info:hover {
  background: color-mix(in srgb, var(--aidc-action-primary-from) 10%, transparent);
  border-color: var(--aidc-action-focus);
  color: var(--aidc-action-primary-from);
}

body .chat-custom-select__item.locked {
  color: var(--aidc-text-muted);
}

/* Shared family menu for desktop and touch; exact versions keep their locks. */
body .chat-model-versions {
  position: fixed;
  z-index: 10001;
  padding: 8px;
  overflow-y: auto;
  box-sizing: border-box;
  border: 1px solid var(--aidc-border-default);
  border-radius: 16px;
  background: var(--aidc-bg-popover);
  color: var(--aidc-text-primary);
  box-shadow: var(--aidc-shadow-popover);
}
body .chat-model-versions[hidden] { display: none; }
body .chat-model-versions__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 6px 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--aidc-border-subtle);
}
body .chat-model-versions__head button {
  border: 1px solid var(--aidc-border-default);
  border-radius: 8px;
  background: var(--aidc-btn-secondary-bg);
  color: var(--aidc-text-secondary);
  width: 28px;
  height: 28px;
  cursor: pointer;
}
body .chat-model-menu--grouped .chat-custom-select__item { border-radius: 8px; }
body .chat-model-menu--grouped .chat-custom-select__item-lock svg { width: 14px; height: 14px; display: block; }
body .chat-model-menu--grouped .chat-custom-select__item:focus-visible {
  outline: 2px solid var(--aidc-action-focus);
  outline-offset: -2px;
}
body .chat-model-menu--grouped .chat-model-brand {
  color: var(--aidc-text-secondary);
  background: currentColor;
  -webkit-mask: var(--chat-model-logo) center / contain no-repeat;
  mask: var(--chat-model-logo) center / contain no-repeat;
}
@media (max-width: 600px) {
  body .chat-model-versions {
    position: static;
    width: auto;
    max-height: none;
    margin: 4px 0 8px 16px;
    box-shadow: none;
  }
}



.chat-workspace-section {
  background: var(--aidc-bg-card);
  border-color: var(--aidc-border-subtle);
  color: var(--aidc-text-secondary);
}

.chat-workspace-section--selected {
  background: color-mix(in srgb, var(--aidc-action-primary-from) 8%, var(--aidc-bg-card));
  border-color: color-mix(in srgb, var(--aidc-action-primary-from) 36%, var(--aidc-border-default));
}

.chat-workspace-section--dragover {
  border-color: color-mix(in srgb, var(--aidc-cyan-500) 55%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--aidc-cyan-500) 24%, transparent);
}

.chat-workspace-section__header {
  color: var(--aidc-text-secondary);
}

.chat-workspace-section__header:hover {
  background: var(--aidc-btn-secondary-bg-hover);
  color: var(--aidc-text-primary);
}

.chat-workspace-section__toggle {
  color: var(--aidc-text-muted);
}

.chat-workspace-section__toggle:hover {
  color: var(--aidc-text-primary);
}

.chat-workspace-section__dot {
  background: var(--aidc-action-primary-from);
  box-shadow: 0 0 10px var(--aidc-action-primary-glow);
}

/* chat.css renders the workspace label with __title. Keep the semantic theme
   adapter on that real DOM contract so light mode never inherits the legacy
   near-white dark-theme literal. */
.chat-workspace-section__title {
  color: var(--aidc-text-primary);
}

.chat-workspace-section__meta,
.chat-workspace-section__folderbar-label {
  color: var(--aidc-text-muted);
}

.chat-workspace-section__folderbar-label svg {
  color: var(--aidc-cyan-500);
}

.chat-workspace-section__settings {
  background: var(--aidc-btn-secondary-bg);
  border-color: var(--aidc-border-subtle);
  color: var(--aidc-text-muted);
}

.chat-workspace-section__settings:hover,
.chat-workspace-section__settings:focus-visible {
  background: var(--aidc-btn-secondary-bg-hover);
  border-color: var(--aidc-border-strong);
  color: var(--aidc-text-primary);
  outline: none;
}

.chat-workspace-section__new-folder {
  background: color-mix(in srgb, var(--aidc-action-primary-from) 10%, transparent);
  border-color: color-mix(in srgb, var(--aidc-action-primary-from) 24%, transparent);
  color: color-mix(in srgb, var(--aidc-action-primary-from) 64%, white 36%);
}

.chat-workspace-section__new-folder:hover,
.chat-workspace-section__new-folder:focus-visible {
  background: color-mix(in srgb, var(--aidc-action-primary-from) 20%, transparent);
  border-color: color-mix(in srgb, var(--aidc-action-primary-from) 44%, transparent);
  color: var(--aidc-text-primary);
  outline: none;
}

.chat-workspace-section--collapsed .chat-workspace-section__body {
  display: none;
}

body.chat-in-telegram .chat-workspace-section {
  background: var(--aidc-bg-card) !important;
  border-color: var(--aidc-border-subtle) !important;
}

body.chat-in-telegram .chat-workspace-section__title {
  color: var(--aidc-text-primary) !important;
}

body.chat-in-telegram .chat-workspace-section--selected {
  background: var(--aidc-bg-card) !important;
  border-color: var(--aidc-border-default) !important;
}

body.chat-in-telegram .chat-workspace-section__header:hover,
body.chat-in-telegram .chat-workspace-section__settings:hover {
  background: var(--aidc-btn-secondary-bg-hover) !important;
  color: var(--aidc-text-primary) !important;
}


/* Compact row action menu for Text chat sidebar.
   Folder/chat rows expose one vertical kebab trigger; actions are portalled to
   <body> while open so nested overflow never clips the menu. */
.chat-tree-actions {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  margin-left: auto;
}

.chat-tree-actions__trigger {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--aidc-text-muted);
  cursor: pointer;
  opacity: .76;
  transition: background .12s ease, color .12s ease, opacity .12s ease;
}

.chat-tree-actions__trigger svg {
  width: 18px;
  height: 18px;
  display: block;
}

.chat-folder__header:hover .chat-tree-actions__trigger,
.chat-sidebar__item:hover .chat-tree-actions__trigger,
.chat-tree-actions__trigger:focus-visible,
.chat-tree-actions__trigger.is-open {
  background: var(--aidc-btn-secondary-bg-hover);
  color: var(--aidc-text-primary);
  opacity: 1;
}

.chat-tree-actions__trigger:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--aidc-action-primary-from) 55%, transparent);
  outline-offset: 1px;
}

.chat-tree-actions__menu {
  position: fixed;
  z-index: 10030;
  min-width: 206px;
  max-width: min(286px, calc(100vw - 16px));
  padding: 6px;
  border: 1px solid var(--aidc-border-default);
  border-radius: 11px;
  background: var(--aidc-bg-popover);
  color: var(--aidc-text-secondary);
  box-shadow: var(--aidc-shadow-popover);
}

.chat-tree-actions__menu[hidden] {
  display: none !important;
}

/* TG sidebar is a fixed overlay above the ordinary site popup layer. */
body.chat-in-telegram .chat-tree-actions__menu,
body.chat-in-telegram .chat-ctx-menu {
  z-index: 200030;
}

body.chat-in-telegram .chat-folder--selected > .chat-folder__header {
  background: var(--aidc-btn-secondary-bg-hover) !important;
  color: var(--aidc-text-primary) !important;
}
body.chat-in-telegram .chat-folder--selected > .chat-folder__header .chat-folder__icon,
body.chat-in-telegram .chat-folder--selected > .chat-folder__header .chat-folder__toggle {
  color: var(--aidc-text-secondary) !important;
}

.chat-tree-actions__item,
.chat-tree-actions__menu :where(
  .chat-folder__add-sub,
  .chat-folder__settings,
  .chat-folder__delete,
  .chat-sidebar__item-settings,
  .chat-sidebar__item-delete
) {
  width: 100% !important;
  height: auto !important;
  min-width: 0 !important;
  min-height: 38px !important;
  margin: 0 !important;
  padding: 8px 10px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 9px !important;
  border: 0 !important;
  border-radius: 8px !important;
  background: transparent !important;
  color: var(--aidc-text-secondary) !important;
  font: inherit !important;
  font-size: 12px !important;
  line-height: 1.25 !important;
  text-align: left !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  cursor: pointer !important;
}

.chat-tree-actions__item:hover,
.chat-tree-actions__item:focus-visible {
  background: var(--aidc-btn-secondary-bg-hover) !important;
  color: var(--aidc-text-primary) !important;
  outline: none !important;
}

.chat-tree-actions__item--danger,
.chat-tree-actions__menu .chat-folder__delete,
.chat-tree-actions__menu .chat-sidebar__item-delete {
  color: var(--aidc-red-500) !important;
}

.chat-tree-actions__item--danger:hover,
.chat-tree-actions__item--danger:focus-visible,
.chat-tree-actions__menu .chat-folder__delete:hover,
.chat-tree-actions__menu .chat-sidebar__item-delete:hover {
  background: color-mix(in srgb, var(--aidc-red-500) 10%, transparent) !important;
  color: var(--aidc-red-500) !important;
}

.chat-tree-actions__item-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chat-tree-actions__item-icon svg {
  width: 15px !important;
  height: 15px !important;
  display: block;
}

.chat-tree-actions__item-label {
  min-width: 0;
  flex: 1 1 auto;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* Preserve title/count width: only the kebab consumes row space. */
.chat-folder__header > .chat-tree-actions,
.chat-sidebar__item-actions > .chat-tree-actions {
  flex: 0 0 auto;
}

@media (hover: none), (pointer: coarse), (max-width: 880px) {
  .chat-tree-actions__trigger {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
  }

  .chat-tree-actions__menu {
    min-width: min(238px, calc(100vw - 16px));
    padding: 7px;
  }

  .chat-tree-actions__item,
  .chat-tree-actions__menu :where(
    .chat-folder__add-sub,
    .chat-folder__settings,
    .chat-folder__delete,
    .chat-sidebar__item-settings,
    .chat-sidebar__item-delete
  ) {
    min-height: 44px !important;
    padding: 10px 11px !important;
    font-size: 13px !important;
  }
}



/* Model-info capability icons are monochrome UI glyphs. The legacy chat.css
   palette used translucent white, which disappears on light modal surfaces.
   Keep geometry in chat.css and route only visual semantics through tokens. */
.chat-model-info__label-ico,
.chat-model-info__file-ico {
  color: var(--aidc-text-secondary) !important;
  -webkit-text-fill-color: var(--aidc-text-secondary) !important;
  opacity: 1 !important;
}

.chat-model-info__label-ico--ok {
  color: var(--aidc-green-500) !important;
  -webkit-text-fill-color: var(--aidc-green-500) !important;
}

.chat-model-info__label-ico--warn {
  color: var(--aidc-status-warning-text) !important;
  -webkit-text-fill-color: var(--aidc-status-warning-text) !important;
}

/* Some runtime SVGs use currentColor, others carry an old explicit white
   stroke/fill. Normalize only these monochrome capability glyphs, never the
   provider/model brand avatar. */
.chat-model-info__label-ico svg,
.chat-model-info__file-ico svg {
  color: inherit !important;
  opacity: 1 !important;
}

.chat-model-info__label-ico svg [stroke]:not([stroke="none"]),
.chat-model-info__file-ico svg [stroke]:not([stroke="none"]) {
  stroke: currentColor !important;
}

.chat-model-info__label-ico svg [fill]:not([fill="none"]),
.chat-model-info__file-ico svg [fill]:not([fill="none"]) {
  fill: currentColor !important;
}





/* Mobile gallery action sheet. The base lightbox stylesheet still contains
   legacy dark literals; this contract owns the sheet chrome in both themes. */
.aidc-lb__sheetBackdrop{
  background:var(--aidc-backdrop)!important;
}
.aidc-lb__sheetCard{
  background:var(--aidc-bg-panel)!important;
  border-color:var(--aidc-border-default)!important;
  color:var(--aidc-text-primary)!important;
  box-shadow:var(--aidc-shadow-modal)!important;
}
.aidc-lb__sheetGrab{
  background:var(--aidc-border-strong)!important;
  opacity:1!important;
}
.aidc-lb__sheetHead{
  background:var(--aidc-bg-panel)!important;
  border-color:var(--aidc-border-default)!important;
  color:var(--aidc-text-primary)!important;
}
.aidc-lb__sheetTitle{
  color:var(--aidc-text-primary)!important;
  -webkit-text-fill-color:var(--aidc-text-primary)!important;
  opacity:1!important;
}
.aidc-lb__sheetList{
  background:var(--aidc-bg-panel)!important;
}

/* Runtime uses .aidc-sheetitem. Keep the historical .aidc-lb__sheetBtn alias
   covered so old callers cannot regress the palette. */
.aidc-sheetitem,
.aidc-lb__sheetBtn{
  box-sizing:border-box!important;
  width:100%!important;
  min-height:52px!important;
  padding:0 16px!important;
  border-radius:14px!important;
  border:1px solid var(--aidc-border-default)!important;
  background:var(--aidc-btn-secondary-bg)!important;
  color:var(--aidc-text-primary)!important;
  -webkit-text-fill-color:var(--aidc-text-primary)!important;
  box-shadow:none!important;
  opacity:1!important;
}
.aidc-sheetitem:hover,
.aidc-sheetitem:focus-visible,
.aidc-lb__sheetBtn:hover,
.aidc-lb__sheetBtn:focus-visible{
  background:var(--aidc-btn-secondary-bg-hover)!important;
  border-color:var(--aidc-border-strong)!important;
  color:var(--aidc-text-primary)!important;
  outline:none!important;
}
.aidc-sheetitem__txt{
  color:inherit!important;
  -webkit-text-fill-color:inherit!important;
  opacity:1!important;
}
.aidc-sheetitem__ico{
  width:34px!important;
  height:34px!important;
  min-width:34px!important;
  border-radius:10px!important;
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  background:color-mix(in srgb,var(--aidc-action-primary-from) 10%,var(--aidc-bg-elevated) 90%)!important;
  border:1px solid color-mix(in srgb,var(--aidc-action-primary-from) 28%,var(--aidc-border-default) 72%)!important;
  color:var(--aidc-text-secondary)!important;
  opacity:1!important;
}
.aidc-sheetitem__ico .aidc-lb__btn-icon,
.aidc-lb__sheetBtn :is(svg,.aidc-lb__btn-icon){
  color:var(--aidc-text-secondary)!important;
  opacity:1!important;
}
.aidc-sheetitem.is-disabled,
.aidc-sheetitem:disabled,
.aidc-lb__sheetBtn:disabled{
  color:var(--aidc-text-muted)!important;
  -webkit-text-fill-color:var(--aidc-text-muted)!important;
  opacity:.62!important;
}
.aidc-sheetitem.is-danger,
.aidc-lb__sheetBtn.is-danger{
  background:var(--aidc-status-danger-bg)!important;
  border-color:var(--aidc-action-danger-border)!important;
  color:var(--aidc-red-500)!important;
  -webkit-text-fill-color:var(--aidc-red-500)!important;
}
.aidc-sheetitem.is-danger .aidc-sheetitem__ico,
.aidc-lb__sheetBtn.is-danger :is(svg,.aidc-lb__btn-icon){
  background:color-mix(in srgb,var(--aidc-red-500) 10%,var(--aidc-bg-elevated) 90%)!important;
  border-color:var(--aidc-action-danger-border)!important;
  color:var(--aidc-red-500)!important;
}

html[data-aidc-color-mode="light"] .aidc-lb__sheetCard,
html[data-aidc-color-mode="light"] .aidc-lb__sheetHead,
html[data-aidc-color-mode="light"] .aidc-lb__sheetList{
  background:var(--aidc-bg-panel)!important;
  color:var(--aidc-text-primary)!important;
}
html[data-aidc-color-mode="light"] .aidc-sheetitem,
html[data-aidc-color-mode="light"] .aidc-lb__sheetBtn{
  background:var(--aidc-bg-elevated)!important;
  border-color:var(--aidc-border-strong)!important;
  color:var(--aidc-text-primary)!important;
  -webkit-text-fill-color:var(--aidc-text-primary)!important;
}
html[data-aidc-color-mode="light"] .aidc-sheetitem:hover,
html[data-aidc-color-mode="light"] .aidc-sheetitem:focus-visible,
html[data-aidc-color-mode="light"] .aidc-lb__sheetBtn:hover,
html[data-aidc-color-mode="light"] .aidc-lb__sheetBtn:focus-visible{
  background:var(--aidc-btn-secondary-bg-hover)!important;
}
html[data-aidc-color-mode="light"] .aidc-sheetitem.is-danger,
html[data-aidc-color-mode="light"] .aidc-lb__sheetBtn.is-danger{
  background:var(--aidc-status-danger-bg)!important;
  color:var(--aidc-red-500)!important;
  -webkit-text-fill-color:var(--aidc-red-500)!important;
}

/* Final mobile/TG ownership. lightbox.css contains an `html.tg .aidc-sheetitem`
   dark-only rule. Keep this selector deliberately more specific so a route or
   late-loaded WebView stylesheet cannot return the Actions sheet to dark mode. */
html.tg[data-aidc-color-mode="light"] body .aidc-lb__sheetCard,
html.tg[data-aidc-color-mode="light"] body .aidc-lb__sheetHead,
html.tg[data-aidc-color-mode="light"] body .aidc-lb__sheetList{
  background:var(--aidc-bg-panel)!important;
  border-color:var(--aidc-border-default)!important;
  color:var(--aidc-text-primary)!important;
}
html.tg[data-aidc-color-mode="light"] body .aidc-lb__sheetTitle{
  color:var(--aidc-text-primary)!important;
  -webkit-text-fill-color:var(--aidc-text-primary)!important;
}
html.tg[data-aidc-color-mode="light"] body :is(.aidc-sheetitem,.aidc-lb__sheetBtn){
  min-height:54px!important;
  height:54px!important;
  padding:0 16px!important;
  border-radius:14px!important;
  background:var(--aidc-bg-elevated)!important;
  border-color:var(--aidc-border-default)!important;
  color:var(--aidc-text-primary)!important;
  -webkit-text-fill-color:var(--aidc-text-primary)!important;
  box-shadow:none!important;
  opacity:1!important;
}
html.tg[data-aidc-color-mode="light"] body :is(.aidc-sheetitem,.aidc-lb__sheetBtn) :is(.aidc-sheetitem__txt,span,strong){
  color:inherit!important;
  -webkit-text-fill-color:inherit!important;
  opacity:1!important;
}
html.tg[data-aidc-color-mode="light"] body .aidc-sheetitem__ico{
  width:34px!important;
  height:34px!important;
  min-width:34px!important;
  background:var(--aidc-btn-secondary-bg)!important;
  border-color:var(--aidc-border-default)!important;
  color:var(--aidc-text-secondary)!important;
}
html.tg[data-aidc-color-mode="light"] body .aidc-sheetitem__ico :is(svg,path,rect,circle,polyline,line){
  color:inherit!important;
  stroke:currentColor!important;
  opacity:1!important;
}
html.tg[data-aidc-color-mode="light"] body :is(.aidc-sheetitem,.aidc-lb__sheetBtn):is(:hover,:focus-visible){
  background:var(--aidc-btn-secondary-bg-hover)!important;
  border-color:var(--aidc-border-strong)!important;
}
html.tg[data-aidc-color-mode="light"] body :is(.aidc-sheetitem,.aidc-lb__sheetBtn).is-danger{
  background:var(--aidc-status-danger-bg)!important;
  border-color:var(--aidc-action-danger-border)!important;
  color:var(--aidc-red-500)!important;
  -webkit-text-fill-color:var(--aidc-red-500)!important;
}


/* Lightbox semantic chrome. Media itself is never recolored. */
.aidc-lb__backdrop{background:var(--aidc-backdrop)!important}
.aidc-lb__shell{background:var(--aidc-bg-panel)!important;border-color:var(--aidc-border-default)!important;color:var(--aidc-text-primary)!important;box-shadow:var(--aidc-shadow-modal)!important}
.aidc-lb__main{background:var(--aidc-workspace-bg)!important;border-color:var(--aidc-border-subtle)!important}
.aidc-lb__panel{background:var(--aidc-bg-card)!important;border-color:var(--aidc-border-default)!important;color:var(--aidc-text-primary)!important}

.aidc-lb__close,.aidc-lb__nav,.aidc-lb__share,.aidc-lb__back,.aidc-lb__iconbtn,.aidc-lb__btn,.aidc-lb__mode-btn,.aidc-lb__wabtn,.aidc-lb__zoomcontrols button,.aidc-lb__zoomcontrols .aidc-btn{background:var(--aidc-lightbox-action-bg)!important;border-color:var(--aidc-lightbox-action-border)!important;color:var(--aidc-lightbox-action-text)!important;box-shadow:none!important}
.aidc-lb__close:hover,.aidc-lb__nav:hover,.aidc-lb__share:hover,.aidc-lb__back:hover,.aidc-lb__iconbtn:hover,.aidc-lb__btn:hover,.aidc-lb__mode-btn:hover,.aidc-lb__wabtn:hover,.aidc-lb__zoomcontrols button:hover,.aidc-lb__zoomcontrols .aidc-btn:hover{background:var(--aidc-lightbox-action-bg-hover)!important;border-color:var(--aidc-border-strong)!important;color:var(--aidc-lightbox-action-text-hover)!important;box-shadow:none!important}
.aidc-lb__mode-btn[data-act="favorite"].is-on{border-color:color-mix(in srgb,var(--aidc-status-warning) 48%,transparent)!important;box-shadow:inset 5px 0 0 var(--aidc-status-warning)!important}
.aidc-lb__mode-btn[data-act="favorite"].is-on .aidc-lb__btn-icon{background-color:var(--aidc-status-warning)!important}
.aidc-lb__zoomcontrols{--icon-color:var(--aidc-lightbox-zoom-control-text)!important;background:var(--aidc-lightbox-zoom-control-bg)!important;border:1px solid var(--aidc-lightbox-zoom-control-border)!important;border-radius:14px!important;padding:5px!important;box-shadow:none!important;color:var(--aidc-lightbox-zoom-control-text)!important;-webkit-text-fill-color:var(--aidc-lightbox-zoom-control-text)!important}
.aidc-lb__zoomcontrols :where(.aidc-lb__iconbtn,button,.aidc-btn){--icon-color:var(--aidc-lightbox-zoom-control-text)!important;color:var(--aidc-lightbox-zoom-control-text)!important;-webkit-text-fill-color:var(--aidc-lightbox-zoom-control-text)!important;opacity:1!important}
.aidc-lb__zoom-icon{background-color:var(--aidc-lightbox-zoom-control-text)!important;color:var(--aidc-lightbox-zoom-control-text)!important;opacity:1!important;filter:none!important}
.aidc-lb__zoomcontrols img{filter:none!important;opacity:.9!important}

.aidc-lb__ava{background-color:var(--aidc-btn-secondary-bg)!important;border-color:var(--aidc-border-default)!important;color:var(--aidc-text-primary)!important}
.aidc-lb__aname strong,.aidc-lb__v,.aidc-lb__kvrow,.aidc-lb__row,.aidc-lb__row strong,.aidc-lb__catalog-heading h4,.aidc-lb__section strong,.aidc-lb__section b{color:var(--aidc-lightbox-comment-title)!important;-webkit-text-fill-color:var(--aidc-lightbox-comment-title)!important}
.aidc-lb__aname span,.aidc-lb__placeholder,.aidc-lb__k,.aidc-lb__row span,.aidc-lb__section h4,.aidc-lb__section small{color:var(--aidc-lightbox-comment-muted)!important;-webkit-text-fill-color:var(--aidc-lightbox-comment-muted)!important}
.aidc-lb__catalog-description,.aidc-lb__section p,.aidc-lb__section li,.aidc-lb__section .value,.aidc-lb__comments,.aidc-lb__comment,.aidc-lb__comment-text{color:var(--aidc-lightbox-comment-body)!important;-webkit-text-fill-color:var(--aidc-lightbox-comment-body)!important;opacity:1!important}

.aidc-lb__tabs{border-color:var(--aidc-border-subtle)!important}
.aidc-lb__tab{background:var(--aidc-lightbox-action-bg)!important;border-color:var(--aidc-lightbox-action-border)!important;color:var(--aidc-lightbox-action-text)!important}
.aidc-lb__tab:hover,.aidc-lb__tab:focus-visible{background:var(--aidc-lightbox-action-bg-hover)!important;color:var(--aidc-lightbox-action-text-hover)!important;outline:none!important}
.aidc-lb__tab.is-active,.aidc-lb__tab[aria-selected="true"]{background:var(--aidc-lightbox-action-active-bg)!important;border-color:var(--aidc-lightbox-action-active-border)!important;color:var(--aidc-lightbox-action-active-text)!important;box-shadow:none!important}

.aidc-lb__section{background:var(--aidc-bg-elevated)!important;border-color:var(--aidc-border-default)!important}
.aidc-lb__prompt{background:var(--aidc-dialog-input-bg)!important;border-color:var(--aidc-dialog-input-border)!important;color:var(--aidc-lightbox-comment-body)!important;-webkit-text-fill-color:var(--aidc-lightbox-comment-body)!important;opacity:1!important;scrollbar-color:var(--aidc-scrollbar-thumb) transparent!important}
.aidc-lb__prompt :where(p,span,div,a){color:inherit!important;-webkit-text-fill-color:inherit!important;opacity:1!important}
.aidc-lb__prompt::-webkit-scrollbar-thumb{background:var(--aidc-scrollbar-thumb)!important}
.aidc-lb__prompt-toggle{color:var(--aidc-lightbox-comment-muted)!important}
.aidc-lb__prompt-toggle:hover,.aidc-lb__prompt-toggle:focus-visible{color:var(--aidc-text-primary)!important;outline:none!important}
.aidc-lb__tools .aidc-lb__iconbtn[aria-label]::after,.aidc-lb__canvas-tip::after{background:var(--aidc-bg-popover)!important;border:1px solid var(--aidc-border-default)!important;color:var(--aidc-text-primary)!important;box-shadow:var(--aidc-shadow-popover)!important}

.aidc-lb__ref{background:var(--aidc-workspace-stage-bg)!important;border-color:var(--aidc-border-default)!important}
.aidc-lb__ref:hover,.aidc-lb__ref:focus-visible{border-color:var(--aidc-workspace-selection-border)!important;box-shadow:0 0 0 3px var(--aidc-action-focus-ring)!important;outline:none!important}
.aidc-chip{background:var(--aidc-btn-secondary-bg)!important;border-color:var(--aidc-border-default)!important;color:var(--aidc-text-secondary)!important}
.aidc-chip:hover,.aidc-chip:focus-visible{background:var(--aidc-btn-secondary-bg-hover)!important;border-color:var(--aidc-border-strong)!important;color:var(--aidc-text-primary)!important;box-shadow:none!important;outline:none!important}

.aidc-lb__actions{background:var(--aidc-bg-card)!important;border-color:var(--aidc-border-default)!important;backdrop-filter:none!important}
/* Legacy lightbox.css still contains a late !important dark gradient. Keep the
   semantic adapter authoritative regardless of stylesheet load order. */
.aidc-lb .aidc-lb__actions{background:var(--aidc-bg-card)!important;border-color:var(--aidc-border-default)!important;backdrop-filter:none!important}
.aidc-lb__primary{background:linear-gradient(135deg,var(--aidc-action-primary-from),var(--aidc-action-primary-to))!important;border-color:transparent!important;color:var(--aidc-text-inverse)!important;box-shadow:0 0 18px var(--aidc-action-primary-glow)!important}
.aidc-lb__btn--danger{background:var(--aidc-status-danger-bg)!important;border-color:var(--aidc-action-danger-border)!important;color:var(--aidc-red-500)!important}
.aidc-lb__wabottom{background:var(--aidc-bg-popover)!important;border-color:var(--aidc-border-default)!important;box-shadow:var(--aidc-shadow-popover)!important}

.aidc-lb__panel input,.aidc-lb__panel textarea,.aidc-lb__panel select{background:var(--aidc-dialog-input-bg)!important;border-color:var(--aidc-dialog-input-border)!important;color:var(--aidc-text-primary)!important}
.aidc-lb__panel input::placeholder,.aidc-lb__panel textarea::placeholder{color:var(--aidc-text-muted)!important}
.aidc-lb__panel input:focus,.aidc-lb__panel textarea:focus,.aidc-lb__panel select:focus{border-color:var(--aidc-action-focus)!important;box-shadow:0 0 0 3px var(--aidc-action-focus-ring)!important;outline:none!important}
.aidc-tag{background:var(--aidc-bg-popover)!important;border-color:var(--aidc-border-default)!important;color:var(--aidc-text-secondary)!important}
.aidc-tag--accent{border-color:color-mix(in srgb,var(--aidc-cyan-500) 38%,transparent)!important;color:var(--aidc-cyan-500)!important}

.aidc-lb__overlayCard{background:var(--aidc-bg-panel)!important;border-color:var(--aidc-border-default)!important;color:var(--aidc-text-primary)!important}
.aidc-lb__overlayHead{background:var(--aidc-bg-popover)!important;border-color:var(--aidc-border-default)!important}
.aidc-lb__overlayTitle{color:var(--aidc-text-primary)!important;opacity:1!important}
.aidc-lb__overlayBody{color:var(--aidc-text-primary)!important}
.aidc-lb__sectionTitle{color:var(--aidc-text-primary)!important;opacity:1!important}
.aidc-lb__mono,.aidc-lb__empty,.aidc-lb__hint{color:var(--aidc-lightbox-comment-body)!important;-webkit-text-fill-color:var(--aidc-lightbox-comment-body)!important;opacity:1!important}
.aidc-lb__panel :where(.aidc-lb__comments-title,.aidc-lb__comments-empty,.aidc-lb__comment-empty,.aidc-lb__comment-hint,.aidc-lb__comments h4,.aidc-lb__comments p,.aidc-lb__comments small){color:var(--aidc-lightbox-comment-body)!important;-webkit-text-fill-color:var(--aidc-lightbox-comment-body)!important;opacity:1!important}
.aidc-lb__panel :where(.aidc-lb__comments-title,.aidc-lb__comments h3,.aidc-lb__comments strong){color:var(--aidc-lightbox-comment-title)!important;-webkit-text-fill-color:var(--aidc-lightbox-comment-title)!important;opacity:1!important}

html[data-aidc-color-mode="light"] .aidc-lb__shell{background:color-mix(in srgb,var(--aidc-bg-page) 70%,var(--aidc-bg-elevated) 30%)!important}
html[data-aidc-color-mode="light"] .aidc-lb__panel{background:var(--aidc-bg-panel)!important}
html[data-aidc-color-mode="light"] .aidc-lb__main{background:var(--aidc-lightbox-stage-bg)!important}
html[data-aidc-color-mode="light"] .aidc-lb__section{background:var(--aidc-bg-elevated)!important}
html[data-aidc-color-mode="light"] .aidc-lb__panel :where(.aidc-lb__k,.aidc-lb__row span,.aidc-lb__section h4,.aidc-lb__section small,.aidc-lb__comments-title,.aidc-lb__comments-empty,.aidc-lb__comment-empty,.aidc-lb__comment-hint){color:var(--aidc-lightbox-comment-body)!important;-webkit-text-fill-color:var(--aidc-lightbox-comment-body)!important;opacity:1!important}
html[data-aidc-color-mode="light"] .aidc-lb .aidc-lb__actions{background:var(--aidc-bg-panel)!important;border-color:var(--aidc-border-default)!important;backdrop-filter:none!important}
html[data-aidc-color-mode="light"] .aidc-lb__primary{background:color-mix(in srgb,var(--aidc-action-primary-from) 9%,var(--aidc-bg-card) 91%)!important;border:1px solid color-mix(in srgb,var(--aidc-action-primary-from) 58%,transparent)!important;color:var(--aidc-action-primary-to)!important;box-shadow:none!important;filter:none!important}
html[data-aidc-color-mode="light"] .aidc-lb__btn:not(.aidc-lb__btn--danger),html[data-aidc-color-mode="light"] .aidc-lb__mode-btn,html[data-aidc-color-mode="light"] .aidc-lb__zoomcontrols button{background:var(--aidc-btn-secondary-bg)!important;border-color:var(--aidc-border-strong)!important;color:var(--aidc-text-primary)!important;-webkit-text-fill-color:var(--aidc-text-primary)!important}
html[data-aidc-color-mode="light"] .aidc-lb__wabottom .aidc-btn--glass{background:var(--aidc-btn-secondary-bg)!important;border-color:var(--aidc-border-strong)!important;color:var(--aidc-text-primary)!important;-webkit-text-fill-color:var(--aidc-text-primary)!important;opacity:1!important}
html[data-aidc-color-mode="light"] .aidc-lb__wabottom .aidc-btn--primary{background:linear-gradient(135deg,var(--aidc-action-primary-from),var(--aidc-action-primary-to))!important;border-color:transparent!important;color:var(--aidc-text-inverse)!important;-webkit-text-fill-color:var(--aidc-text-inverse)!important;opacity:1!important}
html[data-aidc-color-mode="light"] .aidc-lb__overlayCard,html[data-aidc-color-mode="light"] .aidc-lb__overlayBody{background:var(--aidc-bg-panel)!important;color:var(--aidc-text-primary)!important}
html[data-aidc-color-mode="light"] .aidc-lb__overlayHead{background:var(--aidc-bg-popover)!important;color:var(--aidc-text-primary)!important}
html[data-aidc-color-mode="light"] .aidc-lb__overlayTitle,html[data-aidc-color-mode="light"] .aidc-lb__sectionTitle{color:var(--aidc-text-primary)!important;-webkit-text-fill-color:var(--aidc-text-primary)!important;opacity:1!important}
html[data-aidc-color-mode="light"] .aidc-lb__overlayBody :where(.aidc-lb__empty,.aidc-lb__hint,.aidc-lb__mono){color:var(--aidc-lightbox-comment-body)!important;-webkit-text-fill-color:var(--aidc-lightbox-comment-body)!important;opacity:1!important}


.aidc-lb__prompt::-webkit-scrollbar-thumb:hover{background:var(--aidc-scrollbar-thumb-hover)!important}
.aidc-lb__btn--danger:hover{background:var(--aidc-status-danger-bg)!important;border-color:var(--aidc-red-500)!important;color:var(--aidc-red-500)!important}

.aidc-lb__thread,.aidc-lb__threadStack,.aidc-lb__popover{
  background:var(--aidc-bg-panel)!important;
  border-color:var(--aidc-border-default)!important;
  color:var(--aidc-text-primary)!important
}
.aidc-lb__threadTxt,.aidc-lb__threadBody,.aidc-lb__threadMsg,
.aidc-lb__msg,.aidc-lb__msgText,.aidc-lb__popoverHead{
  color:var(--aidc-text-primary)!important;
  -webkit-text-fill-color:var(--aidc-text-primary)!important
}
.aidc-lb__threadMeta,.aidc-lb__threadMsg span,.aidc-lb__threadToggle,
.aidc-lb__role,.aidc-lb__msgMeta{
  color:var(--aidc-text-secondary)!important;
  -webkit-text-fill-color:var(--aidc-text-secondary)!important
}
.aidc-lb__popover textarea{
  background:var(--aidc-bg-elevated)!important;
  color:var(--aidc-text-primary)!important;
  border-color:var(--aidc-border-default)!important
}
.aidc-lb__popover textarea::placeholder{color:var(--aidc-text-muted)!important}

.aidc-lb__popoverClose,.aidc-lb__popoverDelete,.aidc-lb__msgDelete,.aidc-lb__send{
  color:var(--aidc-text-primary)!important;--icon-color:var(--aidc-text-primary);
  background:var(--aidc-bg-elevated)!important;border-color:var(--aidc-border-default)!important
}

.aidc-lb__project-link{color:var(--aidc-action-primary-to);text-decoration:underline;text-underline-offset:3px;overflow-wrap:anywhere}
.aidc-lb__project-link:focus-visible{outline:2px solid var(--aidc-action-focus);outline-offset:3px;border-radius:2px}

/* Shared WebApp contract for /text/ and /tg/text.html. Width, not device UA,
   selects compact controls; route shells own navigation and viewport insets. */
@media (max-width: 880px) {
  body.page-text .chat-mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 0 0 auto;
    min-width: 44px;
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid var(--aidc-border-default);
    border-radius: 10px;
    background: var(--aidc-bg-panel);
    color: var(--aidc-text-primary);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
  }
  body.page-text .chat-mobile-menu-btn svg { width: 20px; height: 20px; flex: 0 0 auto; }
  /* WebApp off-canvas contract, independent of legacy nested mobile rules. */
  body.page-text .chat-sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    bottom: 0;
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    box-sizing: border-box;
    z-index: 2200;
    transition: left .22s ease;
  }
  body.page-text .chat-sidebar.chat-sidebar--open { left: 0; }
  body.page-text .chat-main { width: 100%; min-width: 0; }
  body.page-text .chat-header {
    flex-wrap: wrap;
    gap: 6px 8px;
    padding: 8px 10px;
    flex: 0 0 auto;
  }
  body.page-text .chat-header__title {
    flex: 1 1 0;
    min-width: 0;
    font-size: 14px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  body.page-text .chat-header__right {
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 6px;
  }
  body.page-text .chat-input-wrap { flex-wrap: wrap; gap: 6px; }
  body.page-text .chat-input-wrap > .chat-input {
    order: -2;
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 44px;
    max-height: 120px;
    font-size: 16px;
    box-sizing: border-box;
  }
  body.page-text .chat-input-area { flex: 0 0 auto; }
  body.page-text .chat-messages { overflow-x: hidden; min-width: 0; }
  body.page-text .chat-message { min-width: 0; box-sizing: border-box; }
}


/* Text/Chat page shell geometry.
   Route shell visuals: text-page-shell-theme.css.
   Chat visuals: chat-theme.css + chat-model-picker-theme.css + chat-workspace-theme.css. */

html,
body.page-text{
  height:100%;
  margin:0;
  padding:0;
  overflow:hidden
}

body.page-text{
  display:flex;
  flex-direction:column
}

body.page-text #app{
  flex:1;
  display:flex;
  flex-direction:column;
  min-height:0;
  overflow:hidden
}

body.page-text .shell{
  flex:1;
  display:flex;
  flex-direction:column;
  min-height:0;
  overflow:hidden;
  padding-bottom:0!important
}

body.page-text #chatRoot{
  flex:1;
  min-height:0;
  overflow:hidden
}

/* Like tg/text-page.css: the chat owns viewport height and internal scrolling.
   Override aidc-scroll's document-scroll rule for ordinary narrow web pages. */
@media (max-width: 1200px) {
  html:has(body.page-text) { height: 100%; overflow: hidden !important; }
  body.page-text { height: 100dvh !important; min-height: 0 !important; display: flex !important; overflow: hidden !important; }
  body.page-text #app,
  body.page-text #app > .shell { height: 100% !important; min-height: 0 !important; overflow: hidden !important; }
  body.page-text #chatRoot { min-width: 0; }
  body.page-text .chat-main { min-height: 0; }
}

body.page-text .site-footer,
body.page-text footer,
body.page-text .footer,
body.page-text #app > [data-include*="footer"],
body.page-text #app > footer{
  display:none!important
}

/* Canonical Text module can be embedded by first-party product surfaces.
   Only the outer site chrome is removed; the chat DOM, controls, styling and
   runtime remain exactly the same as /text/. */
html[data-aidc-chat-embedded="true"],
html[data-aidc-chat-embedded="true"] body.page-text{
  width:100%;
  height:100%;
  min-height:0;
  overflow:hidden!important;
  background:var(--aidc-bg-page, var(--bg));
}

html[data-aidc-chat-embedded="true"] body.page-text #app,
html[data-aidc-chat-embedded="true"] body.page-text .shell,
html[data-aidc-chat-embedded="true"] body.page-text #chatRoot{
  width:100%;
  height:100%;
  min-height:0;
}

html[data-aidc-chat-embedded="true"] body.page-text .shell > [data-include*="/components/header.html"],
html[data-aidc-chat-embedded="true"] body.page-text .site-header{
  display:none!important;
}

html[data-aidc-chat-embedded="true"] body.page-text #chatRoot{
  flex:1 1 100%;
}

/* Embedded Text uses an overlay history/projects drawer instead of permanently
   consuming chat width. The same canonical sidebar remains intact; only its
   presentation changes for first-party embedded agent surfaces. */
html[data-aidc-chat-embedded="true"] body.page-text .chat-container{
  position:relative!important;
}

html[data-aidc-chat-embedded="true"] body.page-text .chat-main{
  width:100%!important;
  min-width:0!important;
}

html[data-aidc-chat-embedded="true"] body.page-text .chat-sidebar{
  position:fixed!important;
  top:0!important;
  right:auto!important;
  bottom:0!important;
  left:0!important;
  width:min(340px,86vw)!important;
  min-width:0!important;
  max-width:min(340px,86vw)!important;
  height:100dvh!important;
  max-height:100dvh!important;
  z-index:2200!important;
  transform:translate3d(-102%,0,0)!important;
  transition:transform .18s ease!important;
  border-right:1px solid var(--aidc-border-default)!important;
  box-shadow:none!important;
}

html[data-aidc-chat-embedded="true"] body.page-text .chat-sidebar.chat-sidebar--open{
  transform:translate3d(0,0,0)!important;
}

html[data-aidc-chat-embedded="true"] body.page-text .chat-sidebar__resizer{
  display:none!important;
}

html[data-aidc-chat-embedded="true"] body.page-text .chat-sidebar__close-btn{
  display:inline-flex!important;
}

html[data-aidc-chat-embedded="true"] body.page-text .chat-mobile-menu-btn{
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  gap:6px!important;
  flex:0 0 auto!important;
  min-width:0!important;
  min-height:34px!important;
  padding:0 10px!important;
  border:1px solid var(--aidc-border-default)!important;
  border-radius:var(--aidc-radius-control,10px)!important;
  background:var(--aidc-btn-secondary-bg)!important;
  color:var(--aidc-text-secondary)!important;
  font:inherit!important;
  font-size:12px!important;
  font-weight:650!important;
  line-height:1!important;
  cursor:pointer!important;
}
html[data-aidc-chat-embedded="true"] body.page-text .chat-mobile-menu-btn:hover,
html[data-aidc-chat-embedded="true"] body.page-text .chat-mobile-menu-btn:focus-visible{
  background:var(--aidc-btn-secondary-bg-hover)!important;
  color:var(--aidc-text-primary)!important;
}
html[data-aidc-chat-embedded="true"] body.page-text .chat-mobile-menu-btn svg{
  width:16px!important;
  height:16px!important;
  flex:0 0 auto!important;
}

html[data-aidc-chat-embedded="true"] body.page-text .chat-sidebar-backdrop{
  position:fixed!important;
  inset:0!important;
  z-index:2100!important;
  background:color-mix(in srgb,var(--aidc-backdrop) 62%,transparent)!important;
  display:none!important;
}

html[data-aidc-chat-embedded="true"] body.page-text .chat-sidebar-backdrop.open{
  display:block!important;
}

/* Accessibility announcements must never become visible layout content. */
body.page-text .chat-sr-only{
  position:absolute!important;
  width:1px!important;
  height:1px!important;
  padding:0!important;
  margin:-1px!important;
  overflow:hidden!important;
  clip:rect(0,0,0,0)!important;
  white-space:nowrap!important;
  border:0!important;
}

/* The outer Autoposting page already owns platform help/knowledge launchers.
   Do not render duplicate global floaters inside the embedded Text iframe. */
html[data-aidc-chat-embedded="true"] body.page-text .aidc-support,
html[data-aidc-chat-embedded="true"] body.page-text .aidc-ks-fab{
  display:none!important;
}

