/* Business sheets inherit the phone workbench's materials without changing the forms. */
@media screen and (max-width: 760px), screen and (max-width: 1000px) and (max-height: 540px) and (orientation: landscape) {
  body.workspace-unified.mw-enabled #modal-root .modal-backdrop:has(> .workspace-business-sheet:not(.production-print-preview)) {
    background: var(--pwa-overlay);
  }

  body.workspace-unified.mw-enabled #modal-root .workspace-business-sheet:not(.production-print-preview) {
    --ws-frame: var(--pwa-bg);
    --ws-surface: var(--pwa-surface);
    --ws-soft: var(--pwa-well);
    --ws-selected: var(--pwa-selected);
    --ws-ink: var(--pwa-ink);
    --ws-muted: var(--pwa-muted);
    --ws-line: var(--pwa-line);
    --ws-accent: var(--pwa-accent);
    --line: var(--pwa-line);
    --ink: var(--pwa-ink);
    --text: var(--pwa-ink);
    --muted: var(--pwa-muted);
    background: var(--pwa-bg) !important;
    border: 1px solid var(--pwa-lens-edge) !important;
    border-radius: var(--pwa-card-radius) var(--pwa-card-radius) 0 0;
    color: var(--pwa-ink);
    box-shadow: var(--pwa-depth) !important;
  }

  body.workspace-unified.mw-enabled #modal-root .workspace-business-sheet:not(.production-print-preview)
    > :is(.modal-header, .modal-footer) {
    background: var(--pwa-lens-reflection), var(--pwa-lens-fill) !important;
    border-color: var(--pwa-lens-edge) !important;
    color: var(--pwa-ink);
    box-shadow: var(--pwa-lens-depth);
  }

  body.workspace-unified.mw-enabled #modal-root .workspace-business-sheet:not(.production-print-preview) > .modal-content {
    background: var(--pwa-bg) !important;
    color: var(--pwa-ink);
  }

  body.workspace-unified.mw-enabled #modal-root .workspace-business-sheet:not(.production-print-preview) :is(
    .modal-header h2, .form-section-title h3, .line-heading strong, .form-section summary,
    .modal-content label, .modal-content legend
  ) {
    color: var(--pwa-ink);
  }

  body.workspace-unified.mw-enabled #modal-root .workspace-business-sheet:not(.production-print-preview) :is(
    .modal-header p, .modal-footer .hint, .field-help, .cell-sub, .crm-selection-feedback
  ) {
    color: var(--pwa-muted);
  }

  body.workspace-unified.mw-enabled #modal-root .workspace-business-sheet:not(.production-print-preview) :is(
    .modal-content .form-section, .modal-content .form-section-title
  ) {
    border-color: var(--pwa-line);
  }

  body.workspace-unified.mw-enabled #modal-root .workspace-business-sheet:not(.production-print-preview) :is(
    .line-item, .pr-line-form, .pr-detail-lines > li, .detail-field
  ) {
    background: var(--pwa-surface) !important;
    color: var(--pwa-ink);
    border-color: var(--pwa-line) !important;
    border-radius: var(--pwa-card-radius);
    box-shadow: var(--pwa-card-shadow);
  }

  body.workspace-unified.mw-enabled #modal-root .workspace-business-sheet:not(.production-print-preview) .modal-content :is(
    input:not([type="checkbox"], [type="radio"], [type="hidden"], [type="range"], [type="file"], [type="color"]),
    select, textarea
  ) {
    background-color: var(--pwa-field) !important;
    border-color: var(--pwa-control-line) !important;
    border-radius: var(--pwa-control-radius);
    color: var(--pwa-ink) !important;
  }

  body.workspace-unified.mw-enabled #modal-root .workspace-business-sheet:not(.production-print-preview)
    .modal-content :is(input, textarea)::placeholder {
    color: var(--pwa-muted);
    opacity: 1;
  }

  body.workspace-unified.mw-enabled #modal-root .workspace-business-sheet:not(.production-print-preview)
    .modal-content input:is([type="checkbox"], [type="radio"]) {
    accent-color: var(--pwa-accent);
  }

  body.workspace-unified.mw-enabled #modal-root .workspace-business-sheet:not(.production-print-preview)
    .modal-content :is(input, select, textarea)[aria-invalid="true"] {
    border-color: var(--pwa-notice-danger) !important;
  }

  body.workspace-unified.mw-enabled #modal-root .workspace-business-sheet:not(.production-print-preview) :is(
    .modal-back, .modal-close, .button.secondary, .button.ghost
  ):not(.danger, .cc-danger-button) {
    background: var(--pwa-well) !important;
    border-color: var(--pwa-line) !important;
    border-radius: var(--pwa-control-radius);
    color: var(--pwa-ink) !important;
  }

  body.workspace-unified.mw-enabled #modal-root .workspace-business-sheet:not(.production-print-preview)
    :is(.modal-back, .modal-close) {
    min-width: 44px;
    min-height: 44px;
  }

  body.workspace-unified.mw-enabled #modal-root .workspace-business-sheet:not(.production-print-preview)
    .modal-footer > .button:not(.secondary, .ghost, .danger, .cc-danger-button) {
    background: var(--pwa-action) !important;
    border-color: transparent !important;
    border-radius: var(--pwa-control-radius);
    color: var(--pwa-action-ink) !important;
  }

  body.workspace-unified.mw-enabled #modal-root .workspace-business-sheet:not(.production-print-preview)
    :is(.modal-back, .modal-close, button, input, textarea, select):focus-visible {
    outline: 2px solid var(--pwa-focus);
    outline-offset: 2px;
  }

  body.workspace-unified.mw-enabled #modal-root .workspace-business-sheet:not(.production-print-preview) .crm-autocomplete-options {
    background: var(--pwa-surface);
    border-color: var(--pwa-control-line);
    color: var(--pwa-ink);
    box-shadow: var(--pwa-depth);
  }

  body.workspace-unified.mw-enabled #modal-root .workspace-business-sheet:not(.production-print-preview)
    .crm-autocomplete-options button {
    color: var(--pwa-ink);
  }

  body.workspace-unified.mw-enabled #modal-root .workspace-business-sheet:not(.production-print-preview)
    .crm-autocomplete-options button small {
    color: var(--pwa-muted);
  }

  body.workspace-unified.mw-enabled #modal-root .workspace-business-sheet:not(.production-print-preview)
    .crm-autocomplete-options button:is(:hover, [aria-selected="true"]) {
    background: var(--pwa-selected);
    color: var(--pwa-ink);
  }

  /* Keep native pickers while giving the closed control the same touch area in WebKit. */
  body.workspace-unified.mw-enabled #modal-root .workspace-business-sheet:not(.production-print-preview)
    .modal-content select:not([multiple], [size]) {
    -webkit-appearance: none;
    appearance: none;
    min-height: 46px;
    padding-inline-end: 32px;
    background-image:
      linear-gradient(45deg, transparent 50%, var(--pwa-muted) 50%),
      linear-gradient(135deg, var(--pwa-muted) 50%, transparent 50%) !important;
    background-position: right 17px center, right 12px center !important;
    background-repeat: no-repeat !important;
    background-size: 5px 5px !important;
  }

  @media (forced-colors: active) {
    body.workspace-unified.mw-enabled #modal-root .workspace-business-sheet:not(.production-print-preview)
      .modal-content select:not([multiple], [size]) {
      -webkit-appearance: auto;
      appearance: auto;
      background-image: none !important;
    }
  }

  body.workspace-unified.mw-enabled .workspace-discard-dialog {
    background: var(--pwa-surface);
    border-color: var(--pwa-line);
    border-radius: var(--pwa-card-radius);
    color: var(--pwa-ink);
    box-shadow: var(--pwa-depth);
  }

  body.workspace-unified.mw-enabled .workspace-discard-dialog::backdrop {
    background: var(--pwa-overlay);
  }

  body.workspace-unified.mw-enabled .workspace-discard-dialog p {
    color: var(--pwa-muted);
  }

  body.workspace-unified.mw-enabled .workspace-discard-dialog button:not([data-discard]) {
    background: var(--pwa-well);
    border-color: var(--pwa-line);
    border-radius: var(--pwa-control-radius);
    color: var(--pwa-ink);
  }

  body.workspace-unified.mw-enabled .workspace-discard-dialog button[data-discard] {
    background: var(--pwa-action);
    border-color: transparent;
    border-radius: var(--pwa-control-radius);
    color: var(--pwa-action-ink);
  }

  @supports (corner-shape: squircle) {
    body.workspace-unified.mw-enabled #modal-root .workspace-business-sheet:not(.production-print-preview) {
      corner-shape: squircle;
    }
  }
}
