/* Layout buttons v190: visual-only size and color convergence.
   This layer changes presentation only. It does not alter navigation,
   handlers, forms, workflows, storage, API logic or any behavior. */

:is(
  body.erp-app,
  body.source-inbox-frame-page,
  body.copywriting-app,
  body.api-app,
  body.templates-app
) {
  --m2-btn-height: 32px;
  --m2-btn-compact: 28px;
  --m2-btn-icon: 30px;
  --m2-btn-radius: 8px;
  --m2-btn-accent: #2f6b4f;
  --m2-btn-accent-hover: #275a42;
  --m2-btn-accent-soft: #eaf3ed;
  --m2-btn-danger: #a6514c;
  --m2-btn-danger-soft: #fbf0ee;
  --m2-btn-warning: #9a7537;
  --m2-btn-warning-soft: #fbf4e8;
  --m2-btn-neutral: #ffffff;
  --m2-btn-neutral-hover: #f0f4f1;
  --m2-btn-border: #ccd3cf;
  --m2-btn-border-soft: #e3e7e4;
  --m2-btn-text: #303b36;
  --m2-btn-muted: #68736c;
  --m2-btn-disabled-bg: #f3f5f4;
  --m2-btn-disabled-border: #e0e5e2;
  --m2-btn-disabled-text: #a2aba6;
}

:is(
  body.erp-app,
  body.source-inbox-frame-page,
  body.copywriting-app,
  body.api-app,
  body.templates-app
) button {
  box-sizing: border-box !important;
  -webkit-tap-highlight-color: transparent !important;
}

/* Standard command controls
   ------------------------------------------------------------------ */
:is(
  body.erp-app,
  body.source-inbox-frame-page,
  body.copywriting-app,
  body.api-app,
  body.templates-app
)
:is(
  .collector-button,
  .collector-detail-recollect,
  .pageClearButton,
  .selectionDeleteButton,
  .selectionPromptButton,
  .workflowButton,
  .embeddedRemovalButton,
  .page-clear-button,
  .export-mapping-button,
  .export-complete-button,
  .export-quiet-delete,
  .system-check-button,
  .account-add-button,
  .account-editor-primary,
  .account-editor-secondary,
  .modal-btn,
  .action-button,
  .quick-button,
  .icon-button.has-label,
  .template-load-more,
  .primary,
  .secondary,
  .retry
) {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: var(--m2-btn-height) !important;
  min-height: var(--m2-btn-height) !important;
  max-height: var(--m2-btn-height) !important;
  min-width: 0 !important;
  padding: 0 12px !important;
  border-radius: var(--m2-btn-radius) !important;
  border-style: solid !important;
  border-width: 1px !important;
  font-size: 12px !important;
  font-weight: 650 !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
  text-align: center !important;
  white-space: nowrap !important;
  text-decoration: none !important;
  box-shadow: none !important;
  opacity: 1 !important;
  transition:
    color .14s ease,
    background-color .14s ease,
    border-color .14s ease,
    opacity .14s ease !important;
}

/* Small top controls that sit inside toolbars or beside inputs. */
body.source-inbox-frame-page .collector-button {
  min-width: 70px !important;
}

body.source-inbox-frame-page #collectorStartButton,
body.source-inbox-frame-page #collectorDetailSaveButton {
  min-width: 84px !important;
}

body.source-inbox-frame-page #collectorTransferButton {
  
}

/* Segmented workflow switch: no outer border. */
body.copywriting-app .workflowButton {
  min-width: 92px !important;
  border-color: transparent !important;
  background: transparent !important;
  color: var(--m2-btn-muted) !important;
}

body.copywriting-app .workflowButton:hover:not(:disabled),
body.copywriting-app .workflowButton:focus-visible {
  background: var(--m2-btn-neutral-hover) !important;
  color: var(--m2-btn-text) !important;
}

body.copywriting-app .workflowButton.active,
body.copywriting-app .workflowButton[aria-pressed="true"] {
  border-color: transparent !important;
  background: var(--m2-btn-neutral) !important;
  color: var(--m2-btn-accent) !important;
  box-shadow: inset 0 0 0 1px rgba(47, 107, 79, .16) !important;
}

/* Compact pagination and quiet in-cell controls. */
:is(
  body.erp-app,
  body.source-inbox-frame-page,
  body.copywriting-app
)
:is(
  .collector-pager button,
  .collector-page-size select,
  .copywritingPager button,
  .embeddedRemovalPager button,
  .workflow-pagination button,
  .template-actions button,
  .export-mapping-issue-item,
  .mapping-locate-action
) {
  height: var(--m2-btn-compact) !important;
  min-height: var(--m2-btn-compact) !important;
  max-height: var(--m2-btn-compact) !important;
  padding: 0 10px !important;
  border-radius: 7px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

/* Icon-only controls: 30px square, centered, quiet neutral. */
:is(
  body.erp-app,
  body.source-inbox-frame-page,
  body.api-app
)
:is(
  .account-editor-close,
  .product-detail-close,
  .collector-icon-button,
  .erp-image-zoom-close,
  .account-more-button,
  .icon-button:not(.has-label)
) {
  width: var(--m2-btn-icon) !important;
  min-width: var(--m2-btn-icon) !important;
  max-width: var(--m2-btn-icon) !important;
  height: var(--m2-btn-icon) !important;
  min-height: var(--m2-btn-icon) !important;
  max-height: var(--m2-btn-icon) !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border: 1px solid var(--m2-btn-border-soft) !important;
  border-radius: var(--m2-btn-radius) !important;
  background: var(--m2-btn-neutral) !important;
  color: var(--m2-btn-muted) !important;
  box-shadow: none !important;
}

/* Small text action nested in password/input fields. */
body.erp-app .password-control button {
  width: auto !important;
  min-width: 38px !important;
  height: 26px !important;
  min-height: 26px !important;
  max-height: 26px !important;
  padding: 0 7px !important;
  border: 0 !important;
  border-radius: 6px !important;
  background: transparent !important;
  color: #68736c !important;
  font-size: 12px !important;
  font-weight: 650 !important;
  line-height: 1 !important;
}

/* User popover menu rows should stay compact but legible. */
body.erp-app .user-menu-action {
  width: 100% !important;
  min-width: 0 !important;
  height: 36px !important;
  min-height: 36px !important;
  max-height: 36px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 10px !important;
  border: 0 !important;
  border-radius: 7px !important;
  background: transparent !important;
  color: var(--m2-btn-text) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  text-align: center !important;
}

body.erp-app .user-menu-action:hover,
body.erp-app .user-menu-action:focus-visible {
  background: var(--m2-btn-accent-soft) !important;
  color: var(--m2-btn-accent) !important;
}

body.erp-app .user-menu-action.logout-action {
  margin-top: 4px !important;
  color: var(--m2-btn-danger) !important;
  border-top: 0 !important;
  
}

body.erp-app .user-menu-action.logout-action:hover,
body.erp-app .user-menu-action.logout-action:focus-visible {
  background: var(--m2-btn-danger-soft) !important;
  color: var(--m2-btn-danger) !important;
}

/* Sidebar active state: remove stale blue-gray treatment. */
body.erp-app .sidebar .nav button {
  border: 1px solid transparent !important;
  background: transparent !important;
  color: var(--m2-btn-muted) !important;
}

body.erp-app .sidebar .nav button:hover:not(.active) {
  border-color: transparent !important;
  background: var(--m2-btn-neutral-hover) !important;
  color: var(--m2-btn-text) !important;
}

body.erp-app .sidebar .nav button.active,
body.erp-app .sidebar .nav button[aria-current="true"] {
  
  
  
  box-shadow: none !important;
}

body.erp-app .sidebar .nav button.active::before {
  background: var(--m2-btn-accent) !important;
}

/* Primary CTA
   ------------------------------------------------------------------ */
body.erp-app :is(
  .account-editor-primary,
  .account-add-button,
  .system-check-button.primary,
  .export-mapping-button:not(.secondary),
  .export-complete-button,
  .modal-btn.confirm:not(.danger),
  .modal-btn.confirm:not(.confirm.danger),
  .erp-primary-button
),
body.source-inbox-frame-page :is(
  .collector-button.primary,
  .collector-button.action
),
body.copywriting-app :is(
  .selectionPromptButton:not(:disabled),
  .embeddedRemovalButton.primary
),
body.api-app .action-button.primary,
body.templates-app .primary {
  border-color: var(--m2-btn-accent) !important;
  background: var(--m2-btn-accent) !important;
  color: #ffffff !important;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .16) inset !important;
}

body.erp-app :is(
  .account-editor-primary:hover:not(:disabled),
  .account-add-button:hover:not(:disabled),
  .system-check-button.primary:hover:not(:disabled),
  .export-mapping-button:not(.secondary):hover:not(:disabled),
  .export-complete-button:hover:not(:disabled),
  .modal-btn.confirm:not(.danger):hover:not(:disabled),
  .erp-primary-button:hover:not(:disabled)
),
body.source-inbox-frame-page :is(
  .collector-button.primary:hover:not(:disabled),
  .collector-button.action:hover:not(:disabled)
),
body.copywriting-app :is(
  .selectionPromptButton:hover:not(:disabled),
  .embeddedRemovalButton.primary:hover:not(:disabled)
),
body.api-app .action-button.primary:hover:not(:disabled),
body.templates-app .primary:hover:not(:disabled) {
  border-color: var(--m2-btn-accent-hover) !important;
  background: var(--m2-btn-accent-hover) !important;
  color: #ffffff !important;
  box-shadow: none !important;
}

/* Neutral / secondary
   ------------------------------------------------------------------ */
body.source-inbox-frame-page .collector-button.secondary,
body.source-inbox-frame-page .collector-button.paused,
body.source-inbox-frame-page .page-clear-button,
body.erp-app :is(
  .account-editor-secondary,
  .page-clear-button,
  .export-mapping-button.secondary,
  .modal-btn:not(.confirm),
  .erp-secondary-button
),
body.copywriting-app :is(
  .pageClearButton,
  .embeddedRemovalButton:not(.primary):not(.danger):not([hidden])
),
body.api-app :is(
  .action-button:not(.primary):not(.danger),
  .action-button.secondary,
  .action-button.ghost,
  .action-button.deepseek,
  .quick-button,
  .icon-button.has-label
),
body.templates-app :is(
  .secondary,
  #downloadFailedTemplates,
  #retryFailedUpload
) {
  border-color: var(--m2-btn-border) !important;
  background: var(--m2-btn-neutral) !important;
  color: var(--m2-btn-text) !important;
  box-shadow: none !important;
}

body.source-inbox-frame-page .collector-button.secondary:hover:not(:disabled),
body.source-inbox-frame-page .collector-button.paused:hover:not(:disabled),
body.source-inbox-frame-page .page-clear-button:hover:not(:disabled),
body.erp-app :is(
  .account-editor-secondary:hover:not(:disabled),
  .page-clear-button:hover:not(:disabled),
  .export-mapping-button.secondary:hover:not(:disabled),
  .modal-btn:not(.confirm):hover:not(:disabled),
  .erp-secondary-button:hover:not(:disabled)
),
body.copywriting-app :is(
  .pageClearButton:hover:not(:disabled),
  .embeddedRemovalButton:not(.primary):not(.danger):hover:not(:disabled)
),
body.api-app :is(
  .action-button:not(.primary):not(.danger):hover:not(:disabled),
  .action-button.secondary:hover:not(:disabled),
  .action-button.ghost:hover:not(:disabled),
  .quick-button:hover:not(:disabled),
  .icon-button.has-label:hover:not(:disabled)
),
body.templates-app :is(
  .secondary:hover:not(:disabled),
  #downloadFailedTemplates:hover:not(:disabled),
  #retryFailedUpload:hover:not(:disabled)
) {
  border-color: #b9c4bd !important;
  background: var(--m2-btn-neutral-hover) !important;
  color: #233129 !important;
  box-shadow: none !important;
}

/* Warning state for pause / active scan. */
body.source-inbox-frame-page .collector-button.paused {
  border-color: rgba(154, 117, 55, .28) !important;
  background: var(--m2-btn-warning-soft) !important;
  color: var(--m2-btn-warning) !important;
}

/* Danger / destructive
   ------------------------------------------------------------------ */
body.source-inbox-frame-page .collector-button.danger,
body.copywriting-app :is(
  .selectionDeleteButton,
  .embeddedRemovalButton.danger
),
body.api-app .action-button.danger,
body.erp-app :is(
  .export-quiet-delete,
  .account-action-menu button.danger,
  .modal-btn.confirm.danger,
  .account-delete-button
) {
  border-color: rgba(166, 81, 76, .20) !important;
  background: var(--m2-btn-danger-soft) !important;
  color: var(--m2-btn-danger) !important;
  box-shadow: none !important;
}

body.source-inbox-frame-page .collector-button.danger:hover:not(:disabled),
body.copywriting-app :is(
  .selectionDeleteButton:hover:not(:disabled),
  .embeddedRemovalButton.danger:hover:not(:disabled)
),
body.api-app .action-button.danger:hover:not(:disabled),
body.erp-app :is(
  .export-quiet-delete:hover:not(:disabled),
  .account-action-menu button.danger:hover:not(:disabled),
  .modal-btn.confirm.danger:hover:not(:disabled),
  .account-delete-button:hover:not(:disabled)
) {
  border-color: rgba(166, 81, 76, .34) !important;
  background: #faece9 !important;
  color: #8d3d39 !important;
  box-shadow: none !important;
}

/* Action buttons such as "转入文案优化" stay quiet green-soft. */
body.source-inbox-frame-page .collector-button.action {
  border-color: rgba(47, 107, 79, .24) !important;
  background: var(--m2-btn-accent-soft) !important;
  color: var(--m2-btn-accent) !important;
}

/* Provider-specific controls should not carry provider colors. */
body.api-app .action-button.deepseek,
body.api-app .action-button.r2,
body.api-app .quick-button.deepseek,
body.api-app .quick-button.r2 {
  border-color: var(--m2-btn-border) !important;
  background: var(--m2-btn-neutral) !important;
  color: var(--m2-btn-text) !important;
}

/* API sidebar compact controls: keep one primary action per operation. */
body.api-app .icon-button.has-label {
  width: auto !important;
  min-width: 72px !important;
  gap: 5px !important;
  padding: 0 10px !important;
  font-size: 12px !important;
  font-weight: 650 !important;
}

body.api-app .icon-button.has-label svg {
  width: 14px !important;
  height: 14px !important;
}

/* Restore copywriting hidden parse actions to the same semantics. */
body.copywriting-app .parseWorkflowActions .embeddedRemovalButton {
  height: var(--m2-btn-height) !important;
  min-height: var(--m2-btn-height) !important;
  max-height: var(--m2-btn-height) !important;
  min-width: auto !important;
  padding: 0 12px !important;
  border-color: var(--m2-btn-border) !important;
  border-radius: var(--m2-btn-radius) !important;
  background: var(--m2-btn-neutral) !important;
  color: var(--m2-btn-text) !important;
}

body.copywriting-app .parseWorkflowActions #embeddedTransferExport {
  border-color: var(--m2-btn-accent) !important;
  background: var(--m2-btn-accent) !important;
  color: #ffffff !important;
}

body.copywriting-app .parseWorkflowActions #embeddedStripBrandTerms {
  border-color: rgba(47, 107, 79, .26) !important;
  background: var(--m2-btn-accent-soft) !important;
  color: var(--m2-btn-accent) !important;
}

body.copywriting-app .parseWorkflowActions .embeddedRemovalButton.danger {
  border-color: rgba(166, 81, 76, .20) !important;
  background: var(--m2-btn-danger-soft) !important;
  color: var(--m2-btn-danger) !important;
}

/* Account row action menu. */
body.erp-app .account-action-menu button {
  height: 32px !important;
  min-height: 32px !important;
  max-height: 32px !important;
  border: 0 !important;
  border-radius: 7px !important;
  background: transparent !important;
  color: var(--m2-btn-text) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
}

body.erp-app .account-action-menu button:hover:not(:disabled) {
  background: var(--m2-btn-neutral-hover) !important;
  color: var(--m2-btn-text) !important;
}

/* Modal semantic split. */
body.erp-app .system-modal-actions button,
body.erp-app .export-file-modal-actions button,
body.erp-app .account-editor-actions button {
  min-width: 88px !important;
  padding: 0 16px !important;
}

/* Lightbox close should remain a quiet translucent overlay button. */
body.source-inbox-frame-page .collector-image-lightbox-close,
body.erp-app .erp-image-zoom-close {
  width: 34px !important;
  min-width: 34px !important;
  height: 34px !important;
  min-height: 34px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 50% !important;
}

/* Disabled state: neutral gray instead of faded colored button. */
:is(
  body.erp-app,
  body.source-inbox-frame-page,
  body.copywriting-app,
  body.api-app,
  body.templates-app
)
:is(
  button:disabled,
  button[disabled],
  button[aria-disabled="true"]
),
:is(
  body.erp-app,
  body.source-inbox-frame-page,
  body.copywriting-app,
  body.api-app,
  body.templates-app
)
button:disabled:is(
  .collector-button,
  .pageClearButton,
  .selectionDeleteButton,
  .selectionPromptButton,
  .workflowButton,
  .embeddedRemovalButton,
  .page-clear-button,
  .export-mapping-button,
  .export-complete-button,
  .system-check-button,
  .account-add-button,
  .account-editor-primary,
  .account-editor-secondary,
  .modal-btn,
  .action-button,
  .quick-button,
  .primary,
  .secondary
) {
  cursor: not-allowed !important;
  border-color: var(--m2-btn-disabled-border) !important;
  background: var(--m2-btn-disabled-bg) !important;
  color: var(--m2-btn-disabled-text) !important;
  opacity: 1 !important;
  box-shadow: none !important;
  pointer-events: auto !important;
}

/* Focus and hover consistency. */
:is(
  body.erp-app,
  body.source-inbox-frame-page,
  body.copywriting-app,
  body.api-app,
  body.templates-app
)
button:focus-visible {
  outline: 0 !important;
  box-shadow: 0 0 0 3px rgba(47, 107, 79, .14) !important;
}

/* Prevent tiny visual shift during async states. */
:is(
  body.erp-app,
  body.source-inbox-frame-page,
  body.copywriting-app,
  body.api-app,
  body.templates-app
)
:is(
  .collector-button,
  .pageClearButton,
  .selectionDeleteButton,
  .selectionPromptButton,
  .embeddedRemovalButton,
  .page-clear-button,
  .export-mapping-button,
  .export-complete-button,
  .system-check-button,
  .account-add-button,
  .account-editor-primary,
  .account-editor-secondary,
  .modal-btn,
  .action-button,
  .quick-button,
  .primary,
  .secondary
):active:not(:disabled) {
  transform: none !important;
  filter: brightness(.985) !important;
}

/* Normalize button text scale inside nested svg icons. */
:is(
  body.erp-app,
  body.source-inbox-frame-page,
  body.copywriting-app,
  body.api-app,
  body.templates-app
)
button svg {
  flex: 0 0 auto !important;
}

/* ------------------------------------------------------------------ */
/* High-specificity overrides for legacy descendant rules             */
/* ------------------------------------------------------------------ */

/* Copywriting command bar. */
body.copywriting-app .commandBar button:is(
  .pageClearButton,
  .selectionDeleteButton,
  .selectionPromptButton,
  .workflowButton,
  .embeddedRemovalButton
) {
  height: var(--m2-btn-height) !important;
  min-height: var(--m2-btn-height) !important;
  max-height: var(--m2-btn-height) !important;
  min-width: auto !important;
  padding: 0 12px !important;
  border-radius: var(--m2-btn-radius) !important;
  font-size: 12px !important;
  font-weight: 650 !important;
  line-height: 1 !important;
  box-shadow: none !important;
}

body.copywriting-app .commandBar .pageClearButton:not(:disabled),
body.copywriting-app .commandBar .embeddedRemovalButton:not(.primary):not(.danger):not(:disabled) {
  border-color: var(--m2-btn-border) !important;
  background: var(--m2-btn-neutral) !important;
  color: var(--m2-btn-text) !important;
}

body.copywriting-app .commandBar .pageClearButton:hover:not(:disabled),
body.copywriting-app .commandBar .embeddedRemovalButton:not(.primary):not(.danger):hover:not(:disabled) {
  border-color: #b9c4bd !important;
  background: var(--m2-btn-neutral-hover) !important;
  color: #233129 !important;
}

body.copywriting-app .commandBar .selectionDeleteButton:not(:disabled),
body.copywriting-app .commandBar .embeddedRemovalButton.danger:not(:disabled) {
  border-color: rgba(166, 81, 76, .20) !important;
  background: var(--m2-btn-danger-soft) !important;
  color: var(--m2-btn-danger) !important;
}

body.copywriting-app .commandBar .selectionDeleteButton:hover:not(:disabled),
body.copywriting-app .commandBar .embeddedRemovalButton.danger:hover:not(:disabled) {
  border-color: rgba(166, 81, 76, .34) !important;
  background: #faece9 !important;
  color: #8d3d39 !important;
}

body.copywriting-app .commandBar .selectionPromptButton:not(:disabled),
body.copywriting-app .commandBar #embeddedTransferExport:not(:disabled) {
  border-color: var(--m2-btn-accent) !important;
  background: var(--m2-btn-accent) !important;
  color: #ffffff !important;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .16) inset !important;
}

body.copywriting-app .commandBar .selectionPromptButton:hover:not(:disabled),
body.copywriting-app .commandBar #embeddedTransferExport:hover:not(:disabled) {
  border-color: var(--m2-btn-accent-hover) !important;
  background: var(--m2-btn-accent-hover) !important;
  color: #ffffff !important;
  box-shadow: none !important;
}

body.copywriting-app .commandBar #embeddedStripBrandTerms:not(:disabled) {
  border-color: rgba(47, 107, 79, .26) !important;
  background: var(--m2-btn-accent-soft) !important;
  color: var(--m2-btn-accent) !important;
}

body.copywriting-app .commandBar .workflowButton.active,
body.copywriting-app .commandBar .workflowButton[aria-pressed="true"] {
  border-color: transparent !important;
  background: var(--m2-btn-neutral) !important;
  color: var(--m2-btn-accent) !important;
  box-shadow: inset 0 0 0 1px rgba(47, 107, 79, .16) !important;
}

body.copywriting-app .commandBar[data-panel] button#clearCopywritingPage,
body.copywriting-app .commandBar[data-panel] button#clearParsePage,
body.copywriting-app .commandBar button#generatePrompt,
body.copywriting-app .commandBar button#embeddedDeleteRemovalSelected,
body.copywriting-app .commandBar button#embeddedStripBrandTerms,
body.copywriting-app .commandBar button#embeddedTransferExport {
  height: var(--m2-btn-height) !important;
  min-height: var(--m2-btn-height) !important;
  max-height: var(--m2-btn-height) !important;
  min-width: auto !important;
  padding: 0 12px !important;
  border-radius: var(--m2-btn-radius) !important;
  font-size: 12px !important;
  font-weight: 650 !important;
  line-height: 1 !important;
  box-shadow: none !important;
}

/* API workspace. */
body.api-app .sidebar-tools .icon-button.has-label,
body.api-app .empty-actions .action-button,
body.api-app .editor-actions .action-button {
  height: var(--m2-btn-height) !important;
  min-height: var(--m2-btn-height) !important;
  max-height: var(--m2-btn-height) !important;
  min-width: 0 !important;
  padding: 0 12px !important;
  border-radius: var(--m2-btn-radius) !important;
  font-size: 12px !important;
  font-weight: 650 !important;
  line-height: 1 !important;
  box-shadow: none !important;
}

body.api-app .sidebar-tools .icon-button.has-label {
  width: auto !important;
  min-width: 72px !important;
  gap: 5px !important;
}

body.api-app .sidebar-head .sidebar-tools button#newConnectionMenuBtn,
body.api-app .sidebar-head .sidebar-tools button#refreshConnectionsBtn {
  height: var(--m2-btn-height) !important;
  min-height: var(--m2-btn-height) !important;
  max-height: var(--m2-btn-height) !important;
  min-width: 72px !important;
  padding: 0 12px !important;
  border-radius: var(--m2-btn-radius) !important;
  box-shadow: none !important;
}

body.api-app .editor-actions .action-button.primary:not(:disabled),
body.api-app .empty-actions .action-button.deepseek:not(:disabled),
body.api-app .empty-actions .action-button.primary:not(:disabled) {
  border-color: var(--m2-btn-accent) !important;
  background: var(--m2-btn-accent) !important;
  color: #ffffff !important;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .16) inset !important;
}

body.api-app .editor-actions .action-button.primary:hover:not(:disabled),
body.api-app .empty-actions .action-button.deepseek:hover:not(:disabled),
body.api-app .empty-actions .action-button.primary:hover:not(:disabled) {
  border-color: var(--m2-btn-accent-hover) !important;
  background: var(--m2-btn-accent-hover) !important;
  color: #ffffff !important;
  box-shadow: none !important;
}

body.api-app .editor-actions .action-button:not(.primary):not(.danger):not(:disabled),
body.api-app .empty-actions .action-button.secondary:not(:disabled),
body.api-app .quick-actions .quick-button:not(:disabled) {
  border-color: var(--m2-btn-border) !important;
  background: var(--m2-btn-neutral) !important;
  color: var(--m2-btn-text) !important;
}

body.api-app .editor-actions .action-button:not(.primary):not(.danger):hover:not(:disabled),
body.api-app .empty-actions .action-button.secondary:hover:not(:disabled),
body.api-app .quick-actions .quick-button:hover:not(:disabled) {
  border-color: #b9c4bd !important;
  background: var(--m2-btn-neutral-hover) !important;
  color: #233129 !important;
}

body.api-app .editor-actions .action-button.danger:not(.hidden):not(:disabled) {
  border-color: rgba(166, 81, 76, .20) !important;
  background: var(--m2-btn-danger-soft) !important;
  color: var(--m2-btn-danger) !important;
}

body.api-app .editor-actions .action-button.danger:hover:not(.hidden):not(:disabled) {
  border-color: rgba(166, 81, 76, .34) !important;
  background: #faece9 !important;
  color: #8d3d39 !important;
}

/* Templates toolbar. */
body.templates-app .toolbar-actions button,
body.templates-app .upload-failure-actions button {
  height: var(--m2-btn-height) !important;
  min-height: var(--m2-btn-height) !important;
  max-height: var(--m2-btn-height) !important;
  min-width: 0 !important;
  padding: 0 12px !important;
  border-radius: var(--m2-btn-radius) !important;
  font-size: 12px !important;
  font-weight: 650 !important;
  line-height: 1 !important;
  box-shadow: none !important;
}

body.templates-app .toolbar-actions .primary:not(:disabled),
body.templates-app .upload-failure-actions .primary:not(:disabled) {
  border-color: var(--m2-btn-accent) !important;
  background: var(--m2-btn-accent) !important;
  color: #ffffff !important;
}

body.templates-app .toolbar-actions .primary:hover:not(:disabled),
body.templates-app .upload-failure-actions .primary:hover:not(:disabled) {
  border-color: var(--m2-btn-accent-hover) !important;
  background: var(--m2-btn-accent-hover) !important;
  color: #ffffff !important;
}

body.templates-app .toolbar-actions .secondary:not(:disabled),
body.templates-app .upload-failure-actions .secondary:not(:disabled) {
  border-color: var(--m2-btn-border) !important;
  background: var(--m2-btn-neutral) !important;
  color: var(--m2-btn-text) !important;
}

body.templates-app .toolbar-actions .secondary:hover:not(:disabled),
body.templates-app .upload-failure-actions .secondary:hover:not(:disabled) {
  border-color: #b9c4bd !important;
  background: var(--m2-btn-neutral-hover) !important;
  color: #233129 !important;
}

body.templates-app .toolbar-actions button#importButton,
body.templates-app .upload-failure-actions button#downloadFailedTemplates,
body.templates-app .upload-failure-actions button#retryFailedUpload {
  height: var(--m2-btn-height) !important;
  min-height: var(--m2-btn-height) !important;
  max-height: var(--m2-btn-height) !important;
  min-width: 0 !important;
  padding: 0 12px !important;
  border-radius: var(--m2-btn-radius) !important;
  font-size: 12px !important;
  font-weight: 650 !important;
  line-height: 1 !important;
  box-shadow: none !important;
}

/* Main ERP header, account and system views. */
body.erp-app .accounts-primary-action .account-add-button:not(:disabled),
body.erp-app .system-check-header .system-check-button.primary:not(:disabled),
body.erp-app .export-listing-header .export-mapping-button:not(.secondary):not(:disabled),
body.erp-app .export-listing-header .export-complete-button:not(:disabled),
body.erp-app .account-editor-actions .account-editor-primary:not(:disabled),
body.erp-app #systemModal .system-modal-actions .modal-btn.confirm:not(.danger):not(:disabled),
body.erp-app #exportFileModal .export-file-modal-actions .modal-btn.confirm:not(.danger):not(:disabled) {
  border-color: var(--m2-btn-accent) !important;
  background: var(--m2-btn-accent) !important;
  color: #ffffff !important;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .16) inset !important;
}

body.erp-app .accounts-primary-action .account-add-button:hover:not(:disabled),
body.erp-app .system-check-header .system-check-button.primary:hover:not(:disabled),
body.erp-app .export-listing-header .export-mapping-button:not(.secondary):hover:not(:disabled),
body.erp-app .export-listing-header .export-complete-button:hover:not(:disabled),
body.erp-app .account-editor-actions .account-editor-primary:hover:not(:disabled),
body.erp-app #systemModal .system-modal-actions .modal-btn.confirm:not(.danger):hover:not(:disabled),
body.erp-app #exportFileModal .export-file-modal-actions .modal-btn.confirm:not(.danger):hover:not(:disabled) {
  border-color: var(--m2-btn-accent-hover) !important;
  background: var(--m2-btn-accent-hover) !important;
  color: #ffffff !important;
  box-shadow: none !important;
}

body.erp-app .export-listing-header .page-clear-button:not(:disabled),
body.erp-app .account-editor-actions .account-editor-secondary:not(:disabled),
body.erp-app #systemModal .system-modal-actions .modal-btn:not(.confirm):not(:disabled),
body.erp-app #exportFileModal .export-file-modal-actions .modal-btn:not(.confirm):not(:disabled) {
  border-color: var(--m2-btn-border) !important;
  background: var(--m2-btn-neutral) !important;
  color: var(--m2-btn-text) !important;
}

body.erp-app .export-listing-header .page-clear-button:hover:not(:disabled),
body.erp-app .account-editor-actions .account-editor-secondary:hover:not(:disabled),
body.erp-app #systemModal .system-modal-actions .modal-btn:not(.confirm):hover:not(:disabled),
body.erp-app #exportFileModal .export-file-modal-actions .modal-btn:not(.confirm):hover:not(:disabled) {
  border-color: #b9c4bd !important;
  background: var(--m2-btn-neutral-hover) !important;
  color: #233129 !important;
}

body.erp-app .export-listing-header .export-quiet-delete:not(:disabled) {
  border-color: rgba(166, 81, 76, .20) !important;
  background: var(--m2-btn-danger-soft) !important;
  color: var(--m2-btn-danger) !important;
}

body.erp-app .sidebar .nav button.active,
body.erp-app .sidebar .nav button[aria-current="true"] {
  border-color: transparent !important;
  background: var(--m2-btn-accent-soft) !important;
  color: var(--m2-btn-accent) !important;
}

/* Strong per-control state overrides for disabled/empty workflow states. */
body.erp-app #clearExportPage,
body.erp-app #systemCheckFixBtn,
body.erp-app #startExportMapping,
body.erp-app #exportMissingTemplatePlan,
body.erp-app #exportCompleteTable,
body.source-inbox-frame-page #collectorPauseButton,
body.source-inbox-frame-page #collectorStopButton,
body.source-inbox-frame-page #collectorDeleteButton,
body.source-inbox-frame-page #collectorTransferButton {
  height: var(--m2-btn-height) !important;
  min-height: var(--m2-btn-height) !important;
  max-height: var(--m2-btn-height) !important;
  min-width: 72px !important;
  padding: 0 12px !important;
  border-radius: var(--m2-btn-radius) !important;
  font-size: 12px !important;
  font-weight: 650 !important;
  line-height: 1 !important;
  box-shadow: none !important;
}

body.erp-app .export-listing-header #clearExportPage,
body.erp-app .export-clear-toolbar #clearExportPage {
  height: var(--m2-btn-height) !important;
  min-height: var(--m2-btn-height) !important;
  max-height: var(--m2-btn-height) !important;
  min-width: 96px !important;
  padding: 0 12px !important;
  border-radius: var(--m2-btn-radius) !important;
  font-size: 12px !important;
  font-weight: 650 !important;
  line-height: 1 !important;
  box-shadow: none !important;
}

body.erp-app #clearExportPage {
  min-width: 96px !important;
}

body.erp-app #systemCheckFixBtn,
body.erp-app #startExportMapping,
body.erp-app #exportCompleteTable,
body.erp-app #exportMissingTemplatePlan {
  min-width: 96px !important;
}

body.source-inbox-frame-page #collectorTransferButton {
  min-width: 96px !important;
}

/* Final legacy override for visible modal actions. */
body.erp-app #accountEditorSubmit,
body.erp-app #accountEditorCancel,
body.erp-app #modalCancelBtn,
body.erp-app #modalConfirmBtn,
body.erp-app #exportFileCancel,
body.erp-app #exportFileConfirm {
  height: var(--m2-btn-height) !important;
  min-height: var(--m2-btn-height) !important;
  max-height: var(--m2-btn-height) !important;
  min-width: 88px !important;
  padding: 0 16px !important;
  border-radius: var(--m2-btn-radius) !important;
  border-style: solid !important;
  border-width: 1px !important;
  font-size: 12px !important;
  font-weight: 650 !important;
  line-height: 1 !important;
  box-shadow: none !important;
}

body.erp-app #accountEditorSubmit:not(:disabled),
body.erp-app #modalConfirmBtn:not(.danger):not(:disabled),
body.erp-app #exportFileConfirm:not(.danger):not(:disabled) {
  border-color: var(--m2-btn-accent) !important;
  background: var(--m2-btn-accent) !important;
  color: #ffffff !important;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .16) inset !important;
}

body.erp-app #accountEditorSubmit:hover:not(:disabled),
body.erp-app #modalConfirmBtn:not(.danger):hover:not(:disabled),
body.erp-app #exportFileConfirm:not(.danger):hover:not(:disabled) {
  border-color: var(--m2-btn-accent-hover) !important;
  background: var(--m2-btn-accent-hover) !important;
  color: #ffffff !important;
  box-shadow: none !important;
}

body.erp-app #accountEditorCancel:not(:disabled),
body.erp-app #modalCancelBtn:not(:disabled),
body.erp-app #exportFileCancel:not(:disabled) {
  border-color: var(--m2-btn-border) !important;
  background: var(--m2-btn-neutral) !important;
  color: var(--m2-btn-text) !important;
}

body.erp-app #accountEditorCancel:hover:not(:disabled),
body.erp-app #modalCancelBtn:hover:not(:disabled),
body.erp-app #exportFileCancel:hover:not(:disabled) {
  border-color: #b9c4bd !important;
  background: var(--m2-btn-neutral-hover) !important;
  color: #233129 !important;
}

body.api-app #emptyDeepSeekBtn,
body.api-app #emptyNewBtn {
  height: var(--m2-btn-height) !important;
  min-height: var(--m2-btn-height) !important;
  max-height: var(--m2-btn-height) !important;
  min-width: 0 !important;
  padding: 0 12px !important;
  border-style: solid !important;
  border-width: 1px !important;
  border-radius: var(--m2-btn-radius) !important;
  font-size: 12px !important;
  font-weight: 650 !important;
  line-height: 1 !important;
  box-shadow: none !important;
}

body.api-app #emptyDeepSeekBtn:not(:disabled) {
  border-color: var(--m2-btn-accent) !important;
  background: var(--m2-btn-accent) !important;
  color: #ffffff !important;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .16) inset !important;
}

body.api-app #emptyDeepSeekBtn:hover:not(:disabled) {
  border-color: var(--m2-btn-accent-hover) !important;
  background: var(--m2-btn-accent-hover) !important;
  color: #ffffff !important;
  box-shadow: none !important;
}

body.api-app #emptyNewBtn:not(:disabled) {
  border-color: var(--m2-btn-border) !important;
  background: var(--m2-btn-neutral) !important;
  color: var(--m2-btn-text) !important;
}

body.api-app #emptyNewBtn:hover:not(:disabled) {
  border-color: #b9c4bd !important;
  background: var(--m2-btn-neutral-hover) !important;
  color: #233129 !important;
}

body.erp-app #clearExportPage:not(:disabled) {
  border-color: var(--m2-btn-border) !important;
  background: var(--m2-btn-neutral) !important;
  color: var(--m2-btn-text) !important;
}

body.erp-app #clearExportPage:hover:not(:disabled),
body.erp-app .export-listing-header #clearExportPage:hover:not(:disabled),
body.erp-app .export-clear-toolbar #clearExportPage:hover:not(:disabled) {
  border-color: #b9c4bd !important;
  background: var(--m2-btn-neutral-hover) !important;
  color: #233129 !important;
}

body.erp-app #systemCheckFixBtn:disabled,
body.erp-app #startExportMapping:disabled,
body.erp-app #exportMissingTemplatePlan:disabled,
body.erp-app #exportCompleteTable:disabled,
body.source-inbox-frame-page #collectorPauseButton:disabled,
body.source-inbox-frame-page #collectorStopButton:disabled,
body.source-inbox-frame-page #collectorDeleteButton:disabled,
body.source-inbox-frame-page #collectorTransferButton:disabled {
  cursor: not-allowed !important;
  border-color: var(--m2-btn-disabled-border) !important;
  background: var(--m2-btn-disabled-bg) !important;
  color: var(--m2-btn-disabled-text) !important;
  opacity: 1 !important;
  box-shadow: none !important;
}

/* Fast-response layer: keep feedback crisp without changing behavior. */
:is(
  body.erp-app,
  body.source-inbox-frame-page,
  body.copywriting-app,
  body.api-app,
  body.templates-app
) :is(
  button,
  a,
  input,
  select,
  textarea,
  [role="button"],
  .view.active,
  .user-popover,
  .modal-backdrop,
  .collector-detail-panel,
  .collector-image-lightbox,
  .erp-toast,
  .module-toast,
  .moduleToast
) {
  transition-duration: .06s !important;
  transition-delay: 0s !important;
  animation-duration: .08s !important;
  animation-delay: 0s !important;
}

:is(
  body.erp-app,
  body.source-inbox-frame-page,
  body.copywriting-app,
  body.api-app,
  body.templates-app
) {
  scroll-behavior: auto !important;
}
