/* Plan receipt identity and stacked advertising-data filters.
 * Keep the shared control material; only the toolbar's label layout changes.
 */
@layer apple-proportions {
  #app-shell #view #ad-data-content .ad-data-shared-mode-head.ad-data-toolbar-stacked {
    display: grid !important;
    grid-template-columns: 200px minmax(0, 1fr) max-content !important;
    align-items: end !important;
    gap: 8px 12px !important;
    height: auto !important;
    min-height: 72px !important;
    max-height: none !important;
    padding: 8px !important;
  }

  #app-shell #view #ad-data-content .ad-data-toolbar-stacked .ad-data-head-filters {
    display: flex !important;
    align-items: end !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 56px !important;
    max-height: none !important;
  }

  #app-shell #view #ad-data-content .ad-data-toolbar-stacked .ad-data-head-filters > :is(.ad-data-stacked-filter, .ad-data-date-picker) {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: 16px 36px !important;
    align-items: stretch !important;
    gap: 4px !important;
    height: 56px !important;
    min-height: 56px !important;
    max-height: none !important;
    margin: 0 !important;
  }

  #app-shell #view #ad-data-content .ad-data-toolbar-stacked .ad-data-head-filters .filter-label {
    display: block !important;
    align-self: start !important;
    height: 16px !important;
    min-height: 16px !important;
    max-height: 16px !important;
    padding: 0 !important;
    color: var(--ar-secondary, var(--ta-ink-soft)) !important;
    font-size: var(--ar-caption, 11px) !important;
    font-weight: var(--ar-weight-label, 500) !important;
    line-height: 16px !important;
    white-space: nowrap !important;
  }

  #app-shell #view #ad-data-content .ad-data-toolbar-stacked .ad-data-status-filter {
    width: 152px !important;
    min-width: 136px !important;
    max-width: none !important;
    flex: 1 1 136px !important;
  }
  #app-shell #view #ad-data-content .ad-data-toolbar-stacked .ad-data-receipt-filter {
    width: 112px !important;
    min-width: 104px !important;
    max-width: none !important;
    flex: 0.75 1 104px !important;
  }
  #app-shell #view #ad-data-content .ad-data-toolbar-stacked .ad-data-platform-filter {
    width: 124px !important;
    min-width: 116px !important;
    max-width: none !important;
    flex: 0.85 1 116px !important;
  }
  #app-shell #view #ad-data-content .ad-data-toolbar-stacked .ad-data-member-filter {
    width: 148px !important;
    min-width: 132px !important;
    max-width: none !important;
    flex: 1 1 132px !important;
  }
  #app-shell #view #ad-data-content .ad-data-toolbar-stacked .ad-data-date-picker {
    width: 180px !important;
    min-width: 160px !important;
    max-width: none !important;
    flex: 1 1 160px !important;
  }
  #app-shell #view #ad-data-content .ad-data-toolbar-stacked .ad-data-search-field {
    width: 260px !important;
    min-width: 208px !important;
    max-width: none !important;
    flex: 1.6 1 208px !important;
  }

  /* Size the toolbar controls only; the operator popover keeps its square checkboxes. */
  #app-shell #view #ad-data-content .ad-data-toolbar-stacked .ad-data-head-filters > :is(.ad-data-stacked-filter, .ad-data-date-picker) > :is(.store-choice-menu, .ad-data-search-control, .custom-select-wrap, .date-picker-trigger, select),
  #app-shell #view #ad-data-content .ad-data-toolbar-stacked .ad-data-head-filters > .ad-data-stacked-filter > .custom-select-wrap > .custom-select-trigger,
  #app-shell #view #ad-data-content .ad-data-toolbar-stacked .ad-data-head-filters > .ad-data-stacked-filter > .store-choice-menu > .store-choice-trigger,
  #app-shell #view #ad-data-content .ad-data-toolbar-stacked .ad-data-head-filters > .ad-data-stacked-filter > .ad-data-search-control > :is(input, #ad-data-keyword-submit) {
    box-sizing: border-box;
    height: 36px !important;
    min-height: 36px !important;
    max-height: 36px !important;
  }
  #app-shell #view #ad-data-content .ad-data-toolbar-stacked .ad-data-head-filters > :is(.ad-data-stacked-filter, .ad-data-date-picker) > :is(.store-choice-menu, .custom-select-wrap, .date-picker-trigger, select),
  #app-shell #view #ad-data-content .ad-data-toolbar-stacked .ad-data-head-filters > .ad-data-stacked-filter > .custom-select-wrap > .custom-select-trigger,
  #app-shell #view #ad-data-content .ad-data-toolbar-stacked .ad-data-head-filters > .ad-data-stacked-filter > .store-choice-menu > .store-choice-trigger {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }
  #app-shell #view #ad-data-content .ad-data-toolbar-stacked .ad-data-search-control {
    width: 100% !important;
    min-width: 0 !important;
    align-items: stretch !important;
  }
  #app-shell #view #ad-data-content .ad-data-toolbar-stacked .ad-data-report-top-controls {
    align-self: end !important;
    margin-left: 0 !important;
  }

  #app-shell #view #ad-data-content .ad-campaign-name-line {
    min-width: 0 !important;
    align-items: center !important;
    overflow: hidden !important;
    white-space: nowrap !important;
  }
  #app-shell #view #ad-data-content .ad-campaign-name-line > .ad-campaign-name-text {
    flex: 0 1 auto;
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }
  #app-shell #view #ad-data-content .ad-campaign-receipt-badge,
  body .ad-roas-plan-settings .ad-campaign-receipt-badge {
    display: inline-flex !important;
    flex: 0 0 auto !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    height: 20px !important;
    min-height: 20px !important;
    max-height: 20px !important;
    padding: 0 5px !important;
    border: 1px solid var(--ar-neutral-line, var(--ta-line)) !important;
    border-radius: 4px !important;
    background: var(--ar-neutral-soft, var(--ta-surface-soft)) !important;
    color: var(--ar-secondary, var(--ta-ink-soft)) !important;
    font-size: var(--ar-caption, 11px) !important;
    font-weight: var(--ar-weight-label, 500) !important;
    line-height: 18px !important;
    white-space: nowrap !important;
  }

  @media (max-width: 1599px) {
    #app-shell #view #ad-data-content .ad-data-shared-mode-head.ad-data-toolbar-stacked {
      grid-template-columns: 200px minmax(0, 1fr) !important;
    }
    #app-shell #view #ad-data-content .ad-data-toolbar-stacked .ad-data-report-top-controls {
      grid-column: 1 / -1;
      justify-self: end;
    }
  }
  @media (max-width: 1180px) {
    #app-shell #view #ad-data-content .ad-data-shared-mode-head.ad-data-toolbar-stacked {
      grid-template-columns: minmax(0, 1fr) !important;
    }
    #app-shell #view #ad-data-content .ad-data-toolbar-stacked .ad-data-head-filters {
      display: grid !important;
      grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    }
    #app-shell #view #ad-data-content .ad-data-toolbar-stacked .ad-data-head-filters > :is(.ad-data-stacked-filter, .ad-data-date-picker) {
      width: 100% !important;
      min-width: 0 !important;
      max-width: none !important;
    }
    #app-shell #view #ad-data-content .ad-data-toolbar-stacked .ad-data-search-field {
      grid-column: span 2;
    }
  }
  @media (max-width: 760px) {
    #app-shell #view #ad-data-content .ad-data-toolbar-stacked .ad-data-head-filters {
      grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
    #app-shell #view #ad-data-content .ad-data-toolbar-stacked .ad-data-report-top-controls {
      width: 100%;
      min-width: 0;
      max-width: 100%;
      flex-wrap: wrap !important;
      justify-self: stretch;
      justify-content: flex-start;
    }
  }
  @media (max-width: 400px) {
    #app-shell #view #ad-data-content .ad-data-toolbar-stacked .ad-data-head-filters {
      grid-template-columns: minmax(0, 1fr) !important;
    }
    #app-shell #view #ad-data-content .ad-data-toolbar-stacked .ad-data-search-field {
      grid-column: auto;
    }
  }
}
