/* EquipDesk action buttons, approved design 9. The shared right navigation
   is excluded before applying any styles, including on mobile. */
@layer equipdesk-action-buttons {
  @media screen and (not (forced-colors: active)) {
    :where(button, input:is([type=submit], [type=reset], [type=button]),
        a:is([role=button], .btn, .button, .ui-button, .wf-button, .docs-btn,
          .sg-button, .mes-button, .sd-button, .op-button, .th6-btn, .th4-btn,
          .partner-btn, .partner-btn-outline, .ed-files-button, .part-button,
          .public-button, .s31-button, .warranty-button, .wl-open-action,
          .ops-btn, .settings-button, .addlink, .changelink, .deletelink),
        .ed-inbox-pop a,
        summary:is([role=button], .ed-files-button), .book .sheet summary, .book .sheet a.add):not(:where(
          .ui-navigation, .ui-navigation *, .th6-menu, .th6-menu *,
          #nav-sidebar, #nav-sidebar *, #toggle-nav-sidebar, .ed-alert-close)) {
      --ed-button-v9-glow: transparent;
      --ed-button-v9-glow-middle: transparent;
      --ed-button-v9-depth: 0 3px 5px #284d7638;
      --ed-button-v9-blue: linear-gradient(180deg, #d6e8f7, #b7d1e6);
      color: #102340 !important;
      font-family: "Segoe UI", Arial, sans-serif !important;
      font-weight: 700 !important;
      background:
        radial-gradient(ellipse at 50% 52%, var(--ed-button-v9-glow) 0%,
          var(--ed-button-v9-glow-middle) 36%, transparent 78%),
        var(--ed-button-v9-blue) !important;
      border-color: #6f99bc !important;
      border-radius: 999px !important;
      box-shadow: inset 0 0 0 1px #f5fbff, inset 0 0 0 3px #90b2ce,
        var(--ed-button-v9-depth) !important;
      text-shadow: none !important;
      text-decoration: none !important;
      filter: none !important;

      &:not(:disabled, [aria-disabled=true]) {
        @media (hover: hover) {
          &:hover {
            --ed-button-v9-glow: #feeacc;
            --ed-button-v9-glow-middle: #f4dbb8d8;
          }
        }
        &:active {
          --ed-button-v9-glow: #ffd691;
          --ed-button-v9-glow-middle: #fedfaf;
          --ed-button-v9-depth: inset 0 4px 7px #23487366, 0 1px 2px #284d7626;
          translate: 0 1px;
        }
        &:focus-visible {
          outline: 2px solid #315a8a !important;
          outline-offset: 2px !important;
        }
      }

      &:is(:disabled, [aria-disabled=true]) {
        --ed-button-v9-blue: linear-gradient(180deg, #e9eef3, #d5dee6);
        --ed-button-v9-depth: 0 1px 2px #284d7626;
        color: #526278 !important;
      }
    }

    /* Equal tracks are based on the longest label, not on the text length
       of each individual action. Only rows made entirely of actions qualify. */
    :where(p, div, section, header, footer, form, nav):not(:where(
      .ui-navigation, .ui-navigation *, .th6-menu, .th6-menu *,
      #nav-sidebar, #nav-sidebar *, .ed-files-tools, .ed-files-heading-actions,
      .pm-folders, .ed-alert-actions, [data-ed-alert-options]
    )):has(> :nth-child(2 of :is(
      button:not([aria-label]), input:is([type=submit], [type=reset], [type=button]),
      a:is(.btn, .button, .ui-button, .wf-button, .docs-btn, .sg-button, .mes-button,
        .sd-button, .op-button, .th6-btn, .th4-btn, .partner-btn, .partner-btn-outline,
        .ed-files-button, .part-button, .public-button, .s31-button, .warranty-button)
    ):not([hidden], [aria-label]))):not(:has(> :not(:is(
      button:not([aria-label]), input:is([type=submit], [type=reset], [type=button]),
      a:is(.btn, .button, .ui-button, .wf-button, .docs-btn, .sg-button, .mes-button,
        .sd-button, .op-button, .th6-btn, .th4-btn, .partner-btn, .partner-btn-outline,
        .ed-files-button, .part-button, .public-button, .s31-button, .warranty-button),
      [hidden], script, template, input[type=hidden]
    )))) {
      display: grid !important;
      grid-auto-flow: column;
      grid-auto-columns: minmax(max-content, 1fr);
      align-items: stretch;
      gap: .4rem;
      inline-size: max-content;
      max-inline-size: 100%;
      overflow-x: auto;
      padding-block: 3px 5px;

      @media (max-width: 740px) {
        grid-auto-flow: row;
        grid-auto-columns: auto;
        grid-auto-rows: 1fr;
        grid-template-columns: minmax(max-content, 1fr);
      }

      & > :is(button, a, input):not([hidden], input[type=hidden]) {
        display: flex;
        align-items: center;
        justify-content: center !important;
        text-align: center !important;
        white-space: nowrap !important;
        inline-size: auto !important;
        max-inline-size: none !important;
        margin: 0 !important;
        align-self: stretch !important;
      }
    }

    .pm-client .pm-folders > .pm-folder[aria-current=page] {
      --ed-button-v9-blue: linear-gradient(180deg, #c8e0f5, #a7c7e5);
      border-color: #507b9f !important;
    }

    /* The file selection toolbar mixes action links, a form and its caption. */
    .ed-files-tools :is(a[data-open], a[data-download], a[data-details], form[data-remove] button) {
      box-sizing: border-box;
      inline-size: 7rem;
      justify-content: center;
      text-align: center;
      white-space: nowrap;
    }
  }
}

/* Folders are navigation, including when the rail moves above mail on mobile. */
.pm-client .pm-client-rail .pm-folders {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: visible;
}

.pm-client .pm-folders .pm-folder > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
