/* Complete UI theme suite for My Virtual Office. */

/* Palettes, fonts, corners and shadows for every preset (classic included) live in
   ui-tokens.css. This file only adds component coverage for legacy markup that still
   carries fixed colors. */

html[data-ui-preset] :where(
  .agent-panel,
  .furniture-catalog,
  .browser-panel,
  .sms-panel,
  .chat-panel,
  .chat-panel-secondary,
  .agent-workspace-panel,
  .projects-modal-content
) {
  color: var(--theme-text-1) !important;
  border-color: var(--theme-border-strong) !important;
  border-radius: var(--theme-radius-lg) !important;
  background: var(--theme-bg-1) !important;
  box-shadow: var(--theme-shadow) !important;
  font-family: var(--vo-font-ui) !important;
}

html[data-ui-preset] :where(
  .agent-panel-header,
  .catalog-header,
  .browser-header,
  .sms-header,
  .chat-header,
  .agent-workspace-header,
  .proj-toolbar,
  .agent-edit-bar
) {
  color: var(--theme-text-1) !important;
  border-color: var(--theme-border-soft) !important;
  background: var(--theme-bg-2) !important;
}

html[data-ui-preset] :where(
  .browser-title,
  .sms-header-title,
  .chat-agent-select,
  .theme-current-name
) {
  color: var(--theme-accent) !important;
  font-family: var(--vo-font-pixel) !important;
}

html[data-ui-preset] :where(
  .agent-panel-body,
  .ui-agent-filters,
  #acp-editor,
  .catalog-body,
  .sms-sidebar,
  .chat-sessions-panel,
  .agent-workspace-tabs
) {
  color: var(--theme-text-1) !important;
  border-color: var(--theme-border-soft) !important;
  background: var(--theme-bg-0) !important;
}

html[data-ui-preset] :where(
  .mm-hermes-connection,
  .agent-edit-section,
  .agent-preview-wrap,
  .ui-agent-advanced,
  .catalog-section,
  .sms-thread-item,
  .chat-session-item,
  .project-card,
  .meeting-card,
  .workspace-card
) {
  color: var(--theme-text-1) !important;
  border-color: var(--theme-border-soft) !important;
  border-radius: var(--theme-radius-md) !important;
  background: var(--theme-bg-2) !important;
}

html[data-ui-preset] :where(
  .catalog-tabs button.active,
  .agent-editor-tabs button.active,
  .agent-card.selected,
  .option-btn.selected,
  .sms-thread-item.active,
  .chat-session-item.active
) {
  color: var(--theme-accent) !important;
  border-color: var(--theme-accent) !important;
  background: color-mix(in srgb, var(--theme-bg-2) 76%, var(--theme-accent) 24%) !important;
}

html[data-ui-preset] :where(
  .theme-studio-copy,
  .agent-card-role,
  .agent-preview-role,
  .agent-preview-branch,
  .sms-thread-preview,
  .sms-thread-time,
  .sms-thread-subtitle,
  .chat-context-info,
  .muted
) {
  color: var(--theme-text-3) !important;
}

html[data-ui-preset] :where(
  .sms-layout,
  .sms-conversation,
  .sms-messages,
  .chat-body,
  .chat-messages,
  .agent-workspace-body,
  .browser-frame-container
) {
  color: var(--theme-text-1) !important;
  background: var(--theme-bg-1) !important;
  border-color: var(--theme-border-soft) !important;
}

html[data-ui-preset] :where(
  .sms-owner-strip,
  .sms-thread-header,
  .sms-input-row,
  .chat-model-bar,
  .chat-input-row,
  .browser-url-bar,
  .agent-workspace-tabs
) {
  color: var(--theme-text-2) !important;
  border-color: var(--theme-border-soft) !important;
  background: var(--theme-bg-2) !important;
}

html[data-ui-preset] :where(
  .sms-send-btn,
  .chat-send-btn
) {
  color: var(--vo-accent-fill-ink) !important;
  border-color: var(--theme-accent) !important;
  background: var(--vo-accent-fill) !important;
  box-shadow: var(--theme-shadow-hard) !important;
}

html[data-ui-preset] :where(
  .chat-message.user,
  .sms-message.outgoing
) {
  color: var(--vo-accent-fill-ink) !important;
  background: var(--vo-accent-fill) !important;
}

html[data-ui-preset] :where(
  .chat-message.assistant,
  .sms-message.incoming
) {
  color: var(--theme-text-1) !important;
  border-color: var(--theme-border-soft) !important;
  background: var(--theme-bg-3) !important;
}

html[data-ui-preset="cyberpunk"] :where(
  .header h1,
  .models-header h1
) {
  text-shadow: 0 0 12px color-mix(in srgb, var(--theme-accent) 65%, transparent);
  letter-spacing: .08em;
}

html[data-ui-preset="cyberpunk"] :where(
  .agent-panel,
  .chat-panel,
  .sms-panel,
  .browser-panel
) {
  clip-path: polygon(0 10px, 10px 0, calc(100% - 28px) 0, 100% 28px, 100% 100%, 0 100%);
}

html[data-ui-font-style="pixel"] :where(
  body,
  button,
  input,
  select,
  textarea
) {
  line-height: 1.65;
}

html[data-ui-font-style="pixel"] :where(
  button,
  input,
  select,
  textarea
) {
  font-size: var(--vo-text-xs) !important;
}

/* Press Start 2P is substantially wider than the modern UI font. Keep the
   pixel controls compact, and let long dock labels use two lines instead of
   painting outside their buttons. */

/* Fixed-width appearance labels need the same compact pixel scale. */
html[data-ui-font-style="pixel"] .agent-field-label {
  font-size: var(--vo-text-xs) !important;
}

/* A closed fixed drawer sitting beyond the right edge made the Projects
   overlay horizontally scrollable in pixel themes. It is restored by .open. */
html[data-ui-font-style="pixel"] #projectsModal .proj-detail-panel:not(.open) {
  display: none !important;
}

/* Label typography and icon typography have different jobs. The compact
   pixel font keeps words contained, while symbol-only controls retain a
   readable touch-target icon size. ui-themes.js marks static and dynamic
   symbol-only buttons with .ui-icon-only. */
html[data-ui-font-style="pixel"] button.ui-icon-only {
  font-family: var(--vo-font-ui) !important;
  font-size: var(--vo-text-md) !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
}

html[data-ui-font-style="pixel"] button.ui-icon-only.chat-toggle-btn {
  font-size: var(--vo-text-lg) !important;
}

html[data-ui-font-style="pixel"] :where(
  .theme-studio-copy,
  .theme-card-copy small
) {
  font-size: var(--vo-text-xs) !important;
  line-height: 1.75 !important;
}

html[data-ui-font-style="pixel"] :where(
  .theme-mode-label,
  .theme-subheading,
  .theme-card-copy strong
) {
  font-size: var(--vo-text-xs) !important;
  line-height: 1.55 !important;
}

html[data-ui-font-style="pixel"] :where(
  .agent-panel,
  .chat-panel,
  .sms-panel,
  .browser-panel
) {
  border-width: 2px !important;
}

/* Standalone page harmonization */
html[data-ui-preset] body.ui-standalone {
  color: var(--theme-text-1) !important;
  background:
    radial-gradient(circle at 18% -10%, color-mix(in srgb, var(--theme-accent-2) 11%, transparent), transparent 34rem),
    var(--theme-bg-0) !important;
  font-family: var(--vo-font-ui) !important;
}

html[data-ui-preset] .ui-standalone :where(
  .header,
  .models-header,
  .toolbar,
  .job-card,
  .card,
  .mvw-confirm-dialog,
  .model-list,
  .tab
) {
  color: var(--theme-text-1) !important;
  border-color: var(--theme-border-soft) !important;
  border-radius: var(--theme-radius-md) !important;
  background: var(--theme-bg-1) !important;
}

html[data-ui-preset] .ui-standalone :where(
  .header,
  .models-header
) {
  border-bottom-color: var(--theme-accent) !important;
  border-radius: 0 !important;
  box-shadow: var(--theme-shadow-hard) !important;
}

html[data-ui-preset] .ui-standalone :where(
  .header h1,
  .models-header h1,
  h1,
  h2,
  .job-name
) {
  color: var(--theme-accent) !important;
  font-family: var(--vo-font-pixel) !important;
}

/* Sub-headings and inline code sit inside sentences: never the pixel font (DS-13). */
html[data-ui-preset] .ui-standalone :where(h3, h4) {
  color: var(--theme-accent) !important;
  font-family: var(--vo-font-ui) !important;
}

html[data-ui-preset] .ui-standalone :where(code, kbd, samp) {
  color: var(--theme-accent) !important;
  font-family: var(--vo-font-mono) !important;
  font-size: .92em;
}

html[data-ui-preset] .ui-standalone :where(
  .tab.active,
  .job-card:hover
) {
  color: var(--theme-accent) !important;
  border-color: var(--theme-accent) !important;
  background: color-mix(in srgb, var(--theme-bg-2) 78%, var(--theme-accent) 22%) !important;
}

/* -------------------------------------------------------------------------
   Complete component coverage
   Older Virtual Office features predate the token system and still contain
   fixed colors. These rules make every application surface inherit the active
   preset while leaving the pixel-art office canvas and branch identity colors
   alone on purpose.
   ------------------------------------------------------------------------- */

html[data-ui-preset] :where(
  a:not([class*="vo-"]):not(.mm-btn),
  .proj-breadcrumb-link,
  .sms-media-link
) {
  color: var(--theme-accent) !important;
}

/* Dashboard widgets and sidebar content. */

html[data-ui-preset] :where(
  .proj-progress-mini,
  .proj-checklist-mini-bar
) {
  border-color: var(--theme-border-soft) !important;
  background: var(--theme-bg-3) !important;
}

/* Every modal, editor, menu, popover and toast. */
html[data-ui-preset] :where(
  .proj-form-modal,
  .image-lightbox
) {
  background-color: color-mix(in srgb, var(--theme-bg-0) 78%, transparent) !important;
}

html[data-ui-preset] :where(
  .agent-workspace-menu,
  .skill-workshop-panel,
  .skill-workshop-row,
  .skill-row,
  .skl-card,
  .agent-workspace-card,
  .agent-workspace-item,
  .agent-workspace-settings-section,
  .agent-workspace-note-editor,
  .agent-workspace-notes-folders,
  .agent-workspace-file-list-pane,
  .agent-workspace-skill-browser,
  .agent-workspace-skill-section,
  .agent-workspace-skill-editor,
  .agent-workspace-file-row,
  .agent-workspace-folder,
  .agent-workspace-activity-item,
  #branch-edit-popup,
  #text-label-editor,
  #iw-editor,
  #edit-color-picker,
  #branch-assign-menu,
  #desk-assign-menu
) {
  color: var(--theme-text-1) !important;
  border-color: var(--theme-border-soft) !important;
  border-radius: var(--theme-radius-md) !important;
  background: var(--theme-bg-2) !important;
  box-shadow: var(--theme-shadow-hard) !important;
  font-family: var(--vo-font-ui) !important;
}

html[data-ui-preset] :where(
  #branch-edit-popup input,
  #branch-edit-popup #be-agents,
  #text-label-editor input,
  #text-label-editor #tl-preview,
  #iw-editor label,
  #iw-editor #iw-preview,
  #edit-color-picker input:not([type="color"]),
  .skl-input,
  .skl-textarea,
  .skill-workshop-review-textarea
) {
  color: var(--theme-text-1) !important;
  border-color: var(--theme-border-soft) !important;
  border-radius: var(--theme-radius-sm) !important;
  background: var(--theme-bg-1) !important;
}

html[data-ui-preset] :where(
  #branch-edit-popup label,
  #branch-edit-popup #be-color-hex,
  #text-label-editor label,
  #text-label-editor #tl-color-hex,
  #text-label-editor #tl-size-val,
  #iw-editor label div div:last-child,
  .skill-workshop-meta,
  .skill-workshop-empty,
  .skill-workshop-review-head span,
  .skl-field-label,
  .agent-workspace-meta,
  .agent-workspace-empty
) {
  color: var(--theme-text-3) !important;
}

html[data-ui-preset] :where(
  #be-save,
  #tl-save,
  #iw-save,
  .agent-create-actions button[type="submit"],
  .skl-apply-dropdown button
) {
  color: var(--vo-accent-fill-ink) !important;
  border-color: var(--theme-accent) !important;
  background: var(--vo-accent-fill) !important;
}

html[data-ui-preset] :where(
  #be-cancel,
  #tl-cancel,
  #iw-cancel,
  #branch-assign-menu button,
  #desk-assign-menu button,
  #edit-cp-save-favorite,
  #edit-color-picker button:not(.cp-favorite-btn),
  .skill-row-btns button,
  .skill-workshop-actions button,
  .skl-card-actions button
) {
  color: var(--theme-text-2) !important;
  border-color: var(--theme-border-strong) !important;
  border-radius: var(--theme-radius-sm) !important;
  background: var(--theme-bg-3) !important;
}

/* Agent modal, Skills Library, Meetings and Workspace internals. */
html[data-ui-preset] :where(
  .modal-section,
  .mtg-section,
  .skl-card,
  .skill-row,
  .agent-workspace-settings-section,
  .agent-workspace-panel-heading,
  .agent-workspace-file-tools,
  .agent-workspace-editor-header,
  .agent-workspace-settings-footer
) {
  color: var(--theme-text-1) !important;
  border-color: var(--theme-border-soft) !important;
  border-radius: var(--theme-radius-md) !important;
  background: var(--theme-bg-2) !important;
}

html[data-ui-preset] :where(
  .modal-role,
  .bio-content,
  .mtg-meta-item,
  .mtg-section-text,
  .skl-card-desc,
  .agent-create-platform-note,
  .agent-create-codex-note
) {
  color: var(--theme-text-3) !important;
}

/* Chat: messages, session rail, tool cards, thinking, approvals and media. */
html[data-ui-preset] :where(
  .chat-exterior-tabs,
  .chat-sessions-head,
  .chat-tool-call,
  .chat-thinking-card,
  .chat-approval-card,
  .chat-attach-item,
  .chat-media-item,
  .chat-media-file,
  .chat-slot-tab,
  .chat-session-item
) {
  color: var(--theme-text-1) !important;
  border-color: var(--theme-border-soft) !important;
  border-radius: var(--theme-radius-sm) !important;
  background: var(--theme-bg-2) !important;
}

/* The exterior tab rail is only a positioning wrapper. Leaving a themed
   surface behind its buttons visually squares off their lower corners. */
html[data-ui-preset] .chat-exterior-tabs {
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
}

/* ui-modern originally made these tabs top-rounded only. Keep each theme's
   own corner size, but apply it consistently to all four corners. */
.chat-slot-tab {
  border-radius: var(--ui-radius-sm) !important;
}

html[data-ui-preset] :where(
  .chat-session-item.selected,
  .chat-slot-tab.state-open,
  .chat-slot-tab.state-active,
  .chat-slot-tab.active
) {
  color: var(--theme-accent) !important;
  border-color: var(--theme-accent) !important;
  background: color-mix(in srgb, var(--theme-bg-2) 74%, var(--theme-accent) 26%) !important;
}

html[data-ui-preset] .chat-msg.user .chat-bubble {
  color: var(--vo-accent-fill-ink) !important;
  border-color: var(--theme-accent) !important;
  background: var(--vo-accent-fill) !important;
}

html[data-ui-preset] .chat-msg.assistant .chat-bubble {
  color: var(--theme-text-1) !important;
  border-color: var(--theme-border-soft) !important;
  background: var(--theme-bg-3) !important;
}

html[data-ui-preset] .chat-msg.system .chat-bubble {
  color: var(--theme-accent-2) !important;
  border: 1px solid color-mix(in srgb, var(--theme-accent-2) 55%, var(--theme-border-soft)) !important;
  background: color-mix(in srgb, var(--theme-bg-2) 82%, var(--theme-accent-2) 18%) !important;
}

html[data-ui-preset] :where(
  .chat-session-item .cs-title,
  .chat-tool-name,
  .chat-thinking-title,
  .chat-approval-title,
  .chat-msg.assistant .chat-sender-label
) {
  color: var(--theme-text-2) !important;
}

html[data-ui-preset] :where(
  .chat-session-item .cs-preview,
  .chat-session-item .cs-meta,
  .chat-tool-preview,
  .chat-tool-state,
  .chat-time,
  .chat-thinking-summary,
  .chat-approval-desc,
  .chat-media-file
) {
  color: var(--theme-text-3) !important;
}

html[data-ui-preset] :where(
  .chat-tool-call.running,
  .chat-tool-call.done,
  .chat-session-item .cs-live-badge,
  .chat-status.connected
) {
  border-color: var(--theme-success) !important;
  color: var(--theme-success) !important;
}

html[data-ui-preset] :where(
  .chat-tool-call.error,
  .chat-approval-card.denied,
  .chat-status.disconnected,
  .chat-close,
  .chat-secondary-close,
  .chat-session-delete:hover
) {
  border-color: var(--theme-danger) !important;
  color: var(--theme-danger) !important;
}

/* SMS: header, threads, message bubbles, ownership controls and media. */
html[data-ui-preset] :where(
  .sms-thread-picker,
  .sms-thread-item,
  .sms-media-item,
  .sms-media-file,
  .sms-empty-state
) {
  color: var(--theme-text-1) !important;
  border-color: var(--theme-border-soft) !important;
  border-radius: var(--theme-radius-sm) !important;
  background: var(--theme-bg-2) !important;
}

html[data-ui-preset] :where(
  .sms-thread-name,
  .sms-thread-title,
  .sms-mode-label,
  .sms-recipient,
  .sms-phone-manual
) {
  color: var(--theme-text-1) !important;
}

html[data-ui-preset] :where(
  .sms-thread-phone,
  .sms-thread-preview,
  .sms-thread-time,
  .sms-thread-subtitle,
  .sms-empty-state,
  .sms-msg-meta,
  .sms-media-item figcaption
) {
  color: var(--theme-text-3) !important;
}

html[data-ui-preset] .sms-msg.outbound {
  color: var(--vo-accent-fill-ink) !important;
  background: var(--vo-accent-fill) !important;
}

html[data-ui-preset] .sms-msg.inbound {
  color: var(--theme-text-1) !important;
  border: 1px solid var(--theme-border-soft) !important;
  background: var(--theme-bg-3) !important;
}

html[data-ui-preset] .sms-msg.intervention {
  color: var(--theme-bg-0) !important;
  background: var(--theme-success) !important;
}

html[data-ui-preset] .sms-msg.blocked {
  color: var(--theme-danger) !important;
  border: 1px solid var(--theme-danger) !important;
  background: color-mix(in srgb, var(--theme-bg-2) 82%, var(--theme-danger) 18%) !important;
}

html[data-ui-preset] :where(
  .sms-thread-item.active,
  .sms-open-thread,
  .sms-owner-badge
) {
  color: var(--theme-accent) !important;
  border-color: var(--theme-accent) !important;
  background: color-mix(in srgb, var(--theme-bg-2) 78%, var(--theme-accent) 22%) !important;
}

html[data-ui-preset] :where(
  .sms-slider,
  .sms-switch input:checked + .sms-slider
) {
  background: var(--vo-accent-fill) !important;
}

/* Browser chrome; the remote browser iframe itself is intentionally untouched. */
html[data-ui-preset] :where(
  .browser-controls,
  .browser-snap-group,
  .browser-current-url
) {
  color: var(--theme-text-2) !important;
  border-color: var(--theme-border-soft) !important;
}

html[data-ui-preset] :where(
  .browser-status.ai-active,
  .browser-status.ai-control,
  .browser-maximize.is-maximized
) {
  color: var(--theme-success) !important;
}

html[data-ui-preset] .browser-status.user-control {
  color: var(--theme-accent-2) !important;
}

/* Projects: list, templates, board, task detail, forms, reports and workflow. */
html[data-ui-preset] :where(
  .projects-modal-content,
  .proj-list-body,
  .proj-board-body,
  .proj-report-body,
  .proj-detail-body,
  .proj-comments-list,
  .proj-chat-messages
) {
  color: var(--theme-text-1) !important;
  background: var(--theme-bg-1) !important;
}

html[data-ui-preset] :where(
  .proj-toolbar,
  .proj-breadcrumb,
  .proj-board-header,
  .proj-report-header,
  .proj-detail-header
) {
  color: var(--theme-text-1) !important;
  border-color: var(--theme-border-soft) !important;
  background: var(--theme-bg-2) !important;
}

html[data-ui-preset] :where(
  .proj-card,
  .proj-tpl-card,
  .proj-col,
  .proj-task-card,
  .proj-stat-card,
  .proj-chart-section,
  .proj-workflow-controls,
  .proj-chat-col,
  .proj-activity-item,
  .proj-checklist-item,
  .proj-review-item,
  .proj-comment,
  .proj-form-box,
  .proj-detail-panel,
  .proj-quick-add,
  .proj-tag-input-wrap,
  .proj-scoreboard-item
) {
  color: var(--theme-text-1) !important;
  border-color: var(--theme-border-soft) !important;
  border-radius: var(--theme-radius-md) !important;
  background: var(--theme-bg-2) !important;
  box-shadow: none !important;
}

html[data-ui-preset] :where(
  .proj-card:hover,
  .proj-tpl-card:hover,
  .proj-task-card:hover,
  .proj-col.drag-over
) {
  border-color: var(--theme-accent) !important;
  box-shadow: var(--theme-shadow-hard) !important;
}

html[data-ui-preset] :where(
  .proj-card-title,
  .proj-tpl-title,
  .proj-board-project-title,
  .proj-col-title,
  .proj-task-title,
  .proj-detail-title-input,
  .proj-form-title,
  .proj-report-title,
  .proj-stat-value,
  .proj-comment-author,
  .proj-tl-title,
  .proj-activity-item b
) {
  color: var(--theme-text-1) !important;
}

html[data-ui-preset] :where(
  .proj-card-desc,
  .proj-card-meta,
  .proj-tpl-desc,
  .proj-board-desc,
  .proj-task-meta,
  .proj-task-due,
  .proj-field-label,
  .proj-form-label,
  .proj-stat-label,
  .proj-comment-time,
  .proj-tl-meta,
  .proj-activity-time,
  .proj-report-subtitle,
  .proj-empty-text,
  .proj-chat-msg-time,
  .proj-chat-empty
) {
  color: var(--theme-text-3) !important;
}

html[data-ui-preset] :where(
  .proj-tag,
  .proj-tpl-col-chip,
  .proj-task-assignee,
  .proj-badge,
  .proj-desc-tab.active,
  .proj-review-select.active
) {
  color: var(--theme-accent) !important;
  border-color: color-mix(in srgb, var(--theme-accent) 68%, var(--theme-border-soft)) !important;
  background: color-mix(in srgb, var(--theme-bg-2) 82%, var(--theme-accent) 18%) !important;
}

html[data-ui-preset] :where(
  .proj-progress-bar,
  .proj-checklist-mini-fill,
  .proj-checklist-progress-fill,
  .proj-bar-fill,
  .proj-toggle-switch input:checked + .proj-toggle-slider
) {
  background: var(--vo-accent-fill) !important;
}

html[data-ui-preset] :where(
  .proj-progress-track,
  .proj-checklist-progress-track,
  .proj-bar-track,
  .proj-toggle-slider
) {
  border-color: var(--theme-border-soft) !important;
  background: var(--theme-bg-3) !important;
}

html[data-ui-preset] :where(
  .proj-btn-primary,
  .proj-btn-gold,
  .proj-btn-start
) {
  color: var(--vo-accent-fill-ink) !important;
  border-color: var(--theme-accent) !important;
  background: var(--vo-accent-fill) !important;
}

html[data-ui-preset] :where(
  .proj-btn-danger,
  .proj-btn-stop,
  .proj-checklist-delete,
  .proj-detail-close
) {
  color: var(--theme-danger) !important;
  border-color: var(--theme-danger) !important;
  background: color-mix(in srgb, var(--theme-bg-2) 84%, var(--theme-danger) 16%) !important;
}

html[data-ui-preset] :where(
  .badge-active,
  .badge-completed,
  .proj-wf-status.wf-active,
  .proj-auto-toggle.active
) {
  color: var(--theme-success) !important;
  border-color: var(--theme-success) !important;
  background: color-mix(in srgb, var(--theme-bg-2) 84%, var(--theme-success) 16%) !important;
}

html[data-ui-preset] :where(
  .badge-critical,
  .badge-high,
  .overdue,
  .proj-wf-status.wf-error
) {
  color: var(--theme-danger) !important;
  border-color: var(--theme-danger) !important;
  background: color-mix(in srgb, var(--theme-bg-2) 84%, var(--theme-danger) 16%) !important;
}

html[data-ui-preset] :where(
  .proj-score-popup,
  .proj-toast-xp .xp-label
) {
  color: var(--theme-accent) !important;
  text-shadow: 0 0 12px color-mix(in srgb, var(--theme-accent) 50%, transparent) !important;
}

html[data-ui-preset] .proj-toast {
  color: var(--theme-text-1) !important;
  border-color: var(--theme-border-strong) !important;
  border-radius: var(--theme-radius-sm) !important;
  background: var(--theme-bg-2) !important;
  box-shadow: var(--theme-shadow-hard) !important;
}

/* Standalone Cron/Models details and feedback states. */
html[data-ui-preset] .ui-standalone :where(
  .job-agent,
  .job-status .badge,
  .tag,
  .status-msg,
  .model-item,
  .auth-help,
  .form-hint,
  .provider-current
) {
  border-color: var(--theme-border-soft) !important;
  color: var(--theme-text-3) !important;
  background: var(--theme-bg-2) !important;
}

html[data-ui-preset] .ui-standalone :where(
  .badge.ok,
  .ok,
  .toast.success,
  .btn-green,
  .job-actions button.run
) {
  color: var(--theme-success) !important;
  border-color: var(--theme-success) !important;
  background: color-mix(in srgb, var(--theme-bg-2) 82%, var(--theme-success) 18%) !important;
}

html[data-ui-preset] .ui-standalone :where(
  .badge.error,
  .err,
  .toast.error,
  .btn-red,
  .job-actions button.delete
) {
  color: var(--theme-danger) !important;
  border-color: var(--theme-danger) !important;
  background: color-mix(in srgb, var(--theme-bg-2) 82%, var(--theme-danger) 18%) !important;
}

html[data-ui-preset] .ui-standalone :where(
  .btn-blue,
  .job-agent
) {
  color: var(--theme-info) !important;
  border-color: var(--theme-info) !important;
  background: color-mix(in srgb, var(--theme-bg-2) 84%, var(--theme-info) 16%) !important;
}

html[data-ui-preset] .ui-standalone :where(
  .btn-purple,
  .badge.pending,
  .job-actions button.toggle
) {
  color: var(--theme-accent-2) !important;
  border-color: var(--theme-accent-2) !important;
  background: color-mix(in srgb, var(--theme-bg-2) 84%, var(--theme-accent-2) 16%) !important;
}

/* Theme Studio */
.ui-theme-suite {
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
}

.theme-studio-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  padding: 20px;
  overflow: hidden;
  border: 1px solid var(--ui-border-soft);
  border-radius: var(--ui-radius-md);
  background:
    radial-gradient(circle at 92% 0%, color-mix(in srgb, var(--ui-accent) 18%, transparent), transparent 16rem),
    var(--ui-bg-2);
}

.theme-studio-hero .mm-section-title {
  margin-bottom: 7px;
}

.theme-studio-copy {
  max-width: 650px;
  margin: 0;
  color: var(--ui-text-3);
  font-size: var(--vo-text-sm);
  line-height: 1.55;
}

.theme-current-pill {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 124px;
  padding: 10px 12px;
  border: 1px solid var(--ui-border-soft);
  border-radius: var(--ui-radius-sm);
  background: var(--ui-bg-1);
}

.theme-current-pill span {
  color: var(--ui-text-3);
  font-size: var(--vo-text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.theme-current-pill strong {
  color: var(--ui-accent);
  font-size: var(--vo-text-xs);
}

.theme-mode-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  padding: 10px 12px;
  border: 1px solid var(--ui-border-soft);
  border-radius: var(--ui-radius-sm);
  background: var(--ui-bg-1);
}

.theme-mode-label,
.theme-subheading {
  color: var(--ui-text-1);
  font-size: var(--vo-text-md);
  font-weight: 800;
}

.theme-segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--ui-border-soft);
  border-radius: var(--ui-radius-sm);
  background: var(--ui-bg-0);
}

.theme-segmented button {
  min-height: 34px;
  border-color: transparent !important;
  background: transparent !important;
}

.theme-segmented button.active {
  color: var(--vo-accent-fill-ink) !important;
  border-color: var(--ui-accent) !important;
  background: var(--vo-accent-fill) !important;
}

.theme-preset-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 10px 0 22px;
}

.theme-preset-card {
  position: relative;
  min-height: 132px;
  display: grid;
  grid-template-columns: 94px minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  padding: 12px;
  text-align: left;
  border: 1px solid var(--ui-border-soft);
  border-radius: var(--ui-radius-md);
  background: var(--ui-bg-2);
}

.theme-preset-card:hover {
  transform: translateY(-1px);
}

.theme-preset-card.active {
  border-color: var(--ui-accent) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ui-accent) 14%, transparent) !important;
}

.theme-card-preview {
  height: 86px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 10px;
  box-shadow: inset 0 0 0 4px rgba(0,0,0,.12);
}

.theme-card-preview-classic { color:#f5c84c; background:#0d1422; }
.theme-card-preview-retro { color:#ffb000; background:#321b46; border-radius:2px; box-shadow:3px 3px 0 #9864ad; }
.theme-card-preview-cyberpunk { color:#00f5ff; background:#15102c; border-color:#00f5ff; border-radius:3px; box-shadow:0 0 14px rgba(0,245,255,.4); }
.theme-card-preview-gameboy { color:#0f380f; background:#9bbc0f; border-color:#306230; border-radius:2px; box-shadow:3px 3px 0 #306230; }
.theme-card-preview-custom { color:#f472b6; background:linear-gradient(135deg,#18102d,#0f2530); }

.theme-card-mini-window {
  font-size: 24px;
  line-height: 1;
}

.theme-card-swatches {
  display: flex;
  gap: 5px;
}

.theme-card-swatches i {
  width: 17px;
  height: 17px;
  display: block;
  border: 1px solid rgba(255,255,255,.42);
  border-radius: 50%;
}

.theme-card-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.theme-card-copy strong {
  color: var(--ui-text-1);
  font-size: var(--vo-text-md);
}

.theme-card-copy small {
  color: var(--ui-text-3);
  font-size: var(--vo-text-xs);
  line-height: 1.45;
}

.theme-card-state {
  align-self: start;
  white-space: nowrap;
  padding: 5px 8px;
  color: var(--ui-text-2);
  border: 1px solid var(--ui-border-soft);
  border-radius: 999px;
  font-size: var(--vo-text-xs);
}

.theme-preset-card.active .theme-card-state {
  color: var(--vo-accent-fill-ink);
  border-color: var(--ui-accent);
  background: var(--vo-accent-fill);
}

.theme-custom-editor {
  padding: 18px;
  border: 1px solid var(--ui-border-soft);
  border-radius: var(--ui-radius-md);
  background: var(--ui-bg-1);
}

.theme-custom-head,
.theme-palette-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.theme-save-status {
  flex: 0 0 auto;
  padding: 5px 8px;
  color: var(--ui-success);
  border: 1px solid color-mix(in srgb, var(--ui-success) 45%, var(--ui-border-soft));
  border-radius: 999px;
  background: color-mix(in srgb, var(--ui-success) 10%, var(--ui-bg-2));
  font-size: var(--vo-text-xs);
  opacity: 0;
  transition: opacity .2s ease;
}

.theme-save-status.visible {
  opacity: 1;
}

.theme-custom-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
  margin-bottom: 18px;
}

.theme-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.theme-field-wide {
  grid-column: 1 / -1;
}

.theme-field-label {
  color: var(--ui-text-2);
  font-size: var(--vo-text-xs);
  font-weight: 750;
}

.theme-field input,
.theme-field select {
  width: 100%;
}

.theme-mode-editing {
  color: var(--ui-accent);
  font-size: var(--vo-text-xs);
  font-weight: 750;
}

.theme-color-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.theme-color-field {
  min-width: 0;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 8px;
  border: 1px solid var(--ui-border-soft);
  border-radius: var(--ui-radius-sm);
  background: var(--ui-bg-2);
}

.theme-color-input {
  width: 42px !important;
  height: 42px !important;
  min-height: 42px !important;
  padding: 3px !important;
  cursor: pointer;
}

.theme-color-field > span {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.theme-color-field strong {
  overflow: hidden;
  color: var(--ui-text-2);
  font-size: var(--vo-text-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-color-field small {
  color: var(--ui-text-3);
  font-family: var(--vo-font-mono);
  font-size: var(--vo-text-xs);
}

.theme-live-preview {
  margin-top: 18px;
  overflow: hidden;
  color: var(--ui-text-1);
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--ui-radius-lg);
  background: var(--ui-bg-2);
  box-shadow: var(--ui-shadow-lg);
}

.theme-preview-title {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 13px;
  color: var(--ui-accent);
  border-bottom: 1px solid var(--ui-border-soft);
  background: var(--ui-bg-3);
  font-family: var(--vo-font-pixel);
  font-size: var(--vo-pixel-sm);
}

.theme-preview-status {
  color: var(--ui-success);
  font-family: var(--vo-font-ui);
  font-size: var(--vo-text-xs);
}

.theme-preview-body {
  display: grid;
  gap: 9px;
  padding: 15px;
}

.theme-preview-body p {
  margin: 0;
  color: var(--ui-text-3);
  font-size: var(--vo-text-xs);
}

.theme-preview-actions,
.theme-custom-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.theme-preview-actions button {
  min-height: 38px;
}

.theme-custom-actions {
  margin-top: 15px;
  padding-top: 14px;
  border-top: 1px solid var(--ui-border-soft);
}

.theme-apply-button {
  color: var(--vo-accent-fill-ink) !important;
  border-color: var(--ui-accent) !important;
  background: var(--vo-accent-fill) !important;
}

@media (max-width: 900px) {

  .theme-studio-hero {
    flex-direction: column;
    padding: 15px;
  }

  .theme-current-pill {
    width: 100%;
  }

  .theme-preset-grid {
    grid-template-columns: 1fr;
  }

  .theme-preset-card {
    min-height: 112px;
    grid-template-columns: 78px minmax(0, 1fr);
  }

  .theme-card-preview {
    width: 78px;
    height: 76px;
    padding: 8px;
  }


  .theme-custom-controls,
  .theme-color-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .theme-mode-bar,
  .theme-custom-head,
  .theme-palette-head {
    align-items: stretch;
    flex-direction: column;
  }

  .theme-segmented {
    width: 100%;
  }

  .theme-custom-editor {
    padding: 13px;
  }

  .theme-custom-controls,
  .theme-color-grid {
    grid-template-columns: 1fr;
  }

  .theme-field-wide {
    grid-column: 1;
  }

  .theme-color-field {
    min-height: 58px;
  }

  .theme-preview-actions button,
  .theme-custom-actions button {
    flex: 1 1 140px;
  }
}
