/* erp-public-components-v1:
 * 全账号顶部公共控件最终契约。
 * 只统一尺寸、圆角、间距、焦点和禁用态；不改业务颜色、文案、位置、权限或点击逻辑。
 */

body.peter-topbar-trial {
  --gc-public-field-height: 36px;
  --gc-public-action-height: 34px;
  --gc-public-track-height: 36px;
  --gc-public-option-height: 28px;
  --gc-public-control-radius: 8px;
  --gc-public-option-radius: 6px;
  --gc-public-focus: 0 0 0 2px rgba(0, 122, 255, 0.16);
}

@media (min-width: 901px) {
  /* 开发 / 大货顶部，跟单 / 开发正文筛选，以及辅料 / 船务 / 版师档案切换共用同一轨道。 */
  body.peter-topbar-trial.gc-admin-shell-pilot :where(
    #controlsBar #client-filters,
    #controlsBar #sample-type-filters,
    #controlsBar #viewToggle,
    #controlsBar .filter-group,
    #controlsBar .view-toggle,
    .peter-followup-filter-stack .filter-group,
    .peter-dev-filter-stack .filter-group,
    .acc-sub-tabs,
    .ship-subtabs,
    .plog-view-toggle
  ) {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    height: var(--gc-public-track-height) !important;
    min-height: var(--gc-public-track-height) !important;
    padding: 3px !important;
    gap: 2px;
    border: 1px solid var(--line, #E5E5EA) !important;
    border-radius: var(--gc-public-control-radius) !important;
    background: rgba(120, 120, 128, 0.08) !important;
    box-shadow: none !important;
  }

  body.peter-topbar-trial.gc-admin-shell-pilot :where(
    #controlsBar .filter-btn,
    #controlsBar .view-toggle > button,
    .peter-followup-filter-stack .filter-btn,
    .peter-dev-filter-stack .filter-btn,
    .acc-sub-tab,
    .ship-subtab,
    .plog-view-toggle > button
  ) {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    height: var(--gc-public-option-height) !important;
    min-height: var(--gc-public-option-height) !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    border-radius: var(--gc-public-option-radius) !important;
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
  }

  /* 版师档案的一级资料切换保留整行层级，但使用同一圆角和高度节奏。 */
  body.peter-topbar-trial.gc-admin-shell-pilot .plog-section-tabs {
    box-sizing: border-box;
    min-height: var(--gc-public-track-height);
    padding: 3px;
    gap: 2px;
    border-radius: var(--gc-public-control-radius);
    background: rgba(120, 120, 128, 0.08);
  }

  body.peter-topbar-trial.gc-admin-shell-pilot .plog-section-tab {
    box-sizing: border-box;
    min-height: 30px;
    padding: 0 14px !important;
    border-radius: var(--gc-public-option-radius) !important;
    font-size: 12.5px !important;
    line-height: 1;
  }

  /* 非搜索字段统一为 36px；页面级圆形搜索继续保留现有 48px 规格。 */
  body.peter-topbar-trial.gc-admin-shell-pilot :where(
    #devDateFilter,
    #efDateFilter,
    .acc-filter-select,
    .acc-ef-date-wrap,
    .acc-search-input,
    .ship-search-input,
    .plog-searchbar,
    .admin-filterbar input:not([type="checkbox"]),
    .admin-filterbar select
  ) {
    box-sizing: border-box;
    height: var(--gc-public-field-height) !important;
    min-height: var(--gc-public-field-height) !important;
    border-radius: var(--gc-public-control-radius) !important;
  }

  /* public-filter-controls-v2: 补齐第一批页面中仍沿用模块私有尺寸的搜索与清除控件。 */
  body.peter-topbar-trial.gc-admin-shell-pilot :where(
    .acc-filter-clear,
    .admin-search-clear
  ) {
    box-sizing: border-box;
    height: var(--gc-public-field-height) !important;
    min-height: var(--gc-public-field-height) !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    border-radius: var(--gc-public-control-radius) !important;
  }

  /* 版师筛选已是 28px 胶囊；保留 Chip 语义，只锁定公共选项高度。 */
  body.peter-topbar-trial.gc-admin-shell-pilot .plog-chip {
    box-sizing: border-box;
    height: var(--gc-public-option-height) !important;
    min-height: var(--gc-public-option-height) !important;
  }

  /* 页头动作不与 36px 筛选轨道争层级；主按钮颜色仍由原业务样式决定。 */
  body.peter-topbar-trial.gc-admin-shell-pilot :where(
    .header-create-btn,
    .gc-admin-page-action,
    .pq2-report-btn,
    .ship-report-btn
  ) {
    box-sizing: border-box;
    height: var(--gc-public-action-height) !important;
    min-height: var(--gc-public-action-height) !important;
    border-radius: var(--gc-public-control-radius) !important;
  }

  body.peter-topbar-trial.gc-admin-shell-pilot .batch-toggle-btn {
    box-sizing: border-box;
    width: var(--gc-public-action-height) !important;
    min-width: var(--gc-public-action-height) !important;
    height: var(--gc-public-action-height) !important;
    min-height: var(--gc-public-action-height) !important;
    border-radius: var(--gc-public-control-radius) !important;
  }

  /* 当前筛选 chip 保留业务颜色，只收口高度；普通 chip / 状态标签不受本层影响。 */
  body.peter-topbar-trial.gc-admin-shell-pilot .ship-active-filter-chip {
    box-sizing: border-box;
    height: var(--gc-public-field-height);
    min-height: var(--gc-public-field-height);
    border-radius: 999px;
  }
}

@media (min-width: 1281px) {
  /* tracking-toolbar-state-stability-v1:
   * 宽屏日期栏出现时优先收缩搜索区，不压窄客户栏，WAREHOUSE 等末项始终完整显示。
   */
  body.peter-topbar-trial.gc-admin-shell-pilot:is(.dev-tab-active, .production-tab-active)
  #controlsBar #client-filters {
    flex: 0 0 auto;
    min-width: max-content;
    max-width: none;
    overflow-x: visible;
  }
}

body.peter-topbar-trial.gc-admin-shell-pilot :where(
  #controlsBar .filter-btn,
  #controlsBar .view-toggle > button,
  .peter-followup-filter-stack .filter-btn,
  .peter-dev-filter-stack .filter-btn,
  .acc-sub-tab,
  .ship-subtab,
  .plog-view-toggle > button,
  .plog-section-tab,
  .header-create-btn,
  .gc-admin-page-action,
  .pq2-report-btn,
  .ship-report-btn,
  .batch-toggle-btn,
  .acc-filter-clear,
  .admin-search-clear,
  .plog-chip,
  .plog-clear
) {
  transition:
    color 140ms ease,
    background-color 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease,
    transform 90ms ease;
}

body.peter-topbar-trial.gc-admin-shell-pilot :where(
  #controlsBar .filter-btn,
  #controlsBar .view-toggle > button,
  .peter-followup-filter-stack .filter-btn,
  .peter-dev-filter-stack .filter-btn,
  .acc-sub-tab,
  .ship-subtab,
  .plog-view-toggle > button,
  .plog-section-tab,
  .header-create-btn,
  .gc-admin-page-action,
  .pq2-report-btn,
  .ship-report-btn,
  .batch-toggle-btn,
  #devDateFilter,
  #efDateFilter,
  .acc-filter-select,
  .acc-search-input,
  .ship-search-input,
  #adminLogSearchInput,
  .acc-filter-clear,
  .admin-search-clear,
  .plog-chip,
  .plog-clear,
  .admin-filterbar select
):focus-visible {
  outline: 0;
  border-color: var(--apple-blue, #007AFF) !important;
  box-shadow: var(--gc-public-focus) !important;
}

body.peter-topbar-trial.gc-admin-shell-pilot .plog-searchbar:focus-within {
  border-color: var(--apple-blue, #007AFF) !important;
  box-shadow: var(--gc-public-focus) !important;
}

body.peter-topbar-trial.gc-admin-shell-pilot :where(
  #controlsBar,
  .peter-followup-filter-stack,
  .peter-dev-filter-stack,
  .acc-workbench-head,
  .ship-workbench-head,
  .plog-toolbar,
  .plog-section-tabs,
  .gc-admin-page-head,
  .pq2-top,
  .admin-filterbar
) :where(button, input, select):disabled,
body.peter-topbar-trial.gc-admin-shell-pilot :where(
  #controlsBar,
  .peter-followup-filter-stack,
  .peter-dev-filter-stack,
  .acc-workbench-head,
  .ship-workbench-head,
  .plog-toolbar,
  .plog-section-tabs,
  .gc-admin-page-head,
  .pq2-top,
  .admin-filterbar
) [aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.48;
}

@media (max-width: 900px) {
  /* 手机只保证触控安全，不改变筛选排列、滚动方式或业务内容。 */
  body.peter-topbar-trial :where(
    #controlsBar .filter-btn,
    #controlsBar .view-toggle > button,
    .peter-followup-filter-stack .filter-btn,
    .peter-dev-filter-stack .filter-btn,
    .acc-sub-tab,
    .ship-subtab,
    .plog-view-toggle > button,
    .plog-section-tab,
    .header-create-btn,
    .gc-admin-page-action,
    .pq2-report-btn,
    .ship-report-btn
  ) {
    min-height: 44px !important;
  }

  body.peter-topbar-trial :where(
    #devDateFilter,
    #efDateFilter,
    .acc-filter-select,
    .acc-ef-date-wrap,
    .acc-search-input,
    .ship-search-input,
    .plog-searchbar,
    .admin-filterbar input:not([type="checkbox"]),
    .admin-filterbar select
  ) {
    min-height: 44px !important;
  }

  body.peter-topbar-trial :where(
    .acc-filter-clear,
    .admin-search-clear,
    .plog-chip
  ) {
    min-height: 44px !important;
  }

  /* 搜索框内的清除图标不改变外层高度，但扩大手机点击面。 */
  body.peter-topbar-trial .plog-searchbar .plog-clear {
    width: 32px;
    min-width: 32px;
    height: 32px;
    min-height: 32px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.peter-topbar-trial.gc-admin-shell-pilot :where(
    #controlsBar,
    .peter-followup-filter-stack,
    .peter-dev-filter-stack,
    .acc-workbench-head,
    .ship-workbench-head,
    .plog-toolbar,
    .plog-section-tabs,
    .gc-admin-page-head,
    .pq2-top,
    .admin-filterbar
  ) :where(button, input, select) {
    transition-duration: 0.01ms !important;
  }
}

/* public-filter-controls-v2:end */
/* erp-public-components-v1:end */
