/* ViaCheck action controls: one screen-only layer after the legacy themes.
   Four dashboard IDs intentionally outrank old per-screen !important rules.
   Body-portaled dialogs participate only while the authenticated shell is open.
   Public legal/signup dialogs, print, navigation, selectors and chart/photo
   controls retain their own semantics. No display/position/width reset here. */
@media screen {
  :is(
    #dashboardView#dashboardView#dashboardView#dashboardView :is(.panel, .app-modal),
    body:has(#dashboardView:not(.hidden):not([hidden])) :is(
      .app-modal:not(.legal-modal):not(.trial-signup-modal),
      .modal-overlay, .inventory-v2-confirm-overlay,
      #technicalDemandForm, #demandForm, #annotationModal,
      #systemConfirmModal, #systemPromptModal, #onboardingTutorial
    )
  ) {
    --vc-action-background: #143454;
    --vc-action-foreground: #ffffff;
    --vc-action-border: #143454;
    --vc-action-hover: #0e2944;
    --vc-action-hover-border: #0e2944;
  }

  /* Variants use :where so a row/link selector cannot outrank danger/primary.
     All variants share the same scope weight; semantic variants come last. */
  :is(
    #dashboardView#dashboardView#dashboardView#dashboardView :is(.panel, .app-modal),
    body:has(#dashboardView:not(.hidden):not([hidden])) :is(
      .app-modal:not(.legal-modal):not(.trial-signup-modal),
      .modal-overlay, .inventory-v2-confirm-overlay,
      #technicalDemandForm, #demandForm, #annotationModal,
      #systemConfirmModal, #systemPromptModal, #onboardingTutorial
    )
  ) :where(
    button.secondary, button.secondary-action, button.subtle,
    button[data-inventory-action^="clear-"],
    button[data-inventory-action="close-movement"],
    button[data-inventory-action="movement-back"],
    button[data-warehouse-action="cancel"],
    .compact-row-actions button, .warehouse-compact-actions button,
    .email-row-actions button, .item-actions button, .item-actions a.button-link,
    .technical-demand-actions button, .demand-card-actions button,
    .inventory-v2-table button, .inventory-v2-pagination button,
    .inventory-v2-pager button
  ) {
    --vc-action-background: #ffffff;
    --vc-action-foreground: #143454;
    --vc-action-border: #cbd5e1;
    --vc-action-hover: #edf2f7;
    --vc-action-hover-border: #a8b9cd;
  }

  :is(
    #dashboardView#dashboardView#dashboardView#dashboardView :is(.panel, .app-modal),
    body:has(#dashboardView:not(.hidden):not([hidden])) :is(
      .app-modal:not(.legal-modal):not(.trial-signup-modal),
      .modal-overlay, .inventory-v2-confirm-overlay,
      #technicalDemandForm, #demandForm, #annotationModal,
      #systemConfirmModal, #systemPromptModal, #onboardingTutorial
    )
  ) :where(button.primary, button.primary-action, button.demand-route-action, button.demand-has-reply) {
    --vc-action-background: #143454;
    --vc-action-foreground: #ffffff;
    --vc-action-border: #143454;
    --vc-action-hover: #0e2944;
    --vc-action-hover-border: #0e2944;
  }

  /* Destructive actions remain visibly different, including editor removals. */
  :is(
    #dashboardView#dashboardView#dashboardView#dashboardView :is(.panel, .app-modal),
    body:has(#dashboardView:not(.hidden):not([hidden])) :is(
      .app-modal:not(.legal-modal):not(.trial-signup-modal),
      .modal-overlay, .inventory-v2-confirm-overlay,
      #technicalDemandForm, #demandForm, #annotationModal,
      #systemConfirmModal, #systemPromptModal, #onboardingTutorial
    )
  ) :where(button.danger, button.danger-light, button.ghost-danger, button.subscription-cancel) {
    --vc-action-background: #fff4f3;
    --vc-action-foreground: #b42318;
    --vc-action-border: #e5b5b1;
    --vc-action-hover: #ffe8e5;
    --vc-action-hover-border: #d68f88;
  }

  :is(
    #dashboardView#dashboardView#dashboardView#dashboardView :is(.panel, .app-modal),
    body:has(#dashboardView:not(.hidden):not([hidden])) :is(
      .app-modal:not(.legal-modal):not(.trial-signup-modal),
      .modal-overlay, .inventory-v2-confirm-overlay,
      #technicalDemandForm, #demandForm, #annotationModal,
      #systemConfirmModal, #systemPromptModal, #onboardingTutorial
    )
  ) :is(button, a.button-link):not(:is(
    [role="tab"], [role="menuitem"], [role="switch"], [data-inventory-tab],
    .email-panel-tab, .report-type-button, .backup-option, .upgrade-storage-item,
    .sac-tool, .modelo-chave, .dashboard-step-button, .preview-photo-open,
    .icon-button, .icon-only-action, .modal-close, .password-reveal,
    .tutorial-close, .tutorial-minimize, .tutorial-compact,
    .inventory-v2-dropdown-toggle, .user-contract-trigger,
    .email-multi-select-trigger, .contract-access-trigger,
    [data-checklists-abrir], [data-checklists-pagina], [data-checklists-remover],
    /* O rotulo do topo da coluna e um botao so para poder ser clicado e
       ordenar. Ele nao e um botao de acao: pintado como acao, o cabecalho da
       tabela virava uma fileira de retangulos azuis. */
    .compact-sort,
    .nav-button, .notification-bell, .topbar-identity,
    .mobile-sidebar-overlay, .mobile-menu-button, .mobile-sidebar-close,
    [data-photo-zoom-in], [data-photo-zoom-out], [data-photo-zoom-fit]
  )) {
    box-sizing: border-box !important;
    min-height: 40px !important;
    min-width: min-content !important;
    height: auto !important;
    max-width: 100%;
    margin-block: 0 !important;
    padding: 9px 16px !important;
    border: 1px solid var(--vc-action-border) !important;
    border-radius: 4px !important;
    background: var(--vc-action-background) !important;
    color: var(--vc-action-foreground) !important;
    box-shadow: none !important;
    text-shadow: none !important;
    transform: none !important;
    filter: none !important;
    font-family: inherit !important;
    font-size: 13px !important;
    font-weight: 650 !important;
    line-height: 1.35 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
    white-space: normal !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease !important;
  }

  :is(
    #dashboardView#dashboardView#dashboardView#dashboardView :is(.panel, .app-modal),
    body:has(#dashboardView:not(.hidden):not([hidden])) :is(
      .app-modal:not(.legal-modal):not(.trial-signup-modal),
      .modal-overlay, .inventory-v2-confirm-overlay,
      #technicalDemandForm, #demandForm, #annotationModal,
      #systemConfirmModal, #systemPromptModal, #onboardingTutorial
    )
  ) :is(
    button.compact, .compact-row-actions button, .warehouse-compact-actions button,
    .email-row-actions button, .inventory-v2-table button,
    .inventory-v2-pagination button, .inventory-v2-pager button
  ):not(:is(
    [role="tab"], [role="menuitem"], [role="switch"], [data-inventory-tab],
    .email-panel-tab, .report-type-button, .backup-option, .upgrade-storage-item,
    .sac-tool, .modelo-chave, .dashboard-step-button, .preview-photo-open,
    .icon-button, .icon-only-action, .modal-close, .password-reveal,
    .tutorial-close, .tutorial-minimize, .tutorial-compact,
    .inventory-v2-dropdown-toggle, .user-contract-trigger,
    .email-multi-select-trigger, .contract-access-trigger,
    [data-checklists-abrir], [data-checklists-pagina], [data-checklists-remover],
    /* O rotulo do topo da coluna e um botao so para poder ser clicado e
       ordenar. Ele nao e um botao de acao: pintado como acao, o cabecalho da
       tabela virava uma fileira de retangulos azuis. */
    .compact-sort,
    .nav-button, .notification-bell, .topbar-identity,
    .mobile-sidebar-overlay, .mobile-menu-button, .mobile-sidebar-close,
    [data-photo-zoom-in], [data-photo-zoom-out], [data-photo-zoom-fit]
  )) {
    min-height: 34px !important;
    padding: 6px 12px !important;
  }

  :is(
    #dashboardView#dashboardView#dashboardView#dashboardView :is(.panel, .app-modal),
    body:has(#dashboardView:not(.hidden):not([hidden])) :is(
      .app-modal:not(.legal-modal):not(.trial-signup-modal),
      .modal-overlay, .inventory-v2-confirm-overlay,
      #technicalDemandForm, #demandForm, #annotationModal,
      #systemConfirmModal, #systemPromptModal, #onboardingTutorial
    )
  ) :is(button, a.button-link):not(:is(
    [role="tab"], [role="menuitem"], [role="switch"], [data-inventory-tab],
    .email-panel-tab, .report-type-button, .backup-option, .upgrade-storage-item,
    .sac-tool, .modelo-chave, .dashboard-step-button, .preview-photo-open,
    .icon-button, .icon-only-action, .modal-close, .password-reveal,
    .tutorial-close, .tutorial-minimize, .tutorial-compact,
    .inventory-v2-dropdown-toggle, .user-contract-trigger,
    .email-multi-select-trigger, .contract-access-trigger,
    [data-checklists-abrir], [data-checklists-pagina], [data-checklists-remover],
    /* O rotulo do topo da coluna e um botao so para poder ser clicado e
       ordenar. Ele nao e um botao de acao: pintado como acao, o cabecalho da
       tabela virava uma fileira de retangulos azuis. */
    .compact-sort,
    .nav-button, .notification-bell, .topbar-identity,
    .mobile-sidebar-overlay, .mobile-menu-button, .mobile-sidebar-close,
    [data-photo-zoom-in], [data-photo-zoom-out], [data-photo-zoom-fit]
  )):hover:not(:disabled):not([aria-disabled="true"]) {
    background: var(--vc-action-hover) !important;
    border-color: var(--vc-action-hover-border) !important;
    color: var(--vc-action-foreground) !important;
    box-shadow: none !important;
    transform: none !important;
    filter: none !important;
  }

  /* Close/eye controls stay square icons, not full-width text actions. */
  :is(
    #dashboardView#dashboardView#dashboardView#dashboardView :is(.panel, .app-modal),
    body:has(#dashboardView:not(.hidden):not([hidden])) :is(
      .app-modal:not(.legal-modal):not(.trial-signup-modal),
      .modal-overlay, .inventory-v2-confirm-overlay,
      #technicalDemandForm, #demandForm, #annotationModal,
      #systemConfirmModal, #systemPromptModal, #onboardingTutorial
    )
  ) :is(button.icon-button, button.modal-close) {
    box-sizing: border-box !important;
    width: 34px !important;
    min-width: 34px !important;
    height: 34px !important;
    min-height: 34px !important;
    padding: 0 !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 4px !important;
    background: #ffffff !important;
    color: #143454 !important;
    box-shadow: none !important;
    transform: none !important;
    filter: none !important;
    flex: 0 0 auto;
    font-size: 22px !important;
    line-height: 1 !important;
  }

  /* Semantic selections keep their active colors and layout; remove only
     ornamental rounding/effects instead of repainting them as actions. */
  :is(
    #dashboardView#dashboardView#dashboardView#dashboardView :is(.panel, .app-modal),
    body:has(#dashboardView:not(.hidden):not([hidden])) :is(
      .app-modal:not(.legal-modal):not(.trial-signup-modal),
      .modal-overlay, .inventory-v2-confirm-overlay,
      #technicalDemandForm, #demandForm, #annotationModal,
      #systemConfirmModal, #systemPromptModal, #onboardingTutorial
    )
  ) :is(
    button[role="tab"], button[data-inventory-tab], button.email-panel-tab,
    button.report-type-button, button.backup-option, button.upgrade-storage-item,
    button.sac-tool, button.modelo-chave, button.password-reveal,
    button.inventory-v2-dropdown-toggle, button.user-contract-trigger,
    button.email-multi-select-trigger, button.contract-access-trigger,
    [data-checklists-abrir], [data-checklists-pagina], [data-checklists-remover]
  ) {
    border-radius: 4px !important;
    box-shadow: none !important;
    transform: none !important;
    filter: none !important;
  }

  /* All in-scope buttons keep clear keyboard focus, including custom selects. */
  :is(
    #dashboardView#dashboardView#dashboardView#dashboardView :is(.panel, .app-modal),
    body:has(#dashboardView:not(.hidden):not([hidden])) :is(
      .app-modal:not(.legal-modal):not(.trial-signup-modal),
      .modal-overlay, .inventory-v2-confirm-overlay,
      #technicalDemandForm, #demandForm, #annotationModal,
      #systemConfirmModal, #systemPromptModal, #onboardingTutorial
    )
  ) :is(button, a.button-link):focus-visible {
    outline: 2px solid #467fbb !important;
    outline-offset: 2px !important;
  }

  :is(
    #dashboardView#dashboardView#dashboardView#dashboardView :is(.panel, .app-modal),
    body:has(#dashboardView:not(.hidden):not([hidden])) :is(
      .app-modal:not(.legal-modal):not(.trial-signup-modal),
      .modal-overlay, .inventory-v2-confirm-overlay,
      #technicalDemandForm, #demandForm, #annotationModal,
      #systemConfirmModal, #systemPromptModal, #onboardingTutorial
    )
  ) :is(button, a.button-link):not(:is(
    [role="tab"], [role="menuitem"], [role="switch"], [data-inventory-tab],
    .email-panel-tab, .report-type-button, .backup-option, .upgrade-storage-item,
    .sac-tool, .modelo-chave, .dashboard-step-button, .preview-photo-open,
    .icon-button, .icon-only-action, .modal-close, .password-reveal,
    .tutorial-close, .tutorial-minimize, .tutorial-compact,
    .inventory-v2-dropdown-toggle, .user-contract-trigger,
    .email-multi-select-trigger, .contract-access-trigger,
    [data-checklists-abrir], [data-checklists-pagina], [data-checklists-remover],
    /* O rotulo do topo da coluna e um botao so para poder ser clicado e
       ordenar. Ele nao e um botao de acao: pintado como acao, o cabecalho da
       tabela virava uma fileira de retangulos azuis. */
    .compact-sort,
    .nav-button, .notification-bell, .topbar-identity,
    .mobile-sidebar-overlay, .mobile-menu-button, .mobile-sidebar-close,
    [data-photo-zoom-in], [data-photo-zoom-out], [data-photo-zoom-fit]
  )):is(:disabled, [aria-disabled="true"]) {
    background: #eef1f5 !important;
    color: #718096 !important;
    border-color: #d8e0ea !important;
    box-shadow: none !important;
    transform: none !important;
    filter: none !important;
    opacity: 1 !important;
    cursor: not-allowed !important;
  }

  :is(
    #dashboardView#dashboardView#dashboardView#dashboardView :is(.panel, .app-modal),
    body:has(#dashboardView:not(.hidden):not([hidden])) :is(
      .app-modal:not(.legal-modal):not(.trial-signup-modal),
      .modal-overlay, .inventory-v2-confirm-overlay,
      #technicalDemandForm, #demandForm, #annotationModal,
      #systemConfirmModal, #systemPromptModal, #onboardingTutorial
    )
  ) input[type="file"]::file-selector-button {
    margin: 0 10px 0 0;
    padding: 7px 12px;
    min-height: 34px;
    border: 1px solid #cbd5e1 !important;
    border-radius: 4px !important;
    background: #ffffff !important;
    color: #143454 !important;
    box-shadow: none !important;
    font: inherit;
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
  }

  @media (max-width: 760px), (pointer: coarse) {
    :is(
    #dashboardView#dashboardView#dashboardView#dashboardView :is(.panel, .app-modal),
    body:has(#dashboardView:not(.hidden):not([hidden])) :is(
      .app-modal:not(.legal-modal):not(.trial-signup-modal),
      .modal-overlay, .inventory-v2-confirm-overlay,
      #technicalDemandForm, #demandForm, #annotationModal,
      #systemConfirmModal, #systemPromptModal, #onboardingTutorial
    )
  ) :is(button, a.button-link):not(:is(
    [role="tab"], [role="menuitem"], [role="switch"], [data-inventory-tab],
    .email-panel-tab, .report-type-button, .backup-option, .upgrade-storage-item,
    .sac-tool, .modelo-chave, .dashboard-step-button, .preview-photo-open,
    .icon-button, .icon-only-action, .modal-close, .password-reveal,
    .tutorial-close, .tutorial-minimize, .tutorial-compact,
    .inventory-v2-dropdown-toggle, .user-contract-trigger,
    .email-multi-select-trigger, .contract-access-trigger,
    [data-checklists-abrir], [data-checklists-pagina], [data-checklists-remover],
    /* O rotulo do topo da coluna e um botao so para poder ser clicado e
       ordenar. Ele nao e um botao de acao: pintado como acao, o cabecalho da
       tabela virava uma fileira de retangulos azuis. */
    .compact-sort,
    .nav-button, .notification-bell, .topbar-identity,
    .mobile-sidebar-overlay, .mobile-menu-button, .mobile-sidebar-close,
    [data-photo-zoom-in], [data-photo-zoom-out], [data-photo-zoom-fit]
  )) {
      min-height: 44px !important;
      padding: 10px 14px !important;
    }
    :is(
    #dashboardView#dashboardView#dashboardView#dashboardView :is(.panel, .app-modal),
    body:has(#dashboardView:not(.hidden):not([hidden])) :is(
      .app-modal:not(.legal-modal):not(.trial-signup-modal),
      .modal-overlay, .inventory-v2-confirm-overlay,
      #technicalDemandForm, #demandForm, #annotationModal,
      #systemConfirmModal, #systemPromptModal, #onboardingTutorial
    )
  ) :is(button.icon-button, button.modal-close) {
      width: 44px !important;
      min-width: 44px !important;
      height: 44px !important;
      min-height: 44px !important;
    }
    :is(
    #dashboardView#dashboardView#dashboardView#dashboardView :is(.panel, .app-modal),
    body:has(#dashboardView:not(.hidden):not([hidden])) :is(
      .app-modal:not(.legal-modal):not(.trial-signup-modal),
      .modal-overlay, .inventory-v2-confirm-overlay,
      #technicalDemandForm, #demandForm, #annotationModal,
      #systemConfirmModal, #systemPromptModal, #onboardingTutorial
    )
  ) input[type="file"]::file-selector-button {
      min-height: 44px;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    :is(
    #dashboardView#dashboardView#dashboardView#dashboardView :is(.panel, .app-modal),
    body:has(#dashboardView:not(.hidden):not([hidden])) :is(
      .app-modal:not(.legal-modal):not(.trial-signup-modal),
      .modal-overlay, .inventory-v2-confirm-overlay,
      #technicalDemandForm, #demandForm, #annotationModal,
      #systemConfirmModal, #systemPromptModal, #onboardingTutorial
    )
  ) :is(button, a.button-link):not(:is(
    [role="tab"], [role="menuitem"], [role="switch"], [data-inventory-tab],
    .email-panel-tab, .report-type-button, .backup-option, .upgrade-storage-item,
    .sac-tool, .modelo-chave, .dashboard-step-button, .preview-photo-open,
    .icon-button, .icon-only-action, .modal-close, .password-reveal,
    .tutorial-close, .tutorial-minimize, .tutorial-compact,
    .inventory-v2-dropdown-toggle, .user-contract-trigger,
    .email-multi-select-trigger, .contract-access-trigger,
    [data-checklists-abrir], [data-checklists-pagina], [data-checklists-remover],
    /* O rotulo do topo da coluna e um botao so para poder ser clicado e
       ordenar. Ele nao e um botao de acao: pintado como acao, o cabecalho da
       tabela virava uma fileira de retangulos azuis. */
    .compact-sort,
    .nav-button, .notification-bell, .topbar-identity,
    .mobile-sidebar-overlay, .mobile-menu-button, .mobile-sidebar-close,
    [data-photo-zoom-in], [data-photo-zoom-out], [data-photo-zoom-fit]
  )) { transition: none !important; }
  }
}
