/* Inventory shortcuts share the card surface and use the active theme for interaction feedback. */
@layer jp-inset-controls {
  @media screen {
    #jp-native-root .center-shell .ia-v7-current .ia-facts {
      container-type: inline-size;
      gap: clamp(8px, .625vw, 20px) !important;
      align-items: stretch !important;
    }
    #jp-native-root .center-shell .ia-v7-current .ia-facts > button {
      --fact-color: var(--color-bg-card);
      display:flex !important;
      flex-direction:column !important;
      justify-content:center !important;
      align-items:flex-start !important;
      min-width:0 !important;
      min-height: 52px !important;
      gap: 5px !important;
      padding: clamp(10px, .47vw, 16px) clamp(12px, .82vw, 24px) !important;
      border:1px solid var(--color-border-default) !important;
      border-radius:10px !important;
      background:var(--fact-color) !important;
      color:var(--color-text-primary) !important;
      text-align:start !important;
      transition:background-color var(--motion-hover,140ms) ease-out, border-color var(--motion-hover,140ms) ease-out !important;
    }
    #jp-native-root .center-shell .ia-v7-current .ia-facts > button > :is(b,span) {
      max-width:100%;
      min-width:0;
      color:inherit !important;
      white-space:normal !important;
      overflow-wrap:anywhere;
      text-align:start !important;
    }
    @container (max-width: 340px) {
      #jp-native-root .center-shell .ia-v7-current .ia-facts > button {padding:10px 11px !important;}
    }
    @media (max-width:355px) {
      #jp-native-root .center-shell .ia-v7-current .ia-facts {
        grid-template-columns: minmax(0,1fr) !important;
        gap:6px !important;
      }
      #jp-native-root .center-shell .ia-v7-current .ia-facts > button {
        flex-direction:row !important;
        align-items:center !important;
        justify-content:space-between !important;
        flex-wrap:wrap;
        gap:4px 12px !important;
        min-height:44px !important;
        padding:8px 12px !important;
      }
    }
    @media (hover:hover) and (pointer:fine) {
      #jp-native-root .center-shell .ia-v7-current .ia-facts > button:enabled:hover {
        --fact-color:var(--color-hover);
        border-color:var(--color-selected-border) !important;
      }
    }
    #jp-native-root .center-shell .ia-v7-current .ia-facts > button:enabled:active {
      --fact-color:var(--color-active);
      transition-duration:65ms !important;
    }
    #jp-native-root .center-shell .ia-v7-current .ia-facts > button:focus-visible {
      outline:2px solid var(--color-focus) !important;
      outline-offset:2px !important;
    }
    @media (prefers-reduced-motion:reduce) {
      #jp-native-root .center-shell .ia-v7-current .ia-facts > button {
        transition:none !important;
      }
    }
    @media (forced-colors:active) {
      #jp-native-root .center-shell .ia-v7-current .ia-facts > button {
        border:1px solid ButtonText !important;
      }
      #jp-native-root .center-shell .ia-v7-current .ia-facts > button:focus-visible {
        outline-color:Highlight !important;
      }
    }
  }
}

@layer jp-inset-controls {
  @media screen {
    /* These buttons are set into a coloured surface. Keep the feedback inside the hit target. */
    #jp-native-root .center-shell :is(.cockpit-revenue,.cm-group-primary,.ps-v7-net-zone,.fs-profit-summary) {
      --hero-inset-x: clamp(14px, 0.85vw, 24px);
      --hero-inset-y: clamp(10px, 0.6vw, 16px);
      --hero-wash: rgb(9 51 125 / 21%);
      --hero-down: rgb(6 40 104 / 38%);
    }
    #jp-native-root .center-shell .cockpit-revenue > .cockpit-primary-metric {
      box-sizing: border-box !important;
      container-type: inline-size;
      padding: var(--hero-inset-y) var(--hero-inset-x) !important;
      border-radius: 12px !important;
      min-width: 0 !important;
    }
    #jp-native-root .center-shell .cockpit-primary-metric > strong.is-wide-number,
    #jp-native-root .center-shell .fs-profit-value > strong.is-wide-number {
      font-size: clamp(18px, 10cqi, 52px) !important;
    }
    #jp-native-root .center-shell .cockpit-primary-metric .cockpit-comparison {
      background: rgb(10 49 117 / 38%) !important;
      color: white !important;
    }
    #jp-native-root .center-shell .cockpit-primary-metric .cockpit-comparison > * {
      color: inherit !important;
    }
    #jp-native-root .center-shell .cm-summary-v7 .cm-group-primary {
      box-sizing: border-box;
      padding: 8px !important;
      gap: 10px !important;
    }
    #jp-native-root .center-shell .cm-group-primary > .cm-stat {
      padding: var(--hero-inset-y) var(--hero-inset-x) !important;
      border: 0 !important;
      border-radius: 10px !important;
    }
    #jp-native-root .center-shell .cm-group-primary > .cm-total-stat {
      background: rgb(11 56 128 / 26%) !important;
    }
    #jp-native-root .center-shell .cm-group-primary .cm-primary-stat > div > strong {
      min-inline-size: 0;
      max-inline-size: 100%;
      white-space: normal !important;
      overflow-wrap: anywhere;
    }
    #jp-native-root .center-shell .fs-profit-summary .fs-profit-value {
      box-sizing: border-box;
      container-type: inline-size;
      border-radius: 10px !important;
      padding: calc(var(--hero-inset-y) + 3px) var(--hero-inset-x) !important;
      margin-block: 12px 8px !important;
      height: auto !important;
      flex-wrap: wrap;
      min-width: 0;
    }
    #jp-native-root .center-shell .fs-profit-summary .fs-profit-value strong {
      max-width: 100%;
      overflow-wrap: anywhere;
    }
    #jp-native-root .center-shell .fs-profit-summary .fs-margin {
      padding: var(--hero-inset-y) var(--hero-inset-x) !important;
      align-items: center !important;
    }
    #jp-native-root .center-shell .fs-profit-summary .fs-formula {
      box-sizing: border-box;
      padding: 12px var(--hero-inset-x) !important;
      gap: 12px !important;
    }
    #jp-native-root .center-shell :is(.cockpit-primary-metric,.cm-group-primary > button,.ps-v7-net-zone > button,.fs-profit-value,.fs-margin):focus-visible {
      outline: 2px solid white !important;
      outline-offset: -3px !important;
    }
    @media (hover:hover) and (pointer:fine) {
      #jp-native-root .center-shell :is(.cockpit-primary-metric,.cm-group-primary > button,.fs-profit-value):hover:not(:disabled) {
        background: var(--hero-wash) !important;
      }
      #jp-native-root .center-shell .cockpit-revenue .cp-profit-pair > button:hover:not(:disabled) {
        background: rgb(40 101 188 / 9%) !important;
      }
    }
    #jp-native-root .center-shell :is(.cockpit-primary-metric,.cm-group-primary > button,.fs-profit-value,.fs-margin,.ps-v7-net-zone > button):active:not(:disabled) {
      background: var(--hero-down) !important;
    }
    @media (min-width:1100px) {
      /* Previous absolute height left the explanation below the white panel. */
      #jp-native-root .center-shell .cockpit-revenue .cockpit-revenue-details {
        height: auto !important;
        max-height: none !important;
        min-height: 0 !important;
        top: auto !important;
        padding-block: 14px !important;
      }
    }
    @media (min-width:768px) and (max-width:1099px) {
      #jp-native-root .center-shell .cockpit-revenue .cp-profit-pair > button {
        padding: 8px 12px !important;
      }
    }
    @media (max-width:767px) {
      #jp-native-root .center-shell .cockpit-revenue {
        height: auto !important;
        padding: 12px 10px !important;
        column-gap: 8px !important;
      }
      #jp-native-root .center-shell .cockpit-revenue .cp-profit-pair > button {
        border-radius: 10px !important;
        padding: 8px 10px !important;
      }
      #jp-native-root .center-shell .cockpit-revenue .cp-profit-pair > button:focus-visible {
        outline: 2px solid white !important;
        outline-offset: -3px !important;
      }
      #jp-native-root .center-shell .cockpit-revenue .cp-profit-pair > button:active:not(:disabled) {
        background: var(--hero-down) !important;
      }
      #jp-native-root .center-shell .cockpit-revenue .cockpit-revenue-details {
        padding: 0 0 0 6px !important;
      }
      #jp-native-root .center-shell .cockpit-revenue-details > p {
        margin: 4px 10px 0 !important;
      }
      #jp-native-root .center-shell .fs-profit-summary .fs-formula {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 8px !important;
      }
      #jp-native-root .center-shell .fs-profit-summary .fs-formula > div {
        display: flex !important;
        align-items: baseline;
        justify-content: space-between;
        gap: 12px;
      }
      #jp-native-root .center-shell .fs-profit-summary .fs-formula dd {
        justify-content: flex-end !important;
        text-align: right !important;
      }
      #jp-native-root .center-shell .fs-profit-summary .fs-formula dt {
        flex: none;
        margin: 0 !important;
      }
    }
    @media (max-width:540px) {
      #jp-native-root .center-shell .cockpit-revenue:has(strong.is-wide-number) {
        grid-template-columns: minmax(0,1fr) !important;
      }
      #jp-native-root .center-shell .cockpit-revenue:has(strong.is-wide-number) .cockpit-revenue-details {
        border-inline-start: 0 !important;
      }
    }
    @media (forced-colors: active) {
      #jp-native-root .center-shell :is(.cockpit-primary-metric,.cm-group-primary > button,.ps-v7-net-zone > button,.fs-profit-value,.fs-margin,.cp-profit-pair > button):focus-visible {
        outline-color: Highlight !important;
      }
    }
  }
}

/* Mobile workbench links are full-row hit targets, including both the label and count. */
@media screen {
  #jp-native-root .mm-root .home-todos > a.mm-list-line {
    padding: 12px clamp(12px, 2vw, 16px) !important;
    border: 0 !important;
    border-radius: 10px;
    background-color: color-mix(in srgb, var(--e-blue, #2563eb) 4%, var(--e-surface, white));
    box-sizing: border-box;
  }
  #jp-native-root .mm-root .home-todos > a.mm-list-line + a.mm-list-line {
    margin-block-start: 6px;
  }
  @media (hover: hover) and (pointer: fine) {
    #jp-native-root .mm-root .home-todos > a.mm-list-line:hover {
      background-color: color-mix(in srgb, var(--e-blue, #2563eb) 8%, var(--e-surface, white));
    }
  }
  #jp-native-root .mm-root .home-todos > a.mm-list-line:active {
    background-color: color-mix(in srgb, var(--e-blue, #2563eb) 13%, var(--e-surface, white));
  }
}

@layer jp-inset-controls {
  @media screen {
    /* Numeric rows share their existing list surface. The coloured feedback belongs
       to the padded button, so the leading label and trailing value stay inside it. */
    #jp-native-root .center-shell :is(.cash-warehouse-list,.structure-category-list,
        .st-channel-list,.st-category-list,.as-mix-legend > li,.as-type-row > header,
        .cm-frequency-bars,.as-state-counts,.ia-category-list) > button:not(:disabled) {
      padding-inline: clamp(12px, 0.7vw, 18px) !important;
      box-sizing: border-box;
      min-inline-size: 0;
    }
    #jp-native-root .center-shell :is(.cash-warehouse-list,.structure-category-list,.cm-frequency-bars,
        .st-channel-list,.st-category-list,.ia-category-list) {
      row-gap: 6px !important;
    }
    #jp-native-root .center-shell .as-state-counts { gap: 6px !important; }
    #jp-native-root .center-shell .cash-headlines > button,
    #jp-native-root .center-shell .ia-expiry-footer > button:not(.primary-button) {
      padding: 10px clamp(12px, 0.8vw, 18px) !important;
      min-inline-size: 0;
      box-sizing: border-box;
      border-inline-start: 0 !important;
    }
    #jp-native-root .center-shell .ia-expiry-footer > button:not(.primary-button) {
      flex-wrap: wrap;
      row-gap: 4px;
      white-space: normal !important;
    }
    #jp-native-root .center-shell .ia-category-list > button {
      padding-block: 12px !important;
    }
    #jp-native-root .center-shell .ps-panel-heading > .ps-concentration {
      padding-inline: 12px !important;
      border-radius: 8px !important;
      white-space: normal !important;
    }
    #jp-native-root .center-shell .sf-table > :is(.sf-table-head,.sf-product-row) {
      padding-inline: 12px !important;
      box-sizing: border-box;
    }
    @media (max-width: 767px) {
      #jp-native-root .center-shell :is(.ia-category-list,.ps-category-list) {
        display: grid !important;
        grid-template-columns: minmax(0,1fr) !important;
        row-gap: 6px !important;
      }
      #jp-native-root .center-shell .cockpit-content > .risk-strip .risk-item {
        padding-inline: 12px !important;
        box-sizing: border-box;
      }
    }
    @media (min-width: 768px) {
      #jp-native-root .center-shell .cockpit-funds-card .risk-strip {
        column-gap: clamp(8px,.6vw,16px) !important;
      }
      #jp-native-root .center-shell .cockpit-funds-card .risk-strip > .risk-item {
        border-inline-start: 0 !important;
      }
      #jp-native-root .p-payroll > .p-steps {row-gap: 8px !important;}
      #jp-native-root .p-payroll > .p-steps > button {
        padding-inline: 12px !important;
        box-sizing: border-box;
      }
    }
    #jp-native-root .center-shell :is(.cash-warehouse-list,.cash-headlines,.structure-category-list,
        .st-channel-list,.st-category-list,.as-mix-legend > li,.cm-frequency-bars,.as-state-counts,
        .as-type-row > header,.ia-category-list,.ia-expiry-footer,.ps-supplier-totals) > button:not(.primary-button,:disabled) {
      border-radius: 8px !important;
      transition: background-color 130ms ease-out,box-shadow 130ms ease-out !important;
      &:focus-visible {outline: 2px solid var(--mc-feedback-ink,#2868d4) !important; outline-offset: -2px !important;}
      @media (hover:hover) and (pointer:fine) {
        &:hover:not(.selected,[aria-pressed="true"]) {
          background-color: var(--mc-hover-wash,rgb(36 101 210 / 5%)) !important;
        }
      }
      &:active {
        box-shadow: inset 0 0 0 100vmax var(--mc-press-wash,rgb(36 101 210 / 10%)) !important;
        transition-duration: 55ms !important;
      }
      @media (prefers-reduced-motion:reduce) {transition: none !important;}
    }
    @media (max-width: 540px) {
      #jp-native-root .center-shell .ps-supplier-totals {
        grid-template-columns: minmax(0,1fr) !important;
        gap: 8px !important;
      }
      #jp-native-root .center-shell .ps-supplier-totals > button {
        display: flex !important;
        flex-flow: row wrap !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 4px 12px !important;
        min-height: 48px !important;
        padding: 8px 14px !important;
      }
      #jp-native-root .center-shell .ps-supplier-totals > button > :is(strong,span) { margin: 0 !important; }
    }
    @media (max-width: 359px) {
      #jp-native-root .center-shell .cash-headlines > button {
        display: grid !important;
        grid-template-columns: minmax(0,1fr) !important;
        justify-items: start !important;
        align-content: start;
        gap: 6px !important;
      }
    }
    @media (forced-colors:active) {
      #jp-native-root .center-shell :is(button,[role="button"]):focus-visible {outline-color: Highlight !important;}
    }
  }
}
