/* Hide scrollbar chrome throughout CRM while preserving native scrolling. */
html:is([data-trello-native], [data-crm-mac-palette], .crm-content-embedded, .crm-purchases-embedded, .crm-wholesale-embedded, .crm-tasks-starting, :has(body.is-crm-view-active)),
html:is([data-trello-native], [data-crm-mac-palette], .crm-content-embedded, .crm-purchases-embedded, .crm-wholesale-embedded, .crm-tasks-starting, :has(body.is-crm-view-active)) * {
  scrollbar-width: none !important;
  scrollbar-gutter: auto !important;
}

html:is([data-trello-native], [data-crm-mac-palette], .crm-content-embedded, .crm-purchases-embedded, .crm-wholesale-embedded, .crm-tasks-starting, :has(body.is-crm-view-active))::-webkit-scrollbar,
html:is([data-trello-native], [data-crm-mac-palette], .crm-content-embedded, .crm-purchases-embedded, .crm-wholesale-embedded, .crm-tasks-starting, :has(body.is-crm-view-active)) *::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

/* Neutral switches in the dark CRM design system. */
html:is([data-trello-native], [data-crm-mac-palette], .crm-content-embedded) {
  --crm-palette-switch-off-track: #303236;
  --crm-palette-switch-off-border: #777777;
  --crm-palette-switch-off-thumb: #afafaf;
  --crm-palette-switch-on-track: #4b4e53;
  --crm-palette-switch-on-border: #777c84;
  --crm-palette-switch-on-thumb: #e1e2e5;
}

html:is([data-trello-native], .crm-content-embedded) {
  --crm-profile-avatar-size: 33.6px;
}

html:is(.crm-content-embedded, .crm-purchases-embedded) {
  --crm-section-menu-row-height: 55px;
}

/* Shared by the CRM shell and its embedded Mac views. */
html:is([data-trello-native], [data-crm-mac-palette]),
html.crm-purchases-embedded {
  --crm-palette-workspace: #18191c;
  --crm-palette-selection: #383a3d;
  --crm-palette-active-heading: #2c2e31;
  --crm-palette-text: #cdcdcd;
  --crm-palette-lime: #d6fa55;
  --crm-palette-status-working: #63e9ee;
  --crm-palette-status-shipped: #f48bcb;
  --crm-palette-error: #ff8585;
}

html:is([data-trello-native], [data-crm-mac-palette]) {
  --crm-palette-header: #242528;
  --crm-palette-panel: #1c1d20;
  --crm-palette-prices-stock: #202225;
  --crm-palette-divider: color-mix(in srgb, var(--crm-palette-selection) 40%, transparent);
  --crm-retail-content-surface: #1c1c20;
  --crm-retail-orders-background: #1c1c20;
  --crm-retail-row-divider: color-mix(in srgb, var(--crm-palette-selection) 20%, transparent);
  --crm-palette-subtle-divider: var(--crm-palette-divider);
  --crm-palette-hover: color-mix(in srgb, var(--crm-palette-selection) 45%, transparent);
  --crm-palette-muted: #afafaf;
  --crm-palette-spec-label: #909090;
  --crm-palette-secondary: #cdcdcd;
  --crm-palette-purple: #7542d9;
  --crm-palette-status-completed: #d1d2d5;
  --crm-palette-status-cancelled: #484a50;
  --crm-palette-paid: var(--crm-palette-status-shipped);
  --purple: var(--crm-palette-purple);
  --purple-dark: var(--crm-palette-purple);
  --green: var(--crm-palette-lime);
  --green-dark: var(--crm-palette-lime);
  color-scheme: dark;
}

html:root[data-trello-native],
html:root[data-trello-native] body {
  background: var(--crm-palette-header) !important;
}

html:root[data-trello-native] body.is-crm-view-active
  :is(.topbar, .topbar-search, .topbar-search input, .topbar-search-icon) {
  background: var(--crm-palette-header) !important;
}

@media (min-width: 901px) {
  html[data-trello-native] body.is-crm-view-active {
    --crm-primary-rail-width: 84px;
    --crm-right-rail-width: calc(var(--crm-primary-rail-width) / 9);
  }

  html[data-trello-native] body.is-crm-view-active #roomView.crm-menu-collapsed > .room-page {
    --crm-right-rail-footer: 0px;
    position: relative;
    padding-inline-end: var(--crm-right-rail-width);
    background-color: var(--crm-palette-header);
  }

  html[data-trello-native] body.is-crm-view-active #roomView.crm-menu-collapsed > .room-page:has(
    .room-main-page:not(.is-hidden) :is(.crm-orders-footer, .crm-accounting-footer, .crm-content-footer, .crm-clients-footer)) {
    --crm-right-rail-footer: var(--crm-sidebar-toggle-height);
  }

  /* The Content footer lives inside an iframe, outside the shell selectors. */
  html[data-trello-native] body.is-crm-view-active #roomView.crm-menu-collapsed > .room-page:has(
    .crm-content-page:not(.is-hidden) .crm-content-has-catalog-footer) {
    --crm-right-rail-footer: var(--crm-shell-bar-height, 55px);
  }

  html[data-trello-native] body.is-crm-view-active #roomView.crm-menu-collapsed > .room-page::after {
    content: "";
    position: absolute;
    z-index: 6;
    pointer-events: none;
    inset: 0 0 0 auto;
    width: calc(var(--crm-right-rail-width) + var(--crm-shell-joint-radius, 12px));
    --crm-right-joint: var(--crm-shell-joint-radius, 12px);
    background:
      radial-gradient(circle at bottom left,
        transparent calc(var(--crm-right-joint) - .5px),
        var(--crm-palette-header) calc(var(--crm-right-joint) + .5px))
        left top / var(--crm-right-joint) var(--crm-right-joint) no-repeat,
      radial-gradient(circle at top left,
        transparent calc(var(--crm-right-joint) - .5px),
        var(--crm-palette-header) calc(var(--crm-right-joint) + .5px))
        left bottom var(--crm-right-rail-footer) / var(--crm-right-joint) var(--crm-right-joint) no-repeat;
  }

  html:root[data-trello-native] body.is-crm-view-active:has(#roomView:not(.is-hidden) .room-sidebar:not([hidden])) {
    --crm-shell-joint-radius: 12px;
  }

  html:root[data-trello-native] body.is-crm-view-active:has(#roomView:not(.is-hidden) .room-sidebar:not([hidden]))
    .app-shell > .topbar {
    border-bottom-color: transparent !important;
  }

  html:root[data-trello-native] body.is-crm-view-active #roomView:not(.is-hidden) .room-page > .room-sidebar {
    background-color: var(--crm-palette-header) !important;
    border-inline-end-color: transparent;
  }

  html:root[data-trello-native] body.is-crm-view-active #roomView:not(.is-hidden)
    .room-page > :is(.room-sidebar:not([hidden]) + .crm-retail-menu:not([hidden]),
    .room-sidebar:not([hidden]) + .crm-retail-menu[hidden] + .room-main) {
    position: relative;
  }

  html:root[data-trello-native] body.is-crm-view-active #roomView:not(.is-hidden)
    .room-page > :is(.room-sidebar:not([hidden]) + .crm-retail-menu:not([hidden]),
    .room-sidebar:not([hidden]) + .crm-retail-menu[hidden] + .room-main)::before {
    content: "";
    position: absolute;
    z-index: 2;
    pointer-events: none;
    inset: 0 auto auto 0;
    width: var(--crm-shell-joint-radius);
    height: var(--crm-shell-joint-radius);
    background: radial-gradient(circle at bottom right,
      transparent calc(var(--crm-shell-joint-radius) - 0.5px),
      var(--crm-palette-header) calc(var(--crm-shell-joint-radius) + 0.5px));
  }

  html:root[data-trello-native] body.is-crm-view-active:not(.is-crm-settings-active) #roomView:not(.is-hidden)
    .room-page > :is(.room-sidebar:not([hidden]) + .crm-retail-menu:not([hidden]),
    .room-sidebar:not([hidden]) + .crm-retail-menu[hidden] + .room-main)::after {
    content: "";
    position: absolute;
    z-index: 2;
    pointer-events: none;
    inset: auto auto var(--crm-sidebar-toggle-height) 0;
    width: var(--crm-shell-joint-radius);
    height: var(--crm-shell-joint-radius);
    background: radial-gradient(circle at top right,
      transparent calc(var(--crm-shell-joint-radius) - 0.5px),
      var(--crm-palette-header) calc(var(--crm-shell-joint-radius) + 0.5px));
  }

  html:root[data-trello-native] body.is-crm-view-active:not(.is-crm-settings-active) #roomView:not(.is-hidden)
    .room-page > .room-sidebar:not([hidden]) + .crm-retail-menu[hidden] + .room-main:has(
      .crm-purchases-page:not(.is-hidden),
      .crm-content-page:not(.is-hidden)
    )::after {
    inset-block-end: 0;
  }

  html:root[data-trello-native] body.is-crm-view-active #roomView .room-sidebar #crm-native-connection {
    background: var(--crm-palette-header) !important;
  }
}

html[data-trello-native] body.is-crm-view-active
  :is(.app-main, #roomView .room-main, .crm-workspace, .crm-order-page, .crm-order-page-root) {
  background-color: var(--crm-palette-workspace);
  color: var(--crm-palette-text);
}

html:root[data-trello-native] body.is-crm-view-active
  :is(.room-orders-table-head, #crm-native-connection) {
  background: var(--crm-palette-panel) !important;
}

html[data-trello-native] body.is-crm-view-active
  :is(.crm-orders-footer, .room-order-status-control, .crm-order-page) {
  --crm-control-hover: var(--crm-palette-hover);
}

html[data-trello-native] body.is-crm-view-active .crm-orders-footer .crm-orders-tabs button[aria-pressed="true"] {
  background: var(--crm-palette-selection);
  border-color: var(--crm-palette-divider);
}

html[data-crm-mac-palette]:is(.crm-content-embedded, .crm-wholesale-embedded, .crm-tasks-starting, .crm-purchases-embedded),
html[data-crm-mac-palette] :is(.app-shell, .app-main, .app, #catalogView, #kanbanView) {
  background-color: var(--crm-palette-workspace);
  color: var(--crm-palette-text);
}

/* Keep the canvas exposed by elastic scrolling in the same dark palette. */
html[data-crm-mac-palette]:is(.crm-content-embedded, .crm-wholesale-embedded, .crm-purchases-embedded),
html[data-crm-mac-palette]:is(.crm-content-embedded, .crm-wholesale-embedded, .crm-purchases-embedded) body,
html[data-trello-native] body.is-crm-view-active :is(.crm-content-page, .crm-wholesale-page, .crm-purchases-page) {
  background: var(--crm-palette-workspace) !important;
  color-scheme: dark;
}

html[data-crm-mac-palette].crm-purchases-embedded {
  background-color: var(--crm-palette-workspace) !important;
  --ink: var(--crm-palette-text);
  --muted: var(--crm-palette-muted);
  --surface: var(--crm-palette-workspace);
  --line: var(--crm-palette-subtle-divider);
}

html[data-crm-mac-palette].crm-purchases-embedded :is(.app, .table-wrap, .table-panel, .table-scroll tbody td, .sticky-table-head) {
  background-color: var(--crm-retail-content-surface);
  color: var(--crm-palette-text);
}

html[data-crm-mac-palette].crm-purchases-embedded :is(.section-menu, .filter-fields, .filter-bar) {
  background-color: var(--crm-palette-panel);
}

html[data-crm-mac-palette].crm-purchases-embedded :is(button, select, input):focus-visible {
  outline: 2px solid var(--crm-palette-text);
  outline-offset: -2px;
}

html[data-crm-mac-palette].crm-purchases-embedded
  :is(.table-scroll, .sticky-table-head) :is(.column-sort[aria-pressed="true"], th[data-supplier-index="0"] .column-sort, .sticky-supplier-heading button) {
  color: var(--crm-palette-text);
}

html[data-trello-native] #authModal.auth-modal {
  color: var(--crm-palette-text);
}

html:root[data-trello-native] body #authModal :is(.auth-field input, .auth-submit) {
  background: var(--crm-palette-panel) !important;
  color: var(--crm-palette-text) !important;
}

html:root[data-trello-native] body #authModal .auth-submit:hover {
  background: var(--crm-palette-selection) !important;
}

html:root[data-trello-native] body #authModal .auth-field input::placeholder {
  color: var(--crm-palette-muted) !important;
  -webkit-text-fill-color: var(--crm-palette-muted) !important;
}

html[data-trello-native] body.is-crm-view-active #roomView
  :is(.room-nav button, #crmRetailNav > button).is-active {
  background: var(--crm-palette-selection);
  color: var(--crm-palette-text);
}

html[data-trello-native] body.is-crm-view-active #roomView
  #crmRetailNav > button:not(.is-active):hover {
  background: var(--crm-palette-hover);
}

html:is([data-trello-native], [data-crm-mac-palette]) .crm-order-comments-column {
  background: var(--crm-palette-panel);
}

html:root[data-trello-native] body.is-crm-view-active #roomView
  :is(.crm-orders-footer, .crm-accounting-footer, .crm-suppliers-list-footer,
      .crm-supplier-create-footer, .crm-content-footer, .crm-category-menu-footer,
      #crmSidebarToggle, #crmRetailToggle) {
  background-color: var(--crm-palette-header) !important;
  border-color: transparent !important;
}

html:root[data-trello-native] body.is-crm-view-active #roomView
  :is(#crmSidebarToggle, #crmRetailToggle):is(:hover, :focus-visible) {
  background-color: var(--crm-palette-hover) !important;
}

/* On Mac this rail stays compact. Its bottom row opens CRM settings. */
html[data-trello-native] body.is-crm-view-active #roomView #crmSidebarToggle {
  display: none;
}

html[data-trello-native] body.is-crm-view-active #roomView .room-sidebar > .topbar-settings {
  position: absolute;
  inset: auto 0 var(--crm-sidebar-toggle-height);
  z-index: 1;
  display: grid;
  min-height: 0;
  height: var(--crm-sidebar-toggle-height);
  align-items: stretch;
  margin: 0;
  background: var(--crm-palette-header);
}

html[data-trello-native] body.is-crm-view-active #roomView .room-sidebar #settingsMenuButton {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--crm-palette-secondary);
}

html[data-trello-native] body.is-crm-view-active #roomView .room-sidebar #settingsMenuButton:is(:hover, :focus-visible) {
  background: var(--crm-palette-hover);
  color: var(--crm-palette-text);
  outline-offset: -2px;
}

html[data-trello-native] body.is-crm-view-active #roomView .room-sidebar #settingsMenuButton svg {
  width: 21px;
  height: 21px;
}

html[data-trello-native] body.is-crm-view-active #roomView .room-sidebar
  :is(#crm-native-connection, .crm-purchases-refresh) {
  border-top-color: transparent !important;
}

/* Hide the marker column divider in the table heading. */
html[data-trello-native] body.is-crm-view-active #roomView.is-crm-retail-open
  .room-orders-table-head::after {
  content: none;
}

/* Match the desktop header to the visible CRM footer. */
@media (min-width: 901px) {
  html:root[data-trello-native] body.is-crm-view-active .app-shell > .topbar {
    --crm-header-control-height: min(42px, calc(var(--crm-shell-bar-height, 49px) - 6px));
    box-sizing: border-box;
    height: var(--crm-shell-bar-height, 49px);
    min-height: var(--crm-shell-bar-height, 49px);
    padding-block: 0;
    align-items: center;
  }

  html:root[data-trello-native] body.is-crm-view-active .topbar
    :is(.topbar-search input, .crm-task-search input) {
    box-sizing: border-box;
    height: var(--crm-header-control-height);
    min-height: 0;
    padding-block: 0;
  }

  html:root[data-trello-native] body.is-crm-view-active .topbar
    :is(.topbar-search-icon, .topbar-actions button, .topbar-user-avatar, #catalogOpenButton) {
    min-height: 0;
    max-height: var(--crm-header-control-height);
  }

  html:root[data-trello-native] body.is-crm-view-active .topbar .topbar-user-avatar {
    width: var(--crm-header-control-height);
    height: var(--crm-header-control-height);
  }
}

html[data-trello-native] body.is-crm-view-active #roomView .room-sidebar > #authOpenButton {
  position: absolute;
  inset: auto 0 0;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 100%;
  height: var(--crm-sidebar-toggle-height);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--crm-palette-header);
  box-shadow: none;
}

html[data-trello-native] body.is-crm-view-active #roomView .room-sidebar > #authOpenButton:focus-visible {
  outline-offset: -2px;
}

html[data-trello-native] body.is-crm-view-active #roomView #authOpenButton .topbar-user-avatar {
  box-sizing: border-box;
  width: var(--crm-profile-avatar-size);
  height: var(--crm-profile-avatar-size);
  border: 1px solid var(--crm-palette-selection);
  font-size: 17.6px;
}

@media (width < 901px) {
  html[data-trello-native] body.is-crm-view-active #roomView.crm-menu-collapsed .room-sidebar:has(> #authOpenButton)
    #crm-native-connection {
    margin-bottom: calc(2 * var(--crm-sidebar-toggle-height));
  }
}

html[data-trello-native] body:is(.is-crm-view-active, .is-crm-settings-active)
  .topbar :is(#catalogOpenButton, #frontPanelButton, #crm-table-heading-toggle) {
  display: none !important;
}

/* Anchor the shared sidebar controls to the window across CRM sections. */
@media (min-width: 901px) {
  html:root[data-trello-native] body.is-crm-view-active #roomView:not(.is-hidden) .room-sidebar > .room-nav {
    max-height: calc(100dvh - var(--crm-shell-bar-height, 49px) - 3 * var(--crm-sidebar-toggle-height));
  }

  html:root[data-trello-native] body.is-crm-view-active #roomView:not(.is-hidden) .room-sidebar
    > :is(#authOpenButton, .topbar-settings, #crm-native-connection, .crm-purchases-refresh) {
    position: fixed;
    inset: auto auto calc(var(--crm-rail-row, 0) * var(--crm-sidebar-toggle-height)) 0;
    width: var(--crm-primary-rail-width, 84px);
    height: var(--crm-sidebar-toggle-height);
    box-sizing: border-box;
    margin: 0;
    z-index: 7;
    background: var(--crm-palette-header) !important;
  }

  html[data-trello-native] #roomView .room-sidebar > .topbar-settings {
    --crm-rail-row: 1;
  }

  html[data-trello-native] #roomView .room-sidebar > :is(#crm-native-connection, .crm-purchases-refresh) {
    --crm-rail-row: 2;
    padding: 0;
    justify-content: center;
  }
}

html:is([data-trello-native], [data-crm-mac-palette])
  :is(.crm-orders-footer, .crm-order-dates-footer, .crm-accounting-footer, .crm-content-footer,
      .crm-wholesale-footer, .crm-suppliers-list-footer, .crm-supplier-create-footer,
      .crm-shift-footer, .crm-shift-submit-footer) {
  background: var(--crm-palette-header) !important;
}

html[data-trello-native] .crm-purchases-refresh > button {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 0;
  color: inherit;
}
html[data-trello-native] .crm-purchases-refresh > button:enabled:hover {
  background: transparent;
  color: var(--crm-palette-text);
}
html[data-trello-native] .crm-purchases-refresh > button svg {
  width: 21px;
  height: 21px;
}
html[data-trello-native] .crm-purchases-refresh > button.uses-native-refresh-icon svg {
  stroke: none;
}
html[data-trello-native] .crm-purchases-refresh .refresh-copy {
  display: none;
}

/* All CRM header searches share the Retail anchor. */
html:root[data-trello-native] body.is-crm-view-active:has(#roomView)
  .topbar :is(#crmOrderSearch, #crmPurchaseSearch, #crmContentSearch, #crmCategorySearch) {
  border: 0;
  box-shadow: none;
}

@media (min-width: 901px) {
  html:root[data-trello-native] body.is-crm-view-active:has(#roomView) {
    --crm-order-search-start: calc(var(--crm-primary-rail-width) + clamp(140px, (100vw - var(--crm-right-rail-width)) * 0.19, 280px));
  }

  /* Keep the Retail anchor when switching sections or collapsing their menus. */
  html:root[data-trello-native] body.is-crm-view-active:has(#roomView)
    .topbar > .topbar-search {
    --crm-order-search-inset: calc(var(--crm-order-search-start) + (51px - var(--crm-search-icon-size, 20px)) / 2);
    position: absolute;
    grid-area: auto;
    inset: 50% auto auto var(--crm-order-search-inset);
    width: min(640px, calc(100% - var(--crm-order-search-inset) - 245px));
    min-width: 0;
    transform: translateY(-50%);
  }

  html:root[data-trello-native] body.is-crm-view-active:has(#roomView)
    .topbar > .topbar-search > .topbar-search-icon {
    left: 0;
    width: var(--crm-search-icon-size, 20px);
  }

  html:root[data-trello-native] body.is-crm-view-active:has(#roomView)
    .topbar :is(#crmOrderSearch, #crmPurchaseSearch, #crmContentSearch, #crmCategorySearch) {
    /* The search glyph ends at x=20.68 in its 24-unit viewBox. */
    padding-inline-start: calc(var(--crm-search-icon-size, 20px) * 0.862 + 1em);
  }
}

html:root[data-trello-native] body.is-crm-view-active #roomView .room-sidebar
  :is(#roomNav > button, #crm-native-connection button, #settingsMenuButton, #crmSidebarToggle):hover:not(:focus-visible) {
  background: transparent !important;
}

html:root[data-trello-native] body.is-crm-view-active #roomView
  :is(#roomNav > button, #crm-native-connection button, #settingsMenuButton, #crmRetailNav > button):enabled:hover {
  color: var(--crm-palette-text);
}

html:root[data-trello-native] body.is-crm-view-active #roomView #crmRetailNav > button:enabled:hover:not(.is-active) {
  background: transparent;
}

/* Retail navigation and order table text. */
html[data-trello-native] body.is-crm-view-active #roomView #crmRetailNav > button:not(.is-active) {
  color: var(--crm-palette-muted);
}

html[data-trello-native] body.is-crm-view-active #roomView #crmRetailNav > button.is-active {
  color: var(--crm-palette-text);
}

html[data-trello-native] body.is-crm-view-active #roomView.is-crm-retail-open .room-order-card-row
  > .room-order-card-cell:not(.is-fully-paid, :focus-within),
html[data-trello-native] body.is-crm-view-active #roomView.is-crm-retail-open .room-order-card-row
  > :is(.room-order-items-toggle, .crm-preorder-date-trigger):not(:focus-within) > span {
  color: #c9c9ca;
}

html[data-trello-native] body.is-crm-view-active #roomView #crmRetailToggle:not(:hover, :focus-visible) {
  color: var(--crm-palette-muted);
}

html:root[data-trello-native] body.is-crm-view-active #roomView .room-page > .room-main {
  background-color: var(--crm-palette-workspace) !important;
}

html:root[data-trello-native] body.is-crm-view-active #roomView
  .room-page > .room-main:has(> .crm-purchases-page:not(.is-hidden)) {
  background-color: var(--crm-palette-header) !important;
}

html[data-trello-native] body.is-crm-view-active #roomView.is-crm-retail-open .room-order-card {
  --crm-divider-color: var(--crm-retail-row-divider);
}

html:root[data-trello-native] body.is-crm-view-active #roomView.is-crm-retail-open
  .room-page:has(> #crmRetailMenu:not([hidden])) .room-order-card {
  --crm-retail-order-surface: var(--crm-retail-content-surface);
  background-color: var(--crm-retail-order-surface) !important;
}

html:root[data-trello-native] body.is-crm-view-active #roomView
  .room-page:has(> #crmRetailMenu:not([hidden]))
  .room-order-card:is(:focus-visible, :has(.room-order-items-accordion.is-open)),
html:root[data-trello-native] body.is-crm-view-active #roomView:not(.is-retail-order-keyboard)
  .room-page:has(> #crmRetailMenu:not([hidden])) .room-order-card:hover {
  --crm-retail-order-surface: var(--crm-table-row-hover);
}

html[data-trello-native] body.is-crm-view-active #roomView.is-crm-retail-open:not(.is-retail-order-keyboard) .room-order-card:hover {
  --crm-text-hover: #c9c9ca;
  --crm-text-hover-muted: var(--crm-palette-muted);
}

html[data-trello-native] body.is-crm-view-active #roomView.is-crm-retail-open .crm-order-icon:hover {
  color: var(--crm-palette-secondary) !important;
}

@media (min-width: 901px) {
  html:root[data-trello-native] body.is-crm-view-active #roomView #crmRetailMenu:not([hidden]):not(.is-dashboard-menu) {
    box-sizing: border-box;
    padding-block-end: var(--crm-sidebar-toggle-height);
    background-image: linear-gradient(to top, var(--crm-palette-header) var(--crm-sidebar-toggle-height), transparent 0);
  }

  html:root[data-trello-native] body.is-crm-view-active #roomView #crmRetailMenu #crmRetailToggle:not(:hover, :focus-visible) {
    background-color: var(--crm-menu-background, var(--crm-palette-workspace, #1c1d20)) !important;
  }
}


@media (min-width: 901px) {
  html[data-trello-native] body.is-crm-view-active #roomView #crmRetailMenu:not([hidden]) {
    border-image: linear-gradient(
      to bottom,
      var(--crm-divider-color) 0 calc(100% - var(--crm-sidebar-toggle-height)),
      transparent calc(100% - var(--crm-sidebar-toggle-height))
    ) 1;
  }
}

html[data-trello-native] body.is-crm-view-active #roomView.is-crm-retail-open
  .room-order-card-row .crm-order-assignee-avatar svg {
  color: var(--crm-palette-muted);
}

@media (min-width: 901px) {
  html[data-trello-native] body.is-crm-view-active:has(#roomView.is-crm-retail-open)
    #crmPickupButton {
    translate: -5px 0;
  }
}

html[data-trello-native] body.is-crm-view-active #roomView
  :is(#roomNav, #crmRetailNav) > button:not(.is-active, :hover, :focus-visible) > .crm-nav-icon {
  color: var(--crm-palette-muted);
}

@media (min-width: 901px) {
  html:root[data-trello-native] body.is-crm-settings-active #roomView:not(.is-hidden)
    .room-page > .room-main::after {
    content: "";
    position: absolute;
    z-index: 2;
    pointer-events: none;
    inset: auto auto 0 0;
    width: var(--crm-shell-joint-radius, 12px);
    height: var(--crm-shell-joint-radius, 12px);
    background: radial-gradient(circle at top right,
      transparent calc(var(--crm-shell-joint-radius, 12px) - 0.5px),
      var(--crm-palette-header) calc(var(--crm-shell-joint-radius, 12px) + 0.5px));
  }
}

/* Keep the workspace's lower left corner at the footer in every CRM section. */
@media (min-width: 901px) {
  html:root[data-trello-native] body.is-crm-view-active:not(.is-crm-settings-active) #roomView:not(.is-hidden)
    .room-page > :is(.room-sidebar:not([hidden]) + .crm-retail-menu:not([hidden]),
    .room-sidebar:not([hidden]) + .crm-retail-menu[hidden] + .room-main)::after {
    inset-block-end: 0;
  }

  html:root[data-trello-native] body.is-crm-view-active:not(.is-crm-settings-active) #roomView:not(.is-hidden)
    .room-page > .room-sidebar:not([hidden]) + .crm-retail-menu[hidden] + .room-main:has(
      .crm-content-page:not(.is-hidden) .crm-content-has-catalog-footer
    )::after {
    inset-block-end: var(--crm-shell-bar-height, 55px);
  }
}

/* Retail navigation extends behind the footer; round its visible workspace edge. */
@media (min-width: 901px) {
  html:root[data-trello-native] body.is-crm-view-active:not(.is-crm-settings-active) #roomView:not(.is-hidden)
    .room-page > .room-sidebar:not([hidden]) + #crmRetailMenu:not([hidden])::after {
    inset-block-end: var(--crm-sidebar-toggle-height);
  }
}

/* Settings uses the same compact active icon tile as the outer navigation. */
html:root[data-trello-native] body.is-crm-view-active.is-crm-settings-active #roomView .room-sidebar #settingsMenuButton,
html:root[data-trello-native] body.is-crm-view-active.is-crm-settings-active #roomView .room-sidebar #settingsMenuButton:hover:not(:focus-visible) {
  background: transparent !important;
  color: var(--crm-palette-text);
}
html:root[data-trello-native] body.is-crm-view-active.is-crm-settings-active #roomView .room-sidebar #settingsMenuButton > svg {
  background-color: var(--crm-palette-selection) !important;
  border-radius: 4px;
  box-shadow: 0 0 0 7px var(--crm-palette-selection) !important;
}

/* All settings navigation depths use the catalogue filter panel background. */
html:root[data-trello-native] body.is-crm-settings-active #settingsView.settings-view :is(
  .crm-settings-links,
  .settings-modal-tabs,
  .settings-catalog-category-menu,
  .settings-category-root-menu,
  .settings-values-menu,
  .settings-category-choice,
  .settings-category-choice-block
) {
  background: var(--crm-palette-panel) !important;
}

/* The task search fills the same shared header anchor. */
@media (min-width: 901px) {
  html:root[data-trello-native] body.is-crm-view-active:has(#roomView.is-crm-tasks-open) .crm-task-search-controls {
    flex: 1;
    min-width: 0;
  }
  html:root[data-trello-native] body.is-crm-view-active:has(#roomView.is-crm-tasks-open) .crm-task-search {
    flex: 1;
    min-width: 0;
    width: auto;
  }
  html:root[data-trello-native] body.is-crm-view-active:has(#roomView.is-crm-tasks-open) .topbar .crm-task-search input {
    border: 0;
    box-shadow: none;
    padding-inline-start: calc(var(--crm-search-icon-size, 20px) * 0.862 + 1em);
  }
  html:root[data-trello-native] body.is-crm-view-active:has(#roomView.is-crm-tasks-open) .topbar .crm-task-search .topbar-search-icon {
    left: 0;
    width: var(--crm-search-icon-size, 20px);
  }
}

body.is-crm-view-active:has(#roomView.is-crm-tasks-open) .crm-task-actions .crm-task-toolbar-button {
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 0;
  padding: 0;
  color: var(--crm-palette-text, #cdcdcd);
}
body.is-crm-view-active:has(#roomView.is-crm-tasks-open) .crm-task-actions .crm-task-toolbar-button[aria-pressed="true"] {
  background: var(--crm-palette-selection, #383a3d);
}
body.is-crm-view-active:has(#roomView.is-crm-tasks-open) .crm-task-actions .crm-task-toolbar-button svg {
  width: 21px;
  height: 21px;
  stroke-width: 1.7;
}

/* Keep the Tasks column filter as a plain icon, including its active state. */
body.is-crm-view-active:has(#roomView.is-crm-tasks-open) .crm-task-actions
  .crm-task-toolbar-button:is([data-task-control="kanbanColumnFilterButton"], [data-task-control="boardsOpenButton"]) {
  background: transparent;
  border: 0;
  box-shadow: none;
}

/* Column settings use the same flat dark rows as CRM forms. */
html:is([data-trello-native], [data-crm-mac-palette]) .settings-kanban-column-grid {
  gap: 0;
  color: var(--crm-palette-text);
  background: var(--crm-palette-workspace);
}
html:is([data-trello-native], [data-crm-mac-palette]) .settings-kanban-column-grid > :is(label, div) {
  max-width: none;
  width: 100%;
  padding: 16px;
  border-bottom: 1px solid var(--crm-palette-divider);
  box-sizing: border-box;
}
html:is([data-trello-native], [data-crm-mac-palette]) .settings-kanban-column-grid label > span,
html:is([data-trello-native], [data-crm-mac-palette]) .settings-kanban-width-field > span {
  font-size: 14px;
  font-weight: 400;
  color: var(--crm-palette-muted);
}
html:is([data-trello-native], [data-crm-mac-palette]) .settings-kanban-column-grid input:not([type=checkbox]):not([type=radio]):not([type=color]) {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  color: var(--crm-palette-text);
  font: 400 16px system-ui;
}
html:is([data-trello-native], [data-crm-mac-palette]) .settings-kanban-column-grid label:focus-within {
  background: var(--crm-palette-selection);
}
html:is([data-trello-native], [data-crm-mac-palette]) .settings-kanban-column-grid input:focus::placeholder { color: transparent; }
html:is([data-trello-native], [data-crm-mac-palette]) .settings-kanban-width-option {
  background: var(--crm-palette-panel);
  color: var(--crm-palette-text);
  border-color: var(--crm-palette-divider);
  border-radius: 0;
}
html:is([data-trello-native], [data-crm-mac-palette]) .settings-kanban-width-option:has(input:checked) {
  background: var(--crm-palette-selection);
}
html:is([data-trello-native], [data-crm-mac-palette]) .settings-kanban-column-grid .settings-kanban-width-option > span {
  font: 400 16px system-ui;
}
.settings-kanban-column-grid .settings-kanban-private {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: none;
}
.settings-kanban-private-copy { display: grid; gap: 6px; }
.settings-kanban-private-copy > span { color: var(--crm-palette-text, var(--ink)); font: 400 16px system-ui; }
.settings-kanban-private-copy small { color: var(--crm-palette-muted, var(--muted)); font: 400 12px system-ui; }
html:is([data-trello-native], [data-crm-mac-palette]) .settings-kanban-column-grid .settings-kanban-private {
  background: transparent;
  border-radius: 0;
  min-height: var(--crm-menu-row-height, 55px);
}
html:is([data-trello-native], [data-crm-mac-palette]) .settings-kanban-private .kanban-column-filter-switch-track {
  width: 40px;
  height: 22px;
  background: var(--crm-palette-switch-off-track);
  border-color: var(--crm-palette-switch-off-border);
  box-shadow: none;
}
html:is([data-trello-native], [data-crm-mac-palette]) .settings-kanban-private .kanban-column-filter-switch-thumb {
  width: 16px;
  height: 16px;
  background: var(--crm-palette-switch-off-thumb);
}
html:is([data-trello-native], [data-crm-mac-palette]) .settings-kanban-private input:checked + .kanban-column-filter-switch-track {
  background: var(--crm-palette-switch-on-track);
  border-color: var(--crm-palette-switch-on-border);
}
html:is([data-trello-native], [data-crm-mac-palette]) .settings-kanban-private input:checked + .kanban-column-filter-switch-track .kanban-column-filter-switch-thumb {
  transform: translateX(18px);
  background: var(--crm-palette-switch-on-thumb);
}
html:is([data-trello-native], [data-crm-mac-palette]) .settings-kanban-private input:focus-visible + .kanban-column-filter-switch-track {
  outline: 2px solid var(--crm-palette-text);
  outline-offset: 3px;
}
html:is([data-trello-native], [data-crm-mac-palette]) #settingsView:has(.settings-kanban-column-grid) .settings-modal {
  --ink: var(--crm-palette-text);
  --muted: var(--crm-palette-muted);
  background: var(--crm-palette-workspace) !important;
  border-color: var(--crm-palette-divider) !important;
  color: var(--crm-palette-text);
  font-family: system-ui;
}
html:is([data-trello-native], [data-crm-mac-palette]) #settingsView:has(.settings-kanban-column-grid) :is(.settings-modal-head, .settings-modal-tabs) {
  background: var(--crm-palette-panel) !important;
  border-color: var(--crm-palette-divider) !important;
}
html:is([data-trello-native], [data-crm-mac-palette]) #settingsView:has(.settings-kanban-column-grid) :is(.settings-section-tab, .settings-value-button, .settings-value-item) {
  color: var(--crm-palette-text);
  font-weight: 400;
}
html:is([data-trello-native], [data-crm-mac-palette]) #settingsView:has(.settings-kanban-column-grid) :is(.settings-section-tab.is-active, .settings-value-button.is-active, .settings-value-item.is-active) {
  background: var(--crm-palette-selection) !important;
  border-color: var(--crm-palette-divider) !important;
}
html:is([data-trello-native], [data-crm-mac-palette]) #settingsView:has(.settings-kanban-column-grid) :is(.settings-modal-body, .settings-modal-section, .settings-main-panel, .settings-values-menu, .settings-layout) {
  background: var(--crm-palette-workspace) !important;
  border-color: var(--crm-palette-divider) !important;
  box-shadow: none;
}
html:is([data-trello-native], [data-crm-mac-palette]) #settingsView:has(.settings-kanban-column-grid) .settings-value-item {
  border-color: var(--crm-palette-divider) !important;
  font-size: 16px;
  font-weight: 400;
  min-height: var(--crm-menu-row-height, 55px);
}
html:is([data-trello-native], [data-crm-mac-palette]) #settingsView:has(.settings-kanban-column-grid) .settings-value-item:is(.active, :hover, :focus-visible) {
  background: var(--crm-palette-selection) !important;
}
html:is([data-trello-native], [data-crm-mac-palette]) #settingsView:has(.settings-kanban-column-grid) #settingsMainTitle {
  font: 500 20px system-ui;
  color: var(--crm-palette-text);
}

/* Accounting uses the same canvas and 1px row rules as Retail orders. */
html:root[data-trello-native] body.is-crm-view-active #roomView .crm-accounting-page
  :is(.crm-receipt-products, .crm-suppliers-list) {
  background: var(--crm-retail-orders-background) !important;
}

html:root[data-trello-native] body.is-crm-view-active #roomView .crm-accounting-page
  :is(.crm-receipt-table, .crm-suppliers-list) :is(th, td) {
  border-bottom: 1px solid var(--crm-retail-row-divider);
}

/* One canvas and quiet search typography across CRM sections. */
html:is([data-trello-native], [data-crm-mac-palette]) {
  --crm-retail-content-surface: var(--crm-palette-workspace);
  --crm-workspace-font: 400 14px/1.4 system-ui, sans-serif;
}

html:root[data-trello-native] body.is-crm-view-active #roomView
  :is(.room-main, .room-main-page, .room-orders-list, .room-dealers-list,
      .crm-workspace, .crm-accounting-page, .crm-shifts-page, .dashboard-page,
      .crm-schedule-shell, .crm-content-page, .crm-wholesale-page, .crm-purchases-page),
html:root[data-crm-mac-palette].crm-wholesale-embedded
  :is(.room-main, .room-main-page, .room-orders-list, .room-dealers-list),
html:root[data-trello-native] body.is-crm-settings-active #settingsView
  :is(.settings-modal-body, .settings-modal-section, .settings-main-panel) {
  background: var(--crm-palette-workspace) !important;
}

html:is([data-trello-native], [data-crm-mac-palette]) body {
  font-family: system-ui, sans-serif;
}

html:root[data-trello-native] body.is-crm-view-active
  :is(.room-empty, .room-orders-empty, .room-dealers-empty, .crm-pickup-empty,
      .crm-accounting-empty, .crm-content-empty, .crm-shifts-empty),
html[data-crm-mac-palette].crm-wholesale-embedded
  :is(.room-empty, .room-orders-empty, .room-dealers-empty) {
  background: transparent !important;
  color: var(--crm-palette-muted);
  font: var(--crm-workspace-font);
}

/* Keep the preorder collapse row on the same surface as its menu. */
html:root[data-trello-native] body.is-crm-view-active #roomView
  :is(#crmWholesaleFirstMenu, #crmWholesaleBrandsMenu) .crm-category-menu-footer {
  background-color: var(--crm-palette-panel) !important;
}

/* Quiet shared outlines for CRM dialogs and popup menus. */
html:is([data-trello-native], [data-crm-mac-palette], .crm-content-embedded, .crm-purchases-embedded, .crm-wholesale-embedded) {
  --crm-palette-overlay-border: color-mix(in srgb, var(--crm-palette-selection, #383a3d) 40%, transparent);
}
html:is([data-trello-native], [data-crm-mac-palette], .crm-content-embedded, .crm-purchases-embedded, .crm-wholesale-embedded)
  :is(dialog, [role="dialog"], [aria-modal="true"], .crm-dropdown, [role="menu"]) {
  border: 1px solid var(--crm-palette-overlay-border) !important;
}
html:is([data-trello-native], [data-crm-mac-palette], .crm-content-embedded, .crm-purchases-embedded, .crm-wholesale-embedded)
  :is(dialog, [role="dialog"], [aria-modal="true"], .crm-dropdown, [role="menu"]):focus {
  outline: none !important;
}
html:is([data-trello-native], [data-crm-mac-palette], .crm-content-embedded, .crm-purchases-embedded, .crm-wholesale-embedded)
  :is(.crm-dropdown, [role="menu"]) > button:focus-visible {
  outline: 1px solid var(--crm-palette-overlay-border) !important;
  outline-offset: -2px;
}

/* CRM navigation, all levels. Change these roles once for every workspace.
   Embedded pages measure their own viewport; the shell subtracts its fixed rail. */
html:is([data-trello-native], [data-crm-mac-palette], .crm-content-embedded, .crm-purchases-embedded) {
  --crm-navigation-available-width: 100vw;
  --crm-navigation-width: clamp(140px, calc(var(--crm-navigation-available-width) * .19), 280px);
  --crm-navigation-collapsed-width: 84px;
  --crm-navigation-font-size: 14px;
  --crm-navigation-font-weight: 400;
  --crm-navigation-font: var(--crm-navigation-font-weight) var(--crm-navigation-font-size)/1.25 system-ui, sans-serif;
  --crm-navigation-inset: 24px;
  --crm-navigation-row-height: var(--crm-section-menu-row-height, var(--crm-menu-row-height, var(--crm-list-row-height, 55px)));
  --crm-navigation-color: var(--crm-palette-text, #cdcdcd);
  --crm-navigation-background: var(--crm-palette-panel, #1c1d20);
  --crm-navigation-selection: var(--crm-palette-selection, #383a3d);
  --crm-navigation-hover: var(--crm-palette-hover, #34363a);
  --crm-navigation-icon-size: 21px;
  --crm-navigation-arrow-size: 18px;
  --crm-navigation-footer-height: var(--crm-sidebar-toggle-height, var(--crm-menu-row-height, 55px));
}
@media (min-width: 901px) {
  html[data-trello-native]:not(.crm-content-embedded, .crm-purchases-embedded) {
    --crm-navigation-available-width: calc(100vw - 84px - 9.333333px);
  }
  html:root[data-trello-native] body.is-crm-settings-active #settingsView {
    --crm-settings-first-width: var(--crm-navigation-width);
    --crm-settings-second-width: 0px;
  }
  html:root[data-trello-native] body.is-crm-settings-active #settingsView.crm-settings-content-open {
    --crm-settings-second-width: var(--crm-navigation-width);
  }
  html:root[data-trello-native] body.is-crm-settings-active #settingsView.crm-settings-primary-menu-collapsed {
    --crm-settings-first-width: var(--crm-navigation-collapsed-width);
  }
  html:root[data-trello-native] body.is-crm-settings-active #settingsView.crm-settings-submenu-collapsed {
    --crm-settings-second-width: var(--crm-navigation-collapsed-width);
  }
  html:root[data-trello-native] body.is-crm-settings-active #settingsView .settings-modal {
    grid-template-columns: calc(var(--crm-settings-first-width) + var(--crm-settings-second-width)) minmax(0, 1fr) !important;
    border: 0 !important;
    padding: 0;
    gap: 0;
  }
  html:root[data-trello-native] body.is-crm-settings-active #settingsView .settings-modal-head > .crm-settings-links {
    flex: 0 0 var(--crm-settings-first-width);
  }
  html:root[data-trello-native] body.is-crm-settings-active #settingsView .settings-modal-head > #settingsMenuList {
    flex: 0 0 var(--crm-settings-second-width);
  }
  html:root[data-trello-native] body.is-crm-settings-active #settingsView .settings-modal-head > :is(.crm-settings-links, #settingsMenuList) {
    min-height: 0;
    overflow-y: auto;
    background: var(--crm-navigation-background) !important;
  }
  html:root[data-trello-native] body.is-crm-view-active #roomView .room-page:has(> #crmRetailMenu:not([hidden])) {
    grid-template-columns: var(--crm-primary-rail-width, 84px) var(--crm-navigation-width) minmax(0, 1fr);
  }
  html:root[data-trello-native] body.is-crm-view-active #roomView .room-page:has(> #crmRetailMenu.is-collapsed:not([hidden])) {
    grid-template-columns: var(--crm-primary-rail-width, 84px) var(--crm-navigation-collapsed-width) minmax(0, 1fr);
  }
  html:root[data-trello-native] #crmRetailMenu.is-dashboard-menu { display: grid; grid-template-rows: minmax(0, 1fr) var(--crm-navigation-footer-height); }
  html:root[data-trello-native] #crmRetailMenu.is-dashboard-menu #crmRetailToggle { display: grid; }
  html:root[data-trello-native] #crmRetailMenu.is-collapsed #crmDashboardNav .catalog-modal-card { justify-content: center; padding-inline: 0; }
  html:root[data-trello-native] #crmRetailMenu.is-collapsed #crmDashboardNav .catalog-modal-card-main { flex: 0; }
  html:root[data-trello-native] #crmRetailMenu.is-collapsed #crmDashboardNav :is(.catalog-modal-card-title, .catalog-modal-admin-link) { display: none; }
  html:root[data-trello-native] #crmRetailMenu.is-collapsed #crmDashboardNav .catalog-modal-card-icon { display: inline-flex; }
  html:root.crm-content-embedded #catalogView:has(.catalog-subcategories:not([hidden])) {
    --content-subcategory-width: var(--crm-navigation-width);
  }
  html:root.crm-content-embedded #catalogView:has(> #catalogLayout.crm-category-menu-expanded),
  html:root.crm-content-embedded.crm-purchase-card-context body #catalogView:has(> #catalogLayout.crm-category-menu-expanded) {
    --content-category-width: var(--crm-navigation-width);
  }
  html:root.crm-content-embedded #catalogView:has(> #catalogLayout.crm-subcategory-menu-collapsed) {
    --content-subcategory-width: var(--crm-navigation-collapsed-width);
  }
  html:root[data-trello-native] body.is-crm-view-active #roomView .crm-accounting-page:not(.is-hidden) {
    grid-template-columns: var(--crm-accounting-menu-width, var(--crm-navigation-width)) minmax(0, 1fr);
  }
  html:root[data-trello-native] body.is-crm-view-active #roomView .crm-wholesale-page:not(.is-hidden) {
    grid-template-columns: var(--crm-wholesale-menu-width, var(--crm-navigation-width)) minmax(0, 1fr);
  }
  html:root[data-trello-native] body.is-crm-view-active #roomView .crm-wholesale-page.crm-preorders-menu-open:not(.is-hidden) {
    grid-template-columns: var(--crm-wholesale-menu-width, var(--crm-navigation-width)) var(--crm-preorders-menu-width, var(--crm-navigation-width)) minmax(0, 1fr);
  }
  html:root.crm-purchases-embedded .layout:has(#purchase-menu-toggle[aria-expanded="true"]) {
    grid-template-columns: var(--crm-navigation-width) minmax(0, 1fr);
  }
}

/* Navigation typography is owned here, including the actual text inside rows.
   A button's font does not override a font set on its child label. Keep both
   consumers on the same role at every depth; SVG/icon geometry stays separate. */
html:root:is([data-trello-native], [data-crm-mac-palette], .crm-content-embedded, .crm-purchases-embedded) :is(
  #roomNav > button, .room-sidebar > [data-room-action="mail"],
  #mailView .mail-folder-panel :is(.mail-folder-item, .mail-sidebar-control, .mail-sidebar-label),
  .crm-settings-links > [data-crm-settings-action],
  #settingsMenuList > :is(button, a):not(.crm-menu-toggle),
  #crmRetailNav > button, #crmMarketingNav > button, #crmDashboardNav .catalog-modal-card,
  .crm-accounting-items > button, .crm-wholesale-sections > button,
  .crm-wholesale-downloads :is(summary, a, nav > [aria-disabled="true"]), .crm-wholesale-preorder-brands > button,
  #catalogLayout > :is(.catalog-sidebar, .catalog-subcategories) :is(.category-menu-item, .category-menu-group-toggle),
  #editorView .product-sidebar-categories :is(.category-menu-item, .category-menu-group-toggle),
  #purchase-filter-fields .brand-toggle, #purchase-cart-menu > .brand-toggle,
  #settingsView .settings-values-menu [data-settings-value-key],
  #settingsView .crm-deep-menu :is([data-settings-value-key], .category-menu-item, .category-menu-group-toggle),
  #crmTaskSettingsNav > button:not(.crm-menu-toggle),
  .crm-marketing-second-menu :is(.discounts-name-button, .discounts-name-input, .discounts-individual-summary, .marketing-channel-menu-button)
),
html:root:is([data-trello-native], [data-crm-mac-palette], .crm-content-embedded, .crm-purchases-embedded) :is(
  #roomNav > button, .room-sidebar > [data-room-action="mail"],
  #mailView .mail-folder-panel :is(.mail-folder-item, .mail-sidebar-control, .mail-sidebar-label),
  .crm-settings-links > [data-crm-settings-action],
  #settingsMenuList > :is(button, a):not(.crm-menu-toggle),
  #crmRetailNav > button, #crmMarketingNav > button, #crmDashboardNav .catalog-modal-card,
  .crm-accounting-items > button, .crm-wholesale-sections > button,
  .crm-wholesale-downloads :is(summary, a, nav > [aria-disabled="true"]), .crm-wholesale-preorder-brands > button,
  #catalogLayout > :is(.catalog-sidebar, .catalog-subcategories) :is(.category-menu-item, .category-menu-group-toggle),
  #editorView .product-sidebar-categories :is(.category-menu-item, .category-menu-group-toggle),
  #purchase-filter-fields .brand-toggle, #purchase-cart-menu > .brand-toggle,
  #settingsView .settings-values-menu [data-settings-value-key],
  #settingsView .crm-deep-menu :is([data-settings-value-key], .category-menu-item, .category-menu-group-toggle),
  #crmTaskSettingsNav > button:not(.crm-menu-toggle),
  .crm-marketing-second-menu :is(.discounts-name-button, .discounts-name-input, .discounts-individual-summary, .marketing-channel-menu-button)
) :is(span, small, strong, b, em, label, input):not(.settings-user-avatar, .settings-user-avatar *, [aria-hidden="true"]) {
  font: var(--crm-navigation-font) !important;
  color: var(--crm-navigation-color) !important;
  letter-spacing: normal;
  text-transform: none;
}

/* Marketing navigation must not inherit the native blue WebKit focus ring. */
html:root[data-trello-native] :is(#crmRetailNav, #crmMarketingNav) > button:focus,
html:root[data-trello-native] .crm-marketing-second-menu .marketing-channel-menu-button:focus {
  outline: none !important;
}
html:root[data-trello-native] :is(#crmRetailNav, #crmMarketingNav) > button:focus-visible,
html:root[data-trello-native] .crm-marketing-second-menu .marketing-channel-menu-button:focus-visible {
  outline: 1px solid var(--crm-navigation-color) !important;
  outline-offset: -2px;
}

/* One row style: no horizontal rules, including selected and hovered entries. */
html:is([data-trello-native], [data-crm-mac-palette], .crm-content-embedded, .crm-purchases-embedded) :is(
  .crm-settings-links > [data-crm-settings-action],
  body.is-crm-settings-active #settingsMenuList > :is(button, a):not(.crm-menu-toggle),
  #crmRetailNav > button, #crmMarketingNav > button, #crmDashboardNav .catalog-modal-card,
  .crm-accounting-items > button, .crm-wholesale-sections > button,
  .crm-wholesale-downloads summary, .crm-wholesale-preorder-brands > button,
  #catalogLayout > :is(.catalog-sidebar, .catalog-subcategories) .category-menu-item,
  #catalogLayout > .catalog-sidebar .category-menu-group-toggle,
  #purchase-filter-fields .brand-toggle, #purchase-cart-menu > .brand-toggle,
  body.is-crm-settings-active .crm-deep-menu :is([data-settings-value-key], .category-menu-item, .category-menu-group-toggle)
) {
  box-sizing: border-box;
  min-height: var(--crm-navigation-row-height);
  padding-inline: var(--crm-navigation-item-inset, var(--crm-navigation-inset)) !important;
  justify-content: var(--crm-navigation-item-align, flex-start) !important;
  border-block: 0 !important;
  border-radius: 0;
  box-shadow: none !important;
  text-decoration: none;
}
html:root[data-trello-native] body.is-crm-settings-active #settingsMenuList > :is(button, a):not(.crm-menu-toggle):not([hidden]) {
  display: flex;
  align-items: center;
  gap: 0;
  width: 100%;
  padding-inline: var(--crm-navigation-inset);
  flex: 0 0 var(--crm-menu-row-height, 55px);
  height: var(--crm-menu-row-height, 55px);
  min-height: var(--crm-menu-row-height, 55px);
}
html:root[data-trello-native] body.is-crm-settings-active #settingsMenuList > :is(button, a)::after { content: none; }
html:root[data-trello-native] #settingsView.crm-settings-submenu-collapsed #settingsMenuList > :is(button, a):not(.crm-menu-toggle) { justify-content: center; padding-inline: 0; }
html:root[data-trello-native] #settingsView.crm-settings-submenu-collapsed #settingsMenuList .crm-settings-submenu-label { display: none; }
html:root[data-trello-native] #settingsView.crm-settings-submenu-collapsed #settingsMenuList .crm-settings-submenu-icon { display: block; }
html:root[data-trello-native] #settingsView:not(.crm-settings-submenu-collapsed) #settingsMenuList .crm-settings-submenu-icon { display: none; }

/* Shared arrow footprint and hover, for both expanded and collapsed menus. */
@media (min-width: 901px) {
  html:is([data-trello-native], [data-crm-mac-palette], .crm-content-embedded, .crm-purchases-embedded) :is(
    #crmSettingsMenuToggle, #crmSettingsSubmenuToggle, #crmRetailToggle,
    .crm-category-menu-footer .crm-menu-toggle, #purchase-menu-toggle
  ):not([hidden]) {
    box-sizing: border-box;
    flex: 1 1 auto;
    width: 100% !important;
    min-width: 0; max-width: none;
    justify-self: stretch !important;
    height: var(--crm-navigation-footer-height);
    min-height: var(--crm-navigation-footer-height);
    border: 0;
    border-radius: 0;
    padding: 0 8px;
    color: var(--crm-navigation-color);
    background: var(--crm-navigation-background) !important;
  }
  html:is([data-trello-native], [data-crm-mac-palette], .crm-content-embedded, .crm-purchases-embedded) :is(
    #crmSettingsMenuToggle, #crmSettingsSubmenuToggle, #crmRetailToggle,
    .crm-category-menu-footer .crm-menu-toggle, #purchase-menu-toggle
  ):is(:hover, :focus-visible) { background: var(--crm-navigation-hover) !important; }
  html:is([data-trello-native], [data-crm-mac-palette], .crm-content-embedded, .crm-purchases-embedded) :is(
    #crmSettingsMenuToggle, #crmSettingsSubmenuToggle, #crmRetailToggle,
    .crm-category-menu-footer .crm-menu-toggle, #purchase-menu-toggle
  ) svg { width: var(--crm-navigation-arrow-size) !important; height: var(--crm-navigation-arrow-size) !important; }
}

/* Palette states are shared too; selected entries retain their color on hover. */
html:is([data-trello-native], [data-crm-mac-palette], .crm-content-embedded, .crm-purchases-embedded) :is(
  .crm-settings-links > [data-crm-settings-action],
  body.is-crm-settings-active #settingsMenuList > :is(button, a):not(.crm-menu-toggle),
  #crmRetailNav > button, #crmMarketingNav > button, #crmDashboardNav .catalog-modal-card,
  .crm-accounting-items > button, .crm-wholesale-sections > button,
  .crm-wholesale-downloads summary, .crm-wholesale-preorder-brands > button,
  #catalogLayout > :is(.catalog-sidebar, .catalog-subcategories) .category-menu-item,
  #catalogLayout > .catalog-sidebar .category-menu-group-toggle,
  #purchase-filter-fields .brand-toggle, #purchase-cart-menu > .brand-toggle,
  body.is-crm-settings-active .crm-deep-menu :is([data-settings-value-key], .category-menu-item, .category-menu-group-toggle)
) { background: transparent !important; }
html:is([data-trello-native], [data-crm-mac-palette], .crm-content-embedded, .crm-purchases-embedded) :is(
  .crm-settings-links > [data-crm-settings-action],
  body.is-crm-settings-active #settingsMenuList > :is(button, a):not(.crm-menu-toggle),
  #crmRetailNav > button, #crmMarketingNav > button, #crmDashboardNav .catalog-modal-card,
  .crm-accounting-items > button, .crm-wholesale-sections > button,
  .crm-wholesale-downloads summary, .crm-wholesale-preorder-brands > button,
  #catalogLayout > :is(.catalog-sidebar, .catalog-subcategories) .category-menu-item,
  #catalogLayout > .catalog-sidebar .category-menu-group-toggle,
  #purchase-filter-fields .brand-toggle, #purchase-cart-menu > .brand-toggle,
  body.is-crm-settings-active .crm-deep-menu :is([data-settings-value-key], .category-menu-item, .category-menu-group-toggle)
):where(:hover, :focus-visible):not(:disabled, [aria-disabled="true"]) { background: var(--crm-navigation-hover) !important; }
html:is([data-trello-native], [data-crm-mac-palette], .crm-content-embedded, .crm-purchases-embedded) :is(
  .crm-settings-links > [data-crm-settings-action],
  body.is-crm-settings-active #settingsMenuList > :is(button, a):not(.crm-menu-toggle),
  #crmRetailNav > button, #crmMarketingNav > button, #crmDashboardNav .catalog-modal-card,
  .crm-accounting-items > button, .crm-wholesale-sections > button,
  .crm-wholesale-downloads summary, .crm-wholesale-preorder-brands > button,
  #catalogLayout > :is(.catalog-sidebar, .catalog-subcategories) .category-menu-item,
  #catalogLayout > .catalog-sidebar .category-menu-group-toggle,
  #purchase-filter-fields .brand-toggle, #purchase-cart-menu > .brand-toggle,
  body.is-crm-settings-active .crm-deep-menu :is([data-settings-value-key], .category-menu-item, .category-menu-group-toggle)
):is(.active, .is-active, .is-open, [aria-selected="true"], [aria-pressed="true"], [aria-current="page"]) { background: var(--crm-navigation-selection) !important; }

@media (min-width: 901px) {
  html:root.crm-content-embedded #catalogView #catalogLayout > .catalog-sidebar:not([hidden]) {
    display: grid;
    grid-template-rows: minmax(0, 1fr) var(--crm-navigation-footer-height);
    min-height: 0;
  }
  html:root.crm-content-embedded #catalogLayout > .catalog-sidebar:first-child > .crm-category-menu-footer {
    display: block;
    grid-row: 2;
    position: relative;
  }
  html:root.crm-content-embedded #catalogView #catalogLayout:not(:has(.catalog-subcategories:not([hidden]))) {
    grid-template-columns: var(--crm-navigation-collapsed-width) minmax(0, 1fr);
  }
  html:root.crm-content-embedded #catalogView #catalogLayout.crm-category-menu-expanded:not(:has(.catalog-subcategories:not([hidden]))) {
    grid-template-columns: var(--crm-navigation-width) minmax(0, 1fr);
  }
  html:is([data-trello-native], [data-crm-mac-palette], .crm-content-embedded, .crm-purchases-embedded) :is(
    #crmSettingsMenuToggle, #crmSettingsSubmenuToggle, #crmRetailToggle,
    .crm-category-menu-footer .crm-menu-toggle, #purchase-menu-toggle
  ):not([hidden]) {
    display: grid;
    place-items: center end !important;
  }
  html:is([data-trello-native], [data-crm-mac-palette], .crm-content-embedded, .crm-purchases-embedded) :is(
    #crmSettingsMenuToggle, #crmSettingsSubmenuToggle, #crmRetailToggle,
    .crm-category-menu-footer .crm-menu-toggle, #purchase-menu-toggle
  )[aria-expanded="false"] { place-items: center !important; }
}

@media (min-width: 901px) {
  .crm-accounting-menu-collapsed { --crm-accounting-menu-width: var(--crm-navigation-collapsed-width); }
  .crm-wholesale-page.crm-wholesale-menu-collapsed { --crm-wholesale-menu-width: var(--crm-navigation-collapsed-width); }
  .crm-wholesale-page.crm-preorders-menu-collapsed { --crm-preorders-menu-width: var(--crm-navigation-collapsed-width); }
  html:root.crm-content-embedded #catalogView:has(#catalogLayout:not(.crm-category-menu-expanded)) {
    --content-category-width: var(--crm-navigation-collapsed-width);
  }
  html:is([data-trello-native], [data-crm-mac-palette], .crm-content-embedded, .crm-purchases-embedded) :is(
    #crmSettingsMenuToggle, #crmSettingsSubmenuToggle, #crmRetailToggle,
    .crm-category-menu-footer .crm-menu-toggle, #purchase-menu-toggle
  ):focus-visible { outline: 1px solid var(--crm-navigation-color); outline-offset: -2px; }
}

.crm-dashboard-icon { display: none; }
@media (min-width: 901px) {
  html:root[data-trello-native] body.is-crm-view-active #roomView #crmRetailMenu.is-dashboard-menu {
    display: grid;
    grid-template-rows: minmax(0, 1fr) var(--crm-navigation-footer-height);
    padding-bottom: 0;
  }
  html:root[data-trello-native] #crmRetailMenu.is-collapsed #crmDashboardNav .crm-dashboard-icon {
    display: block;
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
}

html:is([data-trello-native], [data-crm-mac-palette], .crm-content-embedded, .crm-purchases-embedded) :is(
  #crmRetailMenu, #crmRetailNav, #crmMarketingNav, #crmDashboardNav,
  .crm-accounting-menu, .crm-wholesale-downloads, .crm-wholesale-preorders-menu,
  #purchase-filters, #catalogLayout > .catalog-sidebar, #catalogLayout > .catalog-subcategories
) { background: var(--crm-navigation-background) !important; }

@media (min-width: 901px) {
  html:is([data-trello-native], [data-crm-mac-palette], .crm-content-embedded, .crm-purchases-embedded) :is(
    #settingsView.crm-settings-primary-menu-collapsed .crm-settings-links,
    #settingsView.crm-settings-submenu-collapsed #settingsMenuList,
    #crmRetailMenu.is-collapsed,
    .crm-accounting-menu-collapsed .crm-accounting-menu,
    .crm-wholesale-menu-collapsed .crm-wholesale-downloads,
    .crm-preorders-menu-collapsed .crm-wholesale-preorders-menu,
    #catalogLayout:not(.crm-category-menu-expanded) > .catalog-sidebar:first-child,
    #catalogLayout.crm-subcategory-menu-collapsed > .catalog-subcategories:not(.catalog-fourth-menu),
    #catalogLayout.crm-fourth-menu-collapsed > .catalog-fourth-menu,
    #purchase-filters:has(#purchase-menu-toggle[aria-expanded="false"])
  ) { --crm-navigation-item-inset: 0px; --crm-navigation-item-align: center; }
}

@media (min-width: 901px) {
  html:root[data-trello-native] :is(.crm-wholesale-downloads, .crm-wholesale-preorders-menu) > .crm-category-menu-footer {
    flex-basis: var(--crm-navigation-footer-height);
    min-height: var(--crm-navigation-footer-height);
  }
}

html:is([data-trello-native], [data-crm-mac-palette], .crm-content-embedded, .crm-purchases-embedded) :is(
  .crm-settings-nav-icon, .crm-settings-submenu-icon,
  #crmRetailNav .crm-nav-icon, #crmMarketingNav .crm-nav-icon,
  #crmDashboardNav .crm-dashboard-icon, .crm-accounting-items > button > svg,
  .crm-wholesale-menu-icon > svg, #catalogLayout .crm-subcategory-icon,
  #catalogLayout .crm-category-icon-button > svg
) {
  width: var(--crm-navigation-icon-size) !important;
  height: var(--crm-navigation-icon-size) !important;
  flex-shrink: 0;
}

/* The full bottom strip, including the space below navigation, matches the outer rail. */
@media (min-width: 901px) {
  html:root[data-trello-native] body.is-crm-view-active #roomView #crmRetailMenu:not([hidden]) {
    box-shadow: inset 0 calc(-1 * var(--crm-sidebar-toggle-height, 55px)) 0 var(--crm-palette-header) !important;
  }
}

html:is([data-trello-native], [data-crm-mac-palette], .crm-content-embedded, .crm-purchases-embedded) {
  --crm-footer-background: var(--crm-palette-header, #242528);
}
@media (min-width: 901px) {
  html:root[data-trello-native] body.is-crm-view-active #roomView .crm-accounting-page:not(.is-hidden) {
    box-shadow: inset 0 calc(-1 * var(--crm-menu-row-height, 55px)) 0 var(--crm-palette-header);
  }
  html:root[data-trello-native] body.is-crm-view-active #roomView .crm-accounting-menu {
    grid-row: 1;
  }
}

/* Deeper navigation shares the same roles as the first two columns. */
.crm-deep-menu-icon { display: none; }
@media (min-width: 901px) {
  html:root[data-trello-native] body.is-crm-settings-active #settingsView.settings-view-has-category-choice .settings-layout {
    --category-column-width: var(--crm-navigation-width);
    grid-template-columns: max-content max-content minmax(300px, 1fr);
  }
  html:root[data-trello-native] body.is-crm-settings-active #settingsView.settings-view-has-category-choice :is(.settings-values-menu, #settingsCategoryRootMenu) {
    width: max-content;
    max-width: none;
    min-width: 0;
    grid-template-columns: max-content;
  }
  html:root[data-trello-native] body.is-crm-settings-active #settingsView #settingsValuesList.settings-category-choice {
    display: grid;
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    width: max-content;
    min-width: 0;
  }
  html:root[data-trello-native] body.is-crm-settings-active #settingsView:not(.settings-view-has-category-choice) .settings-layout:has(> .crm-deep-menu) {
    grid-template-columns: max-content minmax(0, 1fr);
  }
  html:root[data-trello-native] body.is-crm-settings-active #settingsView.settings-view-has-category-menu .settings-layout:has(> .crm-deep-menu) {
    grid-template-columns: max-content max-content minmax(0, 1fr);
  }
  html:root[data-trello-native] body.is-crm-settings-active #settingsView .crm-deep-menu {
    --crm-deep-menu-width: var(--crm-navigation-width);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    width: var(--crm-deep-menu-width);
    min-width: 0;
    max-width: none;
    height: 100%;
    min-height: 0;
    margin: 0;
    padding: 0;
    gap: 0;
    background: var(--crm-navigation-background) !important;
  }
  html:root[data-trello-native] body.is-crm-settings-active #settingsView .crm-deep-menu > :not(.crm-deep-menu-footer, .settings-category-choice-level-spacer) {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
  }
  html:root[data-trello-native] body.is-crm-settings-active #settingsView .crm-deep-menu :is([data-settings-value-key], .category-menu-item, .category-menu-group-toggle) {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: var(--crm-navigation-row-height);
    height: var(--crm-navigation-row-height);
  }
  html:root[data-trello-native] body.is-crm-settings-active #roomView #settingsView .crm-deep-menu-footer {
    display: flex;
    position: relative;
    align-items: stretch;
    flex: 0 0 var(--crm-navigation-footer-height);
    height: var(--crm-navigation-footer-height);
    min-height: var(--crm-navigation-footer-height);
    margin-top: auto;
    padding: 0;
    border: 0;
    background: transparent !important;
  }
  html:root[data-trello-native] #settingsView .crm-deep-menu-footer > .settings-category-choice-level-add,
  html:root[data-trello-native] .crm-marketing-workspace .crm-marketing-second-footer > .crm-marketing-second-add {
    flex: 0 0 var(--crm-navigation-footer-height);
    width: var(--crm-navigation-footer-height);
    min-width: 0;
    min-height: 0;
    height: 100%;
    display: grid;
    place-items: center;
    place-content: center;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    text-align: center;
    color: var(--crm-navigation-color);
    font-size: var(--settings-category-content-font-size, 12px);
    background: transparent !important;
  }
  html:root[data-trello-native] #settingsView .crm-deep-menu-footer > .settings-category-choice-level-add:is(:hover, :focus-visible, :active),
  html:root[data-trello-native] .crm-marketing-workspace .crm-marketing-second-footer > .crm-marketing-second-add:is(:hover, :focus-visible, :active) {
    background: transparent !important;
  }
  html:root[data-trello-native] body.is-crm-settings-active #settingsView .crm-deep-menu-footer > .crm-deep-menu-toggle {
    position: static;
    inset: auto;
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr);
    padding: 0 8px;
  }
  html:root[data-trello-native] body.is-crm-settings-active #settingsView .crm-deep-menu.is-collapsed {
    --crm-deep-menu-width: var(--crm-navigation-collapsed-width);
    --crm-navigation-item-inset: 0px;
    --crm-navigation-item-align: center;
  }
  html:root[data-trello-native] body.is-crm-settings-active #settingsView .crm-deep-menu.is-collapsed :is([data-settings-value-key], .category-menu-item, .category-menu-group-toggle) > :not(.crm-deep-menu-icon),
  html:root[data-trello-native] body.is-crm-settings-active #settingsView .crm-deep-menu.is-collapsed .settings-category-choice-level-add { display: none; }
  html:root[data-trello-native] body.is-crm-settings-active #settingsView .crm-deep-menu.is-collapsed .crm-deep-menu-icon {
    display: block;
    flex-shrink: 0;
    width: var(--crm-navigation-icon-size);
    height: var(--crm-navigation-icon-size);
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  html:root[data-trello-native] #settingsView .crm-deep-menu-toggle[aria-expanded="false"] svg { transform: rotate(180deg); }
}

@media (min-width: 901px) {
  html:root[data-trello-native] body.is-crm-settings-active #settingsView:not(.settings-view-has-category-choice) :is(
    .settings-modal-body, .settings-modal-layout-wrap, .settings-modal-section
  ):has(.settings-layout > .crm-deep-menu) {
    padding: 0;
    gap: 0;
    height: 100%;
    min-height: 0;
  }
  html:root[data-trello-native] body.is-crm-settings-active #settingsView .settings-layout:has(> .crm-deep-menu) {
    gap: 0;
    align-items: stretch;
    height: 100%;
    min-height: 0;
  }
}

@media (min-width: 901px) {
  html:root[data-trello-native] body.is-crm-settings-active #settingsView .crm-deep-menu
    :is([data-settings-value-key], .category-menu-item, .category-menu-group-toggle) > span:not(.category-menu-count) {
    flex: 1;
    min-width: 0;
  }
}

/* Native shell menus may stop above the footer; exposed space belongs to the outer rail. */
html:root[data-trello-native] body.is-crm-view-active #roomView > .room-page {
  background-color: var(--crm-palette-header) !important;
}

/* All CRM data tables share the Retail Orders row highlight. */
:root { --crm-table-row-hover: color-mix(in srgb, var(--crm-palette-selection, #383a3d) 45%, var(--crm-palette-workspace, #18191c)); }
html:is([data-trello-native], [data-crm-mac-palette], .crm-content-embedded, .crm-wholesale-embedded) body tbody > tr.crm-table-row-active > td,
html:is([data-trello-native], [data-crm-mac-palette], .crm-content-embedded, .crm-wholesale-embedded):not(.crm-table-keyboard):not(.crm-purchases-embedded) body tbody > tr:hover > td {
  background-color: var(--crm-table-row-hover) !important;
}
html.crm-table-keyboard body tbody > tr:not(.crm-table-row-active):hover > td {
  background-color: var(--crm-palette-workspace) !important;
}
html body tbody > tr.crm-table-row-active { outline: none !important; box-shadow: none !important; }
html.crm-purchases-embedded body .table-scroll #rows > tr.purchase-row-active > td,
html.crm-purchases-embedded body #rows:not(.purchase-keyboard-navigation) > tr:hover > td,
html.crm-purchases-embedded body #cart-page .cart-items tbody tr:focus-visible > td,
html.crm-purchases-embedded body #cart-page:not(.cart-keyboard-navigation) .cart-items tbody tr:hover > td,
html.crm-purchases-embedded body .table-scroll #rows > tr.purchase-row-active > td:not([hidden]):not(:has(~ :not([hidden])))::after,
html.crm-purchases-embedded body .table-scroll #rows:not(.purchase-keyboard-navigation) > tr:hover > td:not([hidden]):not(:has(~ :not([hidden])))::after {
  background-color: var(--crm-table-row-hover) !important;
}

html:is([data-trello-native], .crm-wholesale-embedded) body #roomView:not(.is-retail-order-keyboard) .room-order-card:hover,
html:is([data-trello-native], .crm-wholesale-embedded) body #roomView .room-order-card:focus-visible {
  background-color: var(--crm-table-row-hover) !important;
}

/* Purchase filter labels share Content navigation typography; arrows stay at the trailing edge. */
html:root.crm-purchases-embedded #purchase-filter-fields .brand-toggle {
  --crm-navigation-item-align: space-between;
}
html:root.crm-purchases-embedded #purchase-filter-fields .brand-toggle > span:first-child {
  min-width: 0;
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}
html:root.crm-purchases-embedded #purchase-filter-fields .brand-toggle > span[aria-hidden="true"] {
  margin-inline-start: auto;
}
/* Center the collapse glyph on the same trailing axis as the 14px filter arrows. */
@media (min-width: 901px) {
  html:root.crm-purchases-embedded #purchase-filters #purchase-menu-toggle[aria-expanded="true"] {
    padding-inline-end: calc(var(--crm-navigation-inset) + 7px - var(--crm-navigation-arrow-size) / 2);
  }
}
html:root.crm-purchases-embedded #purchase-filter-fields .brand-toggle.has-selection {
  background: var(--crm-navigation-hover) !important;
}

/* Marketing lists are the second navigation level, using shared CRM roles. */
@media (min-width: 901px) {
  html:root[data-trello-native] .crm-marketing-workspace {
    --crm-marketing-second-width: var(--crm-navigation-width);
  }
  html:root[data-trello-native] .crm-marketing-workspace :is(.marketing-discounts-panel, .marketing-promocodes-panel) {
    padding: 0 !important;
    height: 100%;
    min-height: 100%;
    gap: 0;
  }
  html:root[data-trello-native] .crm-marketing-workspace .discounts-modal-grid {
    grid-template-columns: var(--crm-marketing-second-width) minmax(0, 1fr) minmax(0, 1fr);
    height: 100%;
    gap: 0;
  }
  html:root[data-trello-native] .crm-marketing-workspace .marketing-promocodes-panel:not(.is-hidden) {
    grid-template-columns: var(--crm-marketing-second-width) minmax(0, 1fr);
  }
  html:root[data-trello-native] .crm-marketing-workspace .is-second-menu-collapsed {
    --crm-marketing-second-width: var(--crm-navigation-collapsed-width);
  }
  html:root[data-trello-native] .crm-marketing-workspace .crm-marketing-second-menu {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
    padding: 0;
    gap: 0;
    border: 0;
    background: var(--crm-navigation-background);
    overflow: hidden;
  }
  html:root[data-trello-native] .crm-marketing-workspace .crm-marketing-second-menu .discounts-modal-column-head {
    flex-shrink: 0;
    height: var(--crm-navigation-row-height);
    padding-inline: var(--crm-navigation-inset);
  }
  html:root[data-trello-native] .crm-marketing-workspace .crm-marketing-second-menu h4 {
    font: var(--crm-navigation-font);
    color: var(--crm-navigation-color);
  }
  html:root[data-trello-native] .crm-marketing-workspace :is(.discounts-name-list, .discounts-name-sublist) {
    gap: 0;
    padding: 0;
  }
  html:root[data-trello-native] .crm-marketing-workspace .discounts-name-list { flex: 1; min-height: 0; }
  html:root[data-trello-native] .crm-marketing-workspace .discounts-name-item {
    display: block;
    margin: 0;
  }
  html:root[data-trello-native] .crm-marketing-workspace :is(.discounts-name-button, .discounts-name-input, .discounts-individual-summary, .marketing-channel-menu-button) {
    box-sizing: border-box;
    width: 100%;
    height: auto;
    min-height: var(--crm-navigation-row-height);
    padding: 16px var(--crm-navigation-inset);
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    color: var(--crm-navigation-color);
    font: var(--crm-navigation-font);
    text-align: left;
    overflow-wrap: anywhere;
  }
  html:root[data-trello-native] .crm-marketing-workspace .discounts-name-button { padding-right: 38px; }
  html:root[data-trello-native] .crm-marketing-workspace :is(.discounts-name-button, .discounts-individual-summary, .marketing-channel-menu-button):hover {
    background: var(--crm-navigation-hover);
  }
  html:root[data-trello-native] .crm-marketing-workspace :is(.discounts-name-button, .marketing-channel-menu-button).is-active {
    background: var(--crm-navigation-selection);
  }
  html:root[data-trello-native] .crm-marketing-workspace :is(.discounts-individual-summary, .marketing-channel-menu-button):focus-visible {
    outline: 1px solid var(--crm-navigation-color);
    outline-offset: -2px;
  }
  html:root[data-trello-native] .crm-marketing-workspace .discounts-name-button:focus-visible,
  html:root[data-trello-native] .crm-marketing-workspace .discounts-name-input:focus {
    outline: none;
    border: 0;
    box-shadow: none;
    background: var(--crm-navigation-selection);
  }
  html:root[data-trello-native] .crm-marketing-workspace .discounts-individual-list { margin: 0; }
  html:root[data-trello-native] .crm-marketing-workspace .crm-marketing-second-footer {
    margin-top: auto;
    flex: 0 0 var(--crm-navigation-footer-height);
    display: flex;
    justify-content: flex-end;
  }
  html:root[data-trello-native] .crm-marketing-workspace .crm-marketing-second-toggle {
    width: var(--crm-navigation-footer-height);
    height: var(--crm-navigation-footer-height);
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--crm-navigation-color);
    cursor: pointer;
  }
  .crm-marketing-second-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .is-second-menu-collapsed .crm-marketing-second-toggle svg { transform: rotate(180deg); }
  html:root[data-trello-native] .crm-marketing-workspace .is-second-menu-collapsed .crm-marketing-second-footer { justify-content: center; }
  html:root[data-trello-native] .crm-marketing-workspace .is-second-menu-collapsed :is(.discounts-name-button, .discounts-individual-summary, .marketing-channel-menu-button) {
    font-size: 0;
    padding-inline: 0;
    text-align: center;
    justify-content: center;
  }
  .is-second-menu-collapsed .marketing-channel-menu-button span { display: none; }
  .is-second-menu-collapsed :is(.discounts-name-button, .discounts-individual-summary, .marketing-channel-menu-button)::before {
    content: "";
    display: inline-block;
    width: var(--crm-navigation-icon-size);
    height: var(--crm-navigation-icon-size);
    background: currentColor;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round'%3E%3Cpath d='M5 19 19 5'/%3E%3Ccircle cx='7' cy='7' r='2'/%3E%3Ccircle cx='17' cy='17' r='2'/%3E%3C/svg%3E") center / contain no-repeat;
  }
  .is-second-menu-collapsed .marketing-channel-menu-button::before {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linejoin='round'%3E%3Cpath d='M3 7h18v4a2 2 0 0 0 0 4v3H3v-3a2 2 0 0 0 0-4zM12 7v11'/%3E%3C/svg%3E");
  }
  .is-second-menu-collapsed .crm-marketing-second-menu .discounts-modal-column-head h4 { display: none; }
  .is-second-menu-collapsed .discounts-name-delete { display: none; }
  html:root[data-trello-native] .crm-marketing-workspace .discounts-modal-column:not(:first-child) { padding: 24px; }
  html:root[data-trello-native] .crm-marketing-workspace .marketing-channel-body { padding: 24px; align-self: start; }
}

@media (max-width: 900px) {
  .crm-marketing-second-footer { display: none; }
}

@media (min-width: 901px) {
  html:root[data-trello-native] .crm-marketing-workspace .crm-marketing-second-toggle:is(:hover, :focus-visible) {
    background: var(--crm-navigation-hover);
  }
  .crm-marketing-second-toggle:focus-visible { outline: 1px solid var(--crm-navigation-color); outline-offset: -2px; }
}

@media (min-width: 901px) {
  html:root[data-trello-native] .crm-marketing-workspace .marketing-promocodes-panel:not(.is-hidden) {
    grid-template-rows: minmax(0, 1fr);
    align-items: stretch;
    align-content: stretch;
  }
  html:root[data-trello-native] .crm-marketing-workspace .crm-marketing-second-menu {
    height: 100%;
  }
}

/* Marketing already ends above the shared shell footer; reserve no second footer. */
@media (min-width: 901px) {
  html:root[data-trello-native] body.is-crm-view-active #roomView #crmRetailMenu.is-marketing-menu:not([hidden]) {
    padding-block-end: 0;
    box-shadow: none !important;
    border-image: none;
  }
}

/* Discounts begin with the rules; creation shares the Content menu footer. */
html:root[data-trello-native] .crm-marketing-workspace .discounts-modal-column:first-child > .discounts-modal-column-head { display: none; }
html:root[data-trello-native] .crm-marketing-workspace .discounts-name-delete { display: none; }
html:root[data-trello-native] .crm-marketing-workspace .discounts-individual-summary { list-style: none; }
html:root[data-trello-native] .crm-marketing-workspace .discounts-individual-summary::-webkit-details-marker { display: none; }
html:root[data-trello-native] .crm-marketing-workspace .discounts-individual-summary::marker { content: ""; }
@media (min-width: 901px) {
  html:root[data-trello-native] .crm-marketing-workspace .discounts-modal-grid:not(.is-second-menu-collapsed) .crm-marketing-second-footer { justify-content: space-between; }
  html:root[data-trello-native] .crm-marketing-workspace .is-second-menu-collapsed .crm-marketing-second-add { display: none; }
  html:root[data-trello-native] .crm-marketing-workspace .discounts-name-button { padding-right: var(--crm-navigation-inset); }
  html:root[data-trello-native] .crm-marketing-workspace .crm-marketing-second-add { cursor: pointer; transform: none; transition: none; }
}

@media (max-width: 900px) {
  .crm-marketing-workspace .crm-marketing-second-footer:has(.crm-marketing-second-add) { display: flex; justify-content: flex-start; }
  .crm-marketing-workspace .crm-marketing-second-footer .crm-marketing-second-toggle { display: none; }
}

/* Filter and Rules share the standard menu-row heading and divider. */
@media (min-width: 901px) {
  html:root[data-trello-native] #marketingDiscountsContent > .discounts-settings-column {
    padding: 0;
    gap: 0;
    grid-template-rows: var(--crm-navigation-row-height) minmax(0, 1fr);
  }
  html:root[data-trello-native] #marketingDiscountsContent > .discounts-settings-column > .discounts-modal-column-head {
    box-sizing: border-box;
    height: 100%;
    min-height: 0;
    padding: 0 24px;
    border-bottom: 1px solid var(--crm-palette-divider);
  }
  html:root[data-trello-native] #marketingDiscountsContent > .discounts-settings-column > :is(.discounts-filter-area, .discounts-rule-list) {
    padding: 24px;
  }
}

/* A narrow catalogue beside the preview is still part of the desktop CRM. */
@media (max-width: 900px) {
  html:root[data-crm-mac-palette].crm-content-embedded:not(.crm-content-preview-document, .crm-purchase-card-context) #catalogView {
    --content-category-width: var(--crm-navigation-collapsed-width);
    --content-subcategory-width: var(--crm-navigation-width);
    --content-fourth-menu-width: var(--crm-navigation-width);
    --content-footer-height: var(--crm-shell-bar-height, 55px);
    padding-bottom: 0;
  }
  html:root[data-crm-mac-palette].crm-content-embedded:not(.crm-content-preview-document, .crm-purchase-card-context) #catalogView:has(> #catalogLayout.crm-category-menu-expanded) { --content-category-width: var(--crm-navigation-width); }
  html:root[data-crm-mac-palette].crm-content-embedded:not(.crm-content-preview-document, .crm-purchase-card-context) #catalogView:has(> #catalogLayout.crm-subcategory-menu-collapsed) { --content-subcategory-width: var(--crm-navigation-collapsed-width); }
  html:root[data-crm-mac-palette].crm-content-embedded:not(.crm-content-preview-document, .crm-purchase-card-context) #catalogView:has(> #catalogLayout.crm-fourth-menu-collapsed) { --content-fourth-menu-width: var(--crm-navigation-collapsed-width); }
  html:root[data-crm-mac-palette].crm-content-embedded:not(.crm-content-preview-document, .crm-purchase-card-context) #catalogView #catalogLayout {
    grid-template-columns: var(--content-category-width) minmax(0, 1fr);
  }
  html:root[data-crm-mac-palette].crm-content-embedded:not(.crm-content-preview-document, .crm-purchase-card-context) #catalogView #catalogLayout:has(.catalog-subcategories:not([hidden])) {
    grid-template-columns: var(--content-category-width) var(--content-subcategory-width) minmax(0, 1fr);
  }
  html:root[data-crm-mac-palette].crm-content-embedded:not(.crm-content-preview-document, .crm-purchase-card-context) #catalogView #catalogLayout:has(.catalog-fourth-menu:not([hidden])) {
    grid-template-columns: var(--content-category-width) var(--content-subcategory-width) var(--content-fourth-menu-width) minmax(0, 1fr);
  }
  html:root[data-crm-mac-palette].crm-content-embedded:not(.crm-content-preview-document, .crm-purchase-card-context) #catalogView #catalogLayout > .catalog-sidebar:not([hidden]) {
    display: grid;
    grid-template-rows: minmax(0, 1fr) var(--crm-navigation-footer-height);
    grid-row: 1;
    min-height: 0;
    position: sticky;
    top: 0;
    max-height: none;
    overflow: hidden;
    border-inline-end: 1px solid var(--crm-palette-divider);
    height: calc(100dvh - var(--content-footer-height));
  }
  html:root[data-crm-mac-palette].crm-content-embedded:not(.crm-content-preview-document, .crm-purchase-card-context) #catalogLayout > .catalog-sidebar > .crm-category-menu-footer {
    display: block;
    grid-row: 2;
    position: relative;
  }
  html:root[data-crm-mac-palette].crm-content-embedded:not(.crm-content-preview-document, .crm-purchase-card-context) #catalogView #catalogLayout > .catalog-panel {
    grid-column: auto;
    grid-row: 1;
    min-height: 100dvh;
    margin-bottom: var(--content-footer-height);
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
}
:root { --crm-palette-file-stock-title:#FFD84D; }

/* Receipt metadata keeps workspace text color with its own field size. */
html:is([data-trello-native], [data-crm-mac-palette]) .crm-accounting-receipt .crm-receipt-fields,
html:is([data-trello-native], [data-crm-mac-palette]) .crm-accounting-receipt .crm-receipt-fields :is(label, input, select, textarea, button) {
  font: 400 var(--crm-receipt-field-font-size, 14px) system-ui !important;
  color: var(--crm-receipt-text-color, #c9c9ca) !important;
}
html:is([data-trello-native], [data-crm-mac-palette]) .crm-accounting-receipt .crm-receipt-fields textarea {
  line-height: calc(var(--receipt-row-height) - 1px) !important;
}

/* Open purchase navigation keeps the shared text color on a neutral surface. */
html:root.crm-purchases-embedded body #purchase-filters #purchase-filter-fields .brand-toggle[aria-expanded="true"] {
  background: var(--crm-navigation-selection) !important;
}

/* File apply action occupies the same full row as its neighbouring menu items. */
html:root.crm-purchases-embedded #temporary-stock-panel #apply-temporary-stock {
  box-sizing: border-box;
  width: 100%;
  min-height: var(--crm-navigation-row-height);
  padding: 0 var(--crm-navigation-item-inset, var(--crm-navigation-inset)) !important;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  font: var(--crm-navigation-font) !important;
}

/* Filled receipt metadata uses the purchase file-product accent. */
html:is([data-trello-native], [data-crm-mac-palette]) .crm-accounting-receipt .crm-receipt-fields .crm-receipt-field-filled,
.crm-accounting-receipt .crm-receipt-fields .crm-receipt-field-filled {
  color: var(--crm-palette-file-stock-title, #FFD84D) !important;
  -webkit-text-fill-color: var(--crm-palette-file-stock-title, #FFD84D) !important;
}

/* Purchase document rows follow Retail orders; height follows the adjacent menu. */
html:is([data-trello-native], [data-crm-mac-palette]) .crm-purchase-documents {
  background: var(--crm-retail-content-surface);
}

/* Marketing follows the shared Purchases navigation roles at both levels. */
@media (min-width: 901px) {
  html:root[data-trello-native] .crm-marketing-workspace {
    --crm-navigation-row-height: max(var(--crm-section-menu-row-height, 55px), var(--crm-menu-row-height, 55px));
    background: var(--crm-retail-orders-background, var(--crm-palette-workspace));
    color: var(--crm-navigation-color);
  }
  html:root[data-trello-native] .crm-marketing-workspace .marketing-email-panel:not(.is-hidden) {
    grid-template-columns: var(--crm-marketing-second-width) minmax(0, 1fr);
  }
  html:root[data-trello-native] .crm-marketing-workspace .crm-marketing-second-menu {
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  html:root[data-trello-native] .crm-marketing-workspace :is(.discounts-name-button, .discounts-name-input, .discounts-individual-summary, .marketing-channel-menu-button) {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    height: var(--crm-navigation-row-height);
    min-height: var(--crm-navigation-row-height);
    padding-block: 0;
    font: var(--crm-navigation-font);
    color: var(--crm-navigation-color);
    border: 0;
    box-shadow: none;
  }
  html:root[data-trello-native] .crm-marketing-workspace :is(.discounts-name-button, .marketing-channel-menu-button).is-active:hover {
    background: var(--crm-navigation-selection);
  }
  html:root[data-trello-native] .crm-marketing-workspace .crm-marketing-second-toggle {
    width: 100%;
    justify-items: end;
    padding-inline: 8px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: var(--crm-navigation-background);
  }
  html:root[data-trello-native] .crm-marketing-workspace .is-second-menu-collapsed .crm-marketing-second-toggle { justify-items: center; }
  .marketing-email-panel:not(.is-second-menu-collapsed) .marketing-email-menu .crm-nav-icon { display: none; }
  html:root[data-trello-native] .crm-marketing-workspace .marketing-email-body {
    align-self: stretch;
    padding: 0;
    background: var(--crm-retail-orders-background, var(--crm-palette-workspace));
  }
}
@media (min-width: 901px) {
  html:root[data-trello-native] body.is-crm-view-active #roomView #crmMarketingNav > button::before,
  html:root[data-trello-native] body.is-crm-view-active #roomView #crmMarketingNav > button::after { content: none; }
  html:root[data-trello-native] body.is-crm-view-active #roomView #crmRetailMenu.is-marketing-menu,
  html:root[data-trello-native] .crm-marketing-workspace .crm-marketing-second-menu {
    border: 0 !important;
    border-inline-end: 1px solid var(--crm-divider-color) !important;
  }
  html:root[data-trello-native] .crm-marketing-workspace .discounts-modal-grid > .discounts-modal-column:nth-child(2) {
    border-inline-start: 0;
  }
  /* Marketing has no separate bottom workspace footer: its corner reaches the bottom. */
  html:root[data-trello-native] body.is-crm-view-active:not(.is-crm-settings-active) #roomView:not(.is-hidden)
    .room-page > .room-sidebar:not([hidden]) + #crmRetailMenu.is-marketing-menu:not([hidden])::after {
    inset-block-end: 0;
  }
  html:root[data-trello-native] .crm-marketing-workspace .marketing-channel-body {
    padding: 0;
    align-self: stretch;
    min-height: 0;
    background: var(--crm-retail-orders-background, var(--crm-palette-workspace));
  }
  html:root[data-trello-native] .crm-marketing-workspace .marketing-promocodes-panel > .marketing-channel-body {
    height: 100%;
    gap: 0;
  }
  html:root[data-trello-native] .crm-marketing-workspace :is(.marketing-promocode-list-block, .marketing-promocode-settings-block) {
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 0;
    align-content: start;
    grid-template-rows: var(--crm-navigation-row-height) minmax(0, 1fr);
  }
  html:root[data-trello-native] .crm-marketing-workspace .marketing-promocode-settings-block,
  html:root[data-trello-native] .crm-marketing-workspace .discounts-modal-column:last-child {
    border-inline-start: 1px solid var(--crm-retail-row-divider, var(--crm-divider-color));
  }
  html:root[data-trello-native] .crm-marketing-workspace :is(.marketing-promocode-block-head, .discounts-modal-column:not(:first-child) .discounts-modal-column-head) {
    box-sizing: border-box;
    height: var(--crm-navigation-row-height);
    padding: 0 var(--crm-navigation-inset);
    background: var(--crm-navigation-background);
    border-block-end: 1px solid var(--crm-divider-color);
  }
  html:root[data-trello-native] .crm-marketing-workspace :is(.marketing-promocode-block-head, .discounts-modal-column-head) h4 {
    font: var(--crm-navigation-font);
    color: var(--crm-navigation-color);
  }
  html:root[data-trello-native] .crm-marketing-workspace .discounts-modal-column:not(:first-child) { padding: 0; }
  html:root[data-trello-native] .crm-marketing-workspace :is(.marketing-promocode-settings-empty, .marketing-promocode-empty, .marketing-promocode-form) {
    padding-inline: var(--crm-navigation-inset);
  }
}

/* Clients use the same canvas and quiet row separators as Retail orders. */
html:root[data-trello-native] body.is-crm-view-active #roomView .crm-clients-page {
  --crm-divider-color: var(--crm-retail-row-divider);
  background: var(--crm-retail-orders-background) !important;
}

/* Mail shares the CRM workspace and the existing sidebar control grid. */
.crm-mail-page { min-width: 0; min-height: 0; overflow: hidden; }
.crm-mail-page > iframe { display: block; width: 100%; height: 100%; border: 0; }
html[data-trello-native] #roomView .room-sidebar > [data-room-action="mail"] {
  display: grid; place-items: center; width: 100%; height: var(--crm-sidebar-toggle-height);
  padding: 0; border: 0; border-radius: 0; color: var(--crm-palette-text);
  background: var(--crm-palette-header);
}
html[data-trello-native] #roomView .room-sidebar > [data-room-action="mail"][hidden] { display: none; }
html[data-trello-native] #roomView .room-sidebar > [data-room-action="mail"] span { display: none; }
html[data-trello-native] #roomView .room-sidebar > [data-room-action="mail"] svg {
  width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
html[data-trello-native] #roomView .room-sidebar > [data-room-action="mail"]:is(:hover, .is-active) {
  background: var(--crm-palette-selection);
}
@media (min-width: 901px) {
  html:root[data-trello-native] body.is-crm-view-active #roomView:not(.is-hidden) .room-sidebar > .room-nav {
    max-height: calc(100dvh - var(--crm-shell-bar-height, 49px) - 4 * var(--crm-sidebar-toggle-height));
  }
  html:root[data-trello-native] body.is-crm-view-active #roomView:not(.is-hidden) .room-sidebar > [data-room-action="mail"] {
    position: fixed; inset: auto auto calc(3 * var(--crm-sidebar-toggle-height)) 0;
    width: var(--crm-primary-rail-width, 84px); z-index: 7;
  }
}
html[data-crm-mail-embedded] .topbar,
html[data-crm-mail-embedded] .app-footer { display: none !important; }
html[data-crm-mail-embedded] .app-shell { min-height: 100dvh; height: 100dvh; grid-template-rows: minmax(0, 1fr); }
html[data-crm-mail-embedded] #mailView { padding: 0; height: 100%; min-height: 0; }

body.is-crm-view-active:has(.crm-mail-page:not(.is-hidden)) .room-main { padding: 0; }
body.is-crm-view-active #roomView .crm-mail-page:not(.is-hidden) { display: flex; flex-direction: column; }
.crm-mail-page > iframe { flex: 1; min-height: 0; }
html[data-crm-mail-embedded], html[data-crm-mail-embedded] body { background: var(--crm-palette-workspace, #18191c); }
html:root.crm-wholesale-embedded[data-crm-mac-palette] :is(.room-main-page--dealers, .room-dealers-list) { background: var(--crm-retail-orders-background) !important; }

/* Marketing's first menu stays neutral. */
html:root[data-trello-native] #roomView #crmRetailMenu.is-marketing-menu #crmMarketingNav > button.is-active{background:transparent !important}
html:root[data-trello-native] #roomView #crmRetailMenu.is-marketing-menu :is(.crm-retail-refresh,#crmRetailToggle){border:0 !important;box-shadow:none !important;background:transparent !important}
html:root[data-trello-native] #roomView #crmRetailMenu.is-marketing-menu :is(.crm-retail-refresh,#crmRetailToggle):not(:hover,:focus-visible){background:transparent}
html:root[data-trello-native] #roomView #crmRetailMenu.is-marketing-menu :is(.crm-retail-refresh,#crmRetailToggle)::before,
html:root[data-trello-native] #roomView #crmRetailMenu.is-marketing-menu :is(.crm-retail-refresh,#crmRetailToggle)::after{display:none}

html:root[data-trello-native] body.is-crm-view-active #roomView #crmRetailMenu.is-marketing-menu{background-image:none !important}
html:root[data-trello-native] body.is-crm-view-active #roomView #crmRetailMenu.is-marketing-menu :is(.crm-retail-refresh,#crmRetailToggle):not(:hover,:focus-visible){background:var(--crm-navigation-background,var(--crm-palette-panel,#1c1d20)) !important}

html:root[data-trello-native] body.is-crm-view-active #roomView #crmRetailMenu.is-marketing-menu .crm-retail-refresh:not([hidden]){width:100% !important;justify-self:stretch;margin-inline:0;background:var(--crm-navigation-background,var(--crm-palette-panel,#1c1d20)) !important}

/* Retail controls share one surface; clip the menu at the actual footer edge. */
@media (min-width: 901px) {
  html:root[data-trello-native] body.is-crm-view-active #roomView.is-crm-retail-open
    #crmRetailMenu:not(.is-marketing-menu):not(.is-dashboard-menu):not([hidden]) {
    background: var(--crm-navigation-background) !important;
    box-shadow: none !important;
    --crm-retail-footer-edge: var(--crm-retail-footer-inset, 0px);
    padding-block-end: var(--crm-retail-footer-edge);
    clip-path: inset(0 0 var(--crm-retail-footer-edge) 0 round var(--crm-shell-joint-radius, 12px) 0 0 var(--crm-shell-joint-radius, 12px));
  }

  html:root[data-trello-native] body.is-crm-view-active #roomView.is-crm-retail-open
    #crmRetailMenu:not(.is-marketing-menu):not(.is-dashboard-menu)::before,
  html:root[data-trello-native] body.is-crm-view-active #roomView.is-crm-retail-open
    #crmRetailMenu:not(.is-marketing-menu):not(.is-dashboard-menu)::after {
    content: none;
  }

  html:root[data-trello-native] #roomView.is-crm-retail-open
    #crmRetailMenu.is-collapsed:not(.is-marketing-menu):not(.is-dashboard-menu) .crm-retail-refresh:not([hidden]) {
    width: 100%;
    justify-self: stretch;
    margin-inline: 0;
    background: var(--crm-navigation-background);
  }

  html:root[data-trello-native] #roomView.is-crm-retail-open
    #crmRetailMenu:not(.is-marketing-menu):not(.is-dashboard-menu) .crm-retail-refresh:enabled:is(:hover, :focus-visible) {
    background: var(--crm-navigation-hover);
  }

  html:root[data-trello-native] #roomView.is-crm-retail-open .crm-order-marker-filter {
    width: 52px;
    align-items: stretch;
  }

  html:root[data-trello-native] #roomView.is-crm-retail-open .crm-order-marker-filter > summary {
    width: 100%;
    min-height: 0;
    padding: 0;
    box-sizing: border-box;
  }

  html:root[data-trello-native] #roomView.is-crm-retail-open .crm-order-marker-filter > summary > svg {
    display: block;
    width: 22px;
    height: 22px;
    flex: none;
  }
}

/* One refresh action in the primary rail; original section handlers stay attached. */
body.is-crm-view-active [data-crm-refresh-relocated] { display: none !important; }
body.is-crm-view-active #crmUnifiedRefresh {
  position: fixed !important;
  inset: auto auto calc(2 * var(--crm-sidebar-toggle-height, 55px)) 0 !important;
  width: var(--crm-primary-rail-width, 84px) !important;
  height: var(--crm-sidebar-toggle-height, 55px) !important;
  display: grid !important; place-items: center;
  padding: 0 !important; margin: 0 !important;
  border: 0; border-radius: 0; background: transparent;
  color: var(--crm-iconsax-muted, #afafaf); z-index: 101;
}
body.is-crm-view-active #crmUnifiedRefresh:enabled:hover { background: var(--crm-navigation-hover); }
body.is-crm-view-active #crmUnifiedRefresh > svg { width: 22px; height: 22px; }
body.is-crm-view-active #crm-rail-downloads-button:is(:hover, [aria-expanded="true"]) > svg[data-iconsax] > .crm-iconsax-linear { display: inline !important; color: #fff !important; }
body.is-crm-view-active #crm-rail-downloads-button > svg[data-iconsax] > .crm-iconsax-bold { display: none !important; }

/* Template actions share the existing filter row, independent of the submenu. */
body.is-crm-view-active .crm-purchases-supplier > .crm-purchases-template-control {
  flex: none; width: 36px; height: 36px; min-width: 36px; min-height: 36px;
  margin: 0; padding: 0; display: grid; place-items: center;
}
body.is-crm-view-active .crm-purchases-template-control > svg { width: 22px; height: 22px; }

/* Purchases use the primary rail's original Iconsax scale and state colours.
   Override inherited 16/18/21px and per-action enlargement rules together. */
body.is-crm-view-active:has(.crm-purchases-page:not(.is-hidden)) .topbar
:is(#crmContentPreviewMenus, #crmPurchaseRightColumn, #crmContentPreviewLock, #crmContentPreviewEdit,
    #crmContentPreviewToggle, #crmPurchasePhotoToggle, .crm-purchases-quick-fill,
    [data-purchase-control="open-table"], [data-purchase-control="open-statistics"], #crm-two-columns-toggle):not([hidden]) {
  --purchase-icon-size: 22px;
  width: 44px !important; min-width: 44px !important;
  height: var(--crm-shell-bar-height, 56px) !important;
  min-height: var(--crm-shell-bar-height, 56px) !important;
  flex: 0 0 44px !important; padding: 0 !important;
  align-self: center; display: grid; place-items: center;
  opacity: 1 !important;
}
body.is-crm-view-active:has(.crm-purchases-page:not(.is-hidden)) .topbar
:is(#crmContentPreviewMenus, #crmPurchaseRightColumn, #crmContentPreviewLock, #crmContentPreviewEdit,
    #crmContentPreviewToggle, #crmPurchasePhotoToggle, .crm-purchases-quick-fill,
    [data-purchase-control="open-table"], [data-purchase-control="open-statistics"], #crm-two-columns-toggle) > svg[data-iconsax] {
  width: 22px !important; height: 22px !important;
  min-width: 22px !important; min-height: 22px !important;
  flex: 0 0 22px !important; margin: 0 !important;
  color: var(--crm-iconsax-muted, #afafaf) !important;
  opacity: 1 !important;
}
body.is-crm-view-active:has(.crm-purchases-page:not(.is-hidden)) .topbar
:is(#crmContentPreviewMenus, #crmPurchaseRightColumn, #crmContentPreviewLock, #crmContentPreviewEdit,
    #crmContentPreviewToggle, #crmPurchasePhotoToggle, .crm-purchases-quick-fill,
    [data-purchase-control="open-table"], [data-purchase-control="open-statistics"], #crm-two-columns-toggle) > svg[data-iconsax] > g {
  color: var(--crm-iconsax-muted, #afafaf) !important;
}
body.is-crm-view-active:has(.crm-purchases-page:not(.is-hidden)) .topbar
:is(#crmContentPreviewMenus, #crmPurchaseRightColumn, #crmContentPreviewLock, #crmContentPreviewEdit,
    #crmContentPreviewToggle, #crmPurchasePhotoToggle, .crm-purchases-quick-fill,
    [data-purchase-control="open-table"], [data-purchase-control="open-statistics"], #crm-two-columns-toggle):is(:enabled:hover, :focus-visible, [aria-pressed="true"], [aria-expanded="true"])
> svg[data-iconsax] > g { color: #fff !important; }

body.is-crm-view-active:has(.crm-purchases-page:not(.is-hidden)) .topbar .crm-purchases-toolbar > button:disabled > svg[data-iconsax] > .crm-iconsax-linear { display: inline !important; }
body.is-crm-view-active:has(.crm-purchases-page:not(.is-hidden)) .topbar .crm-purchases-toolbar > button:disabled > svg[data-iconsax] > .crm-iconsax-bold { display: none !important; }
/* The heading control can be reparented by the native shell. */
body.is-crm-view-active:has(.crm-purchases-page:not(.is-hidden)) #crm-two-columns-toggle > svg[data-iconsax] {
  width: 22px !important; height: 22px !important;
  min-width: 22px !important; min-height: 22px !important;
  flex: 0 0 22px !important; opacity: 1 !important;
}

/* One template picker before the filter; the popup stays just above the footer. */
.crm-purchase-template-picker { flex: none; }
body.is-crm-view-active .crm-purchase-template-picker > .crm-purchases-template-control {
  width: 36px; height: 36px; min-width: 36px; padding: 0; display: grid; place-items: center;
}
.crm-purchase-template-menu {
  position: fixed; z-index: 1200; min-width: 220px; padding: 4px;
  background: var(--crm-dropdown-background, var(--crm-second-menu-background, #242528));
  border: 1px solid var(--crm-divider-color, #383a3e); border-radius: 6px;
  box-shadow: 0 8px 24px #0004;
}
.crm-purchase-template-menu[hidden] { display: none !important; }
.crm-purchase-template-menu > button {
  display: block; width: 100%; min-height: 36px; padding: 8px 12px;
  color: var(--crm-palette-text, #f4f5f7); background: transparent; border: 0;
  text-align: left; font: inherit; border-radius: 3px; cursor: pointer;
}
html:root #crmPurchaseTemplateActions.crm-purchase-template-menu > button:is(:focus, :focus-visible) { outline: none !important; box-shadow: none !important; }
html:root #crmPurchaseTemplateActions.crm-purchase-template-menu > button:focus-visible { background: var(--crm-navigation-hover, #383a3e) !important; }
.crm-purchase-template-menu > button:is(:hover, :focus-visible) { background: var(--crm-navigation-hover, #383a3e); }
.crm-purchase-template-menu > button:disabled { opacity: .5; cursor: default; }
body.is-crm-view-active #crmPurchaseTemplateMenu[aria-expanded="true"] > svg > .crm-iconsax-linear { display: none; }
body.is-crm-view-active #crmPurchaseTemplateMenu[aria-expanded="true"] > svg > .crm-iconsax-bold { display: inline; color: #fff; }

/* Paint one compact tile on the button, separate from the transparent SVG. */
body.is-crm-view-active:has(.crm-purchases-page:not(.is-hidden)) .topbar
:is(#crmContentPreviewMenus, #crmPurchaseRightColumn, #crmContentPreviewLock, #crmContentPreviewEdit,
    #crmContentPreviewToggle, #crmPurchasePhotoToggle, .crm-purchases-quick-fill,
    [data-purchase-control="open-table"], [data-purchase-control="open-statistics"], #crm-two-columns-toggle) {
  position: relative; isolation: isolate;
  background: transparent !important; box-shadow: none !important;
}
body.is-crm-view-active:has(.crm-purchases-page:not(.is-hidden)) .topbar
:is(#crmContentPreviewMenus, #crmPurchaseRightColumn, #crmContentPreviewLock, #crmContentPreviewEdit,
    #crmContentPreviewToggle, #crmPurchasePhotoToggle, .crm-purchases-quick-fill,
    [data-purchase-control="open-table"], [data-purchase-control="open-statistics"], #crm-two-columns-toggle)::before {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  width: 36px; height: 36px; left: 50%; top: 50%; transform: translate(-50%, -50%);
  border-radius: 11px; background: transparent; box-shadow: none;
}
body.is-crm-view-active:has(.crm-purchases-page:not(.is-hidden)) .topbar
:is(#crmContentPreviewMenus, #crmPurchaseRightColumn, #crmContentPreviewLock, #crmContentPreviewEdit,
    #crmContentPreviewToggle, #crmPurchasePhotoToggle, .crm-purchases-quick-fill,
    [data-purchase-control="open-table"], [data-purchase-control="open-statistics"], #crm-two-columns-toggle)
> svg[data-iconsax] {
  background: transparent !important; box-shadow: none !important; border-radius: 0;
}
body.is-crm-view-active:has(.crm-purchases-page:not(.is-hidden)) .topbar
:is(#crmContentPreviewMenus, #crmPurchaseRightColumn, #crmContentPreviewLock, #crmContentPreviewEdit,
    #crmContentPreviewToggle, #crmPurchasePhotoToggle, .crm-purchases-quick-fill,
    [data-purchase-control="open-table"], [data-purchase-control="open-statistics"], #crm-two-columns-toggle):is(:enabled:hover, :focus-visible, [aria-pressed="true"], [aria-expanded="true"])::before {
  background: #383a3d;
}
body.is-crm-view-active:has(.crm-purchases-page:not(.is-hidden)) .topbar
:is(#crmContentPreviewMenus, #crmPurchaseRightColumn, #crmContentPreviewLock, #crmContentPreviewEdit,
    #crmContentPreviewToggle, #crmPurchasePhotoToggle, .crm-purchases-quick-fill,
    [data-purchase-control="open-table"], [data-purchase-control="open-statistics"], #crm-two-columns-toggle):focus-visible {
  outline: none !important;
}
body.is-crm-view-active:has(.crm-purchases-page:not(.is-hidden)) .topbar
:is(#crmContentPreviewMenus, #crmPurchaseRightColumn, #crmContentPreviewLock, #crmContentPreviewEdit,
    #crmContentPreviewToggle, #crmPurchasePhotoToggle, .crm-purchases-quick-fill,
    [data-purchase-control="open-table"], [data-purchase-control="open-statistics"], #crm-two-columns-toggle):focus-visible::before {
  outline: 2px solid var(--crm-palette-text-secondary, #cdcdcd); outline-offset: 2px;
}
body.is-crm-view-active .crm-purchases-toolbar > :is(#crmPurchasePhotoToggle, .crm-purchases-quick-fill)[hidden] { display: none !important; }

/* Unavailable quick-fill stays a quiet contour with an explanatory native tooltip. */
body.is-crm-view-active:has(.crm-purchases-page:not(.is-hidden)) .topbar #crmPurchaseQuickFill:disabled {
  opacity: .5 !important; cursor: not-allowed;
}

/* Primary rail ink and stroke weight follow the supplied Codex reference.
   Keep opacity on the paint only so hover/selected Iconsax pairs stay white. */
body.is-crm-view-active #roomView .room-sidebar {
  --crm-iconsax-muted: #8f8f8f;
  --crm-rail-icon-stroke: 1.35;
}

body.is-crm-view-active #roomView .room-sidebar svg[data-iconsax] .crm-iconsax-linear [stroke-width] {
  stroke-width: var(--crm-rail-icon-stroke) !important;
}

/* Header and purchase footer share the primary rail's original icon scale and ink. */
body.is-crm-view-active {
  --crm-iconsax-muted: #8f8f8f;
  --crm-rail-icon-stroke: 1.35;
}
body.is-crm-view-active :is(.topbar, .crm-purchases-footer, #crm-mac-profiles) svg[data-iconsax] {
  width: 22px !important; height: 22px !important;
  min-width: 22px !important; min-height: 22px !important;
  flex: 0 0 22px !important;
}
body.is-crm-view-active :is(.topbar, .crm-purchases-footer, #crm-mac-profiles) svg[data-iconsax] > .crm-iconsax-linear {
  color: var(--crm-iconsax-muted) !important;
}
body.is-crm-view-active :is(.topbar, .crm-purchases-footer, #crm-mac-profiles) svg[data-iconsax] .crm-iconsax-linear [stroke-width] {
  stroke-width: var(--crm-rail-icon-stroke) !important;
}
body.is-crm-view-active :is(.topbar, .crm-purchases-footer, #crm-mac-profiles)
:is(button:enabled, summary):is(:hover, :focus-visible, [aria-pressed="true"], [aria-expanded="true"])
> svg[data-iconsax] > :is(.crm-iconsax-linear, .crm-iconsax-bold) { color: #fff !important; }
body.is-crm-view-active .app-shell > .topbar .topbar-search-icon svg {
  width: 22px !important; height: 22px !important;
  color: var(--crm-iconsax-muted) !important;
}

/* Shared section navigation toggle, beside Back/Forward in every CRM section. */
body.is-crm-view-active .topbar > .crm-history #crmContentPreviewMenus {
  display: grid !important; place-items: center; position: relative !important;
  width: 36px !important; min-width: 36px !important; height: 36px !important;
  min-height: 36px !important; flex: 0 0 36px !important; padding: 0 !important;
  margin: 0 !important; align-self: center;
}
body.is-crm-view-active .crm-history #crmContentPreviewMenus > svg[data-iconsax] {
  width: 22px !important; height: 22px !important;
}
/* Match the quiet history arrows without dimming the hover tile. */
body.is-crm-view-active .topbar > .crm-history #crmContentPreviewMenus:not(:hover):not(:focus-visible):not([aria-pressed="true"]) > svg[data-iconsax] {
  opacity: .3 !important;
}
body.is-crm-view-active .topbar > .crm-history #crmContentPreviewMenus:not(:hover):not(:focus-visible):not([aria-pressed="true"]) > svg[data-iconsax] > .crm-iconsax-linear {
  color: var(--crm-palette-muted, #c7c8ca) !important;
}
html.crm-global-menus-hidden body.is-crm-view-active #roomView .room-page {
  grid-template-columns: var(--crm-global-rail-width, 248px) minmax(0, 1fr) !important;
}
html.crm-global-menus-hidden #roomView.crm-menu-collapsed,
html[data-trello-native].crm-global-menus-hidden #roomView { --crm-global-rail-width: var(--crm-primary-rail-width, 84px); }
html.crm-global-menus-hidden body.is-crm-view-active #roomView .room-page > .room-main { grid-column: 2 !important; }
html.crm-global-menus-hidden :is(#crmRetailMenu, .crm-wholesale-downloads, .crm-wholesale-preorders-menu,
  .crm-accounting-menu, .crm-marketing-second-menu, .marketing-email-menu) { display: none !important; }
html.crm-global-menus-hidden body.is-crm-view-active #roomView :is(.crm-wholesale-page, .crm-accounting-page):not(.is-hidden) {
  grid-template-columns: minmax(0, 1fr) !important;
}
html.crm-global-menus-hidden :is(.crm-wholesale-page, .crm-accounting-page) > :not(.crm-wholesale-downloads, .crm-wholesale-preorders-menu, .crm-accounting-menu) {
  grid-column: 1 !important;
}
html.crm-global-menus-hidden :is(.crm-marketing-workspace .site-exchange-filter-section.marketing-email-panel,
  .crm-marketing-workspace .marketing-promocodes-panel):not(.is-hidden) { grid-template-columns: minmax(0, 1fr) !important; }
html.crm-global-menus-hidden #settingsView :is(.settings-modal-head, .settings-values-menu) { display: none !important; }
html.crm-global-menus-hidden #settingsView :is(.settings-modal, .settings-layout) { grid-template-columns: minmax(0, 1fr) !important; }
html.crm-global-menus-hidden #settingsView .settings-modal-body { grid-column: 1 !important; }
html.crm-global-menus-hidden #mailView .mail-folder-panel { display: none !important; }
html.crm-global-menus-hidden #mailView .mail-content { grid-template-columns: minmax(280px, .95fr) minmax(420px, 1.45fr) !important; }
@media (max-width: 1100px) {
  html.crm-global-menus-hidden #mailView .mail-content { grid-template-columns: minmax(0, 1fr) !important; }
}

/* One consistent interval between every purchase toolbar control. */
body.is-crm-view-active:has(.crm-purchases-page:not(.is-hidden)) .topbar .crm-purchases-toolbar {
  justify-content: flex-end !important;
  gap: 6px !important;
}
body.is-crm-view-active:has(.crm-purchases-page:not(.is-hidden)) .topbar .crm-purchases-toolbar > button {
  margin: 0 !important;
  translate: none !important;
  width: 44px !important;
  min-width: 44px !important;
  flex: 0 0 44px !important;
}

/* Continue the primary rail rhythm horizontally from the profile avatar.
   Native popup positioning includes an 8px gap; replace it with one rail step. */
body.is-crm-view-active #crm-mac-profiles {
  --crm-profile-action-step: var(--crm-sidebar-toggle-height, 55px);
  margin-inline-start: calc(var(--crm-profile-action-step) - var(--crm-profile-size) - 8px);
  gap: calc(var(--crm-profile-action-step) - var(--crm-profile-size)) !important;
}

/* Native settings have more specific important column widths than other sections.
   Remove every navigation track together; leave the editor full-width. */
html:root.crm-global-menus-hidden body.is-crm-view-active #settingsView :is(.settings-modal, .settings-layout) {
  grid-template-columns: minmax(0, 1fr) !important;
}
html:root.crm-global-menus-hidden body.is-crm-view-active #settingsView .settings-modal {
  grid-template-rows: minmax(0, 1fr) !important;
}
html:root.crm-global-menus-hidden #settingsView :is(.settings-category-root-menu, .settings-catalog-category-menu) { display: none !important; }
html:root.crm-global-menus-hidden body.is-crm-view-active #settingsView :is(.settings-modal-body, .settings-main-panel) {
  grid-column: 1 / -1 !important; grid-row: 1 !important;
  min-width: 0 !important; max-width: none !important; width: auto !important;
}

/* Search scope is lime only while the user has enabled the global scope. */
body.is-crm-view-active .topbar .crm-purchase-search-scope {
  pointer-events: auto !important; cursor: pointer;
}
body.is-crm-view-active .topbar .crm-purchase-search-scope:focus-visible {
  outline: 1px solid var(--crm-iconsax-muted); outline-offset: 5px; border-radius: 3px;
}
body.is-crm-view-active .topbar .crm-purchase-search-scope.is-global-search > svg[data-iconsax] > :is(.crm-iconsax-linear, .crm-iconsax-bold) {
  color: #d6fa55 !important;
}
body.is-crm-view-active .topbar .crm-purchase-search-scope.is-global-search > svg[data-iconsax] > .crm-iconsax-linear { display: none !important; }
body.is-crm-view-active .topbar .crm-purchase-search-scope.is-global-search > svg[data-iconsax] > .crm-iconsax-bold { display: inline !important; }

/* Marketing has no duplicate refresh action or empty footer row. */
@media (min-width: 901px) {
  html:root[data-trello-native] body.is-crm-view-active #roomView #crmRetailMenu.is-marketing-menu.is-collapsed {
    grid-template-rows: minmax(0, 1fr) var(--crm-sidebar-toggle-height) !important;
  }
  html:root[data-trello-native] body.is-crm-view-active #roomView #crmRetailMenu.is-marketing-menu .crm-retail-refresh {
    display: none !important;
  }
  html:root[data-trello-native] body.is-crm-view-active #roomView #crmRetailMenu.is-marketing-menu #crmRetailToggle {
    grid-row: 2 !important;
  }
}
