/* gc-ui-system.css
 * ui-design-system-v1
 * 最后加载的屏幕 UI 规范层：统一设计语言，不改业务结构和打印内容。
 */

:root {
  /* emil-motion-system-v1：专业工作台只保留有目的的短动效。 */
  --gc-ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --gc-ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --gc-ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --gc-motion-press: 90ms;
  --gc-motion-small-enter: 160ms;
  --gc-motion-small-exit: 110ms;
  --gc-motion-panel-enter: 240ms;
  --gc-motion-panel-exit: 170ms;
  /* form-dialog-system-v1：全站三段式表单弹窗统一尺寸。 */
  --gc-form-dialog-width: 680px;
  --gc-form-dialog-max-height: min(86vh, 900px);
  --gc-form-dialog-radius: 16px;
  --gc-form-dialog-header-height: 64px;
  --gc-form-dialog-footer-height: 64px;
  --gc-form-dialog-body-padding: 22px 28px 28px;
  --gc-form-dialog-shadow: 0 24px 70px rgba(15, 23, 42, 0.18), 0 3px 12px rgba(15, 23, 42, 0.07);
}

/* === Emil 动效契约 ===
   高频操作即时；偶发浮层短动效；只动画 transform / opacity。 */
.drawer-backdrop {
  transition: opacity 150ms var(--gc-ease-out);
}

.drawer-backdrop.open {
  transition-duration: 190ms;
}

.drawer {
  transition: transform var(--gc-motion-panel-exit) var(--gc-ease-out);
}

.drawer.open {
  transition-duration: var(--gc-motion-panel-enter);
  transition-timing-function: var(--gc-ease-drawer);
}

.app-dialog-backdrop.peter-global-dialog-pilot {
  transition: opacity 130ms var(--gc-ease-out);
}

.app-dialog-backdrop.peter-global-dialog-pilot.open {
  transition-duration: 170ms;
}

.app-dialog-backdrop.peter-global-dialog-pilot .app-dialog {
  transform-origin: center;
  transition:
    transform 130ms var(--gc-ease-out),
    opacity 110ms var(--gc-ease-out);
}

.app-dialog-backdrop.peter-global-dialog-pilot.open .app-dialog {
  transition-duration: 170ms, 150ms;
}

/* Toast 可被连续触发和反向退出，使用 transition，不使用会重启的 keyframes。 */
.toast {
  opacity: 0;
  transform: translateY(-10px) scale(0.98);
  animation: none !important;
  transition:
    opacity 150ms var(--gc-ease-out),
    transform 180ms var(--gc-ease-out);
  will-change: transform, opacity;
}

.toast.toast-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast.toast-out,
.toast.fading {
  opacity: 0;
  transform: translateY(-8px) scale(0.985);
  animation: none !important;
  transition-duration: 110ms, 120ms;
  pointer-events: none;
}

/* Peter 已验证的轻按压反馈推广到公共按钮；不碰列表行和键盘导航。 */
:where(
  .btn-new,
  .header-create-btn,
  .filter-btn,
  .gc-admin-page-action,
  .app-dialog-btn,
  .peter-ai-btn,
  .peter-ai-draft-mini-btn,
  .qt-primary-btn,
  .qt-ghost-btn,
  .pet-mail-btn,
  .pet-mail-mini-btn,
  .gc-cu-btn-primary,
  .gc-cu-btn-secondary,
  .gc-cu-pending-qbtn,
  .gc-sdf-mini-btn,
  .gc-sdf-invoice-btn,
  .gc-sdf-print-btn,
  .ship-report-btn,
  .ship-action-btn,
  .pq2-report-btn,
  .pq2-btn,
  .gc-rpt-btn,
  .fg-back-btn,
  .list-load-more-btn,
  .drawer-close,
  .msheet-btn
):not(:disabled):active {
  transform: translateY(1px) scale(0.985);
  transition-duration: var(--gc-motion-press);
}

/* 高频重渲染不做入场动画；业务状态继续通过颜色和文案表达。 */
.style-row {
  animation: none !important;
}

/* Cmd/Ctrl+K 属于高频键盘动作，打开和关闭都必须即时。 */
.erp-command-search-backdrop.erp-command-search-instant,
.erp-command-search-backdrop.erp-command-search-instant .erp-command-search-dialog {
  transition: none !important;
}

.days-warn .days-indicator,
.days-danger .days-indicator,
.big-flow-dot.current,
.big-flow-dot.current.current-danger,
.prod-tile.urg-overdue-severe,
.ship-stage-cell.current,
.acc-chip.pending,
.plog-quote.todo .pulse-dot,
.qn-pulse-lg {
  animation: none !important;
}

/* 富文本工具 Popover 从触发按钮方向出现，关闭更快。 */
.size-popover,
.color-popover {
  opacity: 0;
  transform: translateY(-4px) scale(0.98);
  transform-origin: top left;
  transition:
    opacity 120ms var(--gc-ease-out),
    transform var(--gc-motion-small-enter) var(--gc-ease-out);
}

.size-popover.is-open,
.color-popover.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.size-popover.is-closing,
.color-popover.is-closing {
  pointer-events: none;
  transition-duration: 90ms, var(--gc-motion-small-exit);
}

.color-popover .color-swatch:hover {
  transform: none;
}

@media (hover: hover) and (pointer: fine) {
  .color-popover .color-swatch:hover {
    transform: scale(1.12);
  }
}

/* === 全站屏幕字体 === */
html,
body,
.app-shell,
main#main {
  font-family: var(--font-sans);
}

body button,
body input,
body select,
body textarea {
  font-family: var(--font-sans);
}

/* 旧版曾使用 serif / monospace 的屏幕控件统一回系统字体。 */
.brand h1,
.global-tools > button,
.global-tools .alert-bell-badge,
.client-contact-email,
.admin-storage-path,
.admin-ip,
.pv2-div .ct,
.gc-sdf-item-sku,
.gc-sdf-filter-meta,
.gc-cu-ct-email,
.gc-cu-chip,
.gc-cu-pending-row .sku,
.gc-cu-pending-row .date,
.v16-sb-close .kbd,
.v16-sb-item .ct,
.v16-row .r-age,
.v16-row .r-skus,
.v16-dept-h .ct,
.v16-sig-tab .n,
.v16-card .sku,
.recycle-line3 {
  font-family: var(--font-sans) !important;
}

.brand h1,
main#main :is(
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  [class$="-title"],
  [class*="-title "]
) {
  font-style: normal !important;
}

/* 高频页面的辅助文字、标签和小状态只使用统一三级字号。 */
main#main :is(
  .today-page,
  .archive-page-v2,
  .patternlog-page,
  .plog-page,
  .ship-page,
  .acc-page,
  .client-info-page,
  .followup-guide-page,
  .dash-page,
  .fudesk-page,
  .pfdesk-page,
  .recycle-page,
  .admin-wrap,
  .peter-ai-workbench-page,
  .quote-tool-page,
  .pet-mail-page,
  .recording-dashboard
) :is(
  [class$="-meta"],
  [class*="-meta "],
  [class$="-hint"],
  [class*="-hint "],
  small
) {
  font-size: var(--gc-type-caption);
}

main#main :is(
  .today-page,
  .archive-page-v2,
  .patternlog-page,
  .plog-page,
  .ship-page,
  .acc-page,
  .client-info-page,
  .followup-guide-page,
  .dash-page,
  .fudesk-page,
  .pfdesk-page,
  .recycle-page,
  .admin-wrap,
  .peter-ai-workbench-page,
  .quote-tool-page,
  .pet-mail-page,
  .recording-dashboard
) :is(
  [class$="-label"],
  [class*="-label "],
  [class$="-chip"],
  [class*="-chip "],
  [class$="-badge"],
  [class*="-badge "],
  [class$="-tag"],
  [class*="-tag "]
) {
  font-size: var(--gc-type-label);
}

:is(
  .header-stats,
  .sku,
  .barcode,
  .po-no,
  .admin-storage-path,
  .admin-ip,
  .client-contact-email,
  .gc-sdf-item-sku,
  .v16-row .r-age,
  .v16-row .r-skus
) {
  font-variant-numeric: tabular-nums;
}

/* === 标题层级 === */
:is(
  .client-info-title h1,
  .peter-ai-workbench-title,
  .fg-header-copy h1
) {
  font-family: var(--font-sans);
  font-size: var(--gc-type-display);
  font-weight: 760;
  line-height: 1.15;
  letter-spacing: 0;
}

:is(
  .ship-page-title,
  .acc-page-title,
  .patternlog-title,
  .plog-title,
  .dashboard-title,
  .dash-title,
  .fudesk-title,
  .plog-title,
  .admin-page-head h2,
  .recording-dashboard-heading h1
) {
  font-family: var(--font-sans);
  font-size: var(--gc-type-page-title);
  font-weight: 740;
  line-height: 1.2;
  letter-spacing: 0;
}

:is(
  .client-info-content-head h2,
  .client-info-modal-title,
  .section-title,
  .drawer-title,
  .app-dialog-title
) {
  font-family: var(--font-sans);
  font-size: var(--gc-type-heading);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0;
}

/* 产品界面不使用负字距。打印纸和邮件正文保留自己的输出排版。 */
:is(
  .brand h1,
  .client-info-page h1,
  .client-info-page h2,
  .fg-header-copy h1,
  .ship-page-title,
  .patternlog-title,
  .dashboard-title,
  .peter-ai-workbench-title,
  .global-tools > button
) {
  letter-spacing: 0 !important;
}

/* === 表单与操作控件 === */
main#main :is(
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  select,
  textarea
) {
  font-family: var(--font-sans);
  font-size: var(--gc-type-ui);
  border-radius: var(--gc-field-radius);
}

main#main :is(
  button,
  [role="button"]
) {
  font-family: var(--font-sans);
}

main#main button:not([class*="chip"]):not([class*="pill"]):not([class*="tab"]):not([class*="toggle"]):not([class*="icon"]):not([class*="close"]):not([class*="avatar"]):not([class*="search"]) {
  border-radius: var(--gc-button-radius);
}

main#main button:is([class*="chip"], [class*="tab"], [class*="filter"]) {
  min-height: var(--gc-button-height-compact);
  font-size: var(--gc-type-label);
}

:is(
  .app-dialog-btn,
  .client-info-add,
  .client-info-back-ai,
  .client-info-danger,
  .client-info-secondary,
  .client-info-primary,
  .ship-report-btn,
  .pq2-report-btn,
  .fg-back-btn,
  .peter-ai-btn,
  .gc-cu-btn-primary,
  .gc-cu-btn-secondary
) {
  min-height: var(--gc-button-height);
  border-radius: var(--gc-button-radius);
  font-size: var(--gc-type-body);
  font-weight: 650;
  letter-spacing: 0;
}

:is(
  .client-info-field input,
  .client-info-field select,
  .client-info-field textarea,
  .bl-dialog-input,
  .app-dialog input,
  .app-dialog select,
  .app-dialog textarea
) {
  border-color: var(--line-strong);
  background: var(--bg-elevated);
  color: var(--ink);
}

:is(
  .client-info-field input,
  .client-info-field select,
  .bl-dialog-input,
  .app-dialog input,
  .app-dialog select
) {
  min-height: var(--gc-field-height);
}

body :is(button, input, select, textarea):disabled,
body [aria-disabled="true"] {
  opacity: var(--gc-disabled-opacity);
  cursor: not-allowed;
}

body :is(button, input, select, textarea, [role="button"]):focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ui-focus-ring-v2: 原生复选框不再套一块模糊蓝色方光，改为清晰的键盘焦点线。 */
body input[type="checkbox"]:focus-visible,
body input[type="radio"]:focus-visible {
  outline: 2px solid rgba(0, 122, 255, 0.30);
  outline-offset: 2px;
  box-shadow: none !important;
}

/* 有完整选项外壳时，焦点作用在整行，不单独点亮小方块。 */
body label.outsourced-toggle input[type="checkbox"]:focus-visible {
  outline: none;
}

body label.outsourced-toggle:has(input[type="checkbox"]:focus-visible) {
  border-color: rgba(0, 122, 255, 0.62);
  box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.08);
}

/* === 卡片、容器、弹窗 === */
.app-shell :is(
  .today-card,
  .board-card,
  .prod-board-card,
  .peter-ai-card,
  .client-info-brand,
  .client-contact-card,
  .ship-strip,
  .ship-table-wrap,
  .pq2-st,
  .pq2-po,
  .fg-pane,
  .fg-detail,
  .acc-group,
  .admin-sec
) {
  border-color: var(--gc-card-border);
  border-radius: var(--gc-card-radius);
}

.app-shell :is(
  .today-card,
  .board-card,
  .prod-board-card,
  .peter-ai-card,
  .client-contact-card,
  .ship-strip,
  .ship-table-wrap,
  .pq2-st,
  .pq2-po
) {
  box-shadow: var(--gc-card-shadow);
}

.app-shell :is(
  [class$="-card"],
  [class*="-card "]
) {
  border-radius: var(--gc-card-radius);
}

main#main :is(
  .today-page,
  .patternlog-page,
  .plog-page,
  .ship-page,
  .acc-page,
  .client-info-page,
  .dash-page,
  .fudesk-page,
  .pfdesk-page,
  .recycle-page,
  .admin-wrap
) table {
  font-size: var(--gc-type-body);
}

main#main :is(
  .today-page,
  .patternlog-page,
  .plog-page,
  .ship-page,
  .acc-page,
  .client-info-page,
  .dash-page,
  .fudesk-page,
  .pfdesk-page,
  .recycle-page,
  .admin-wrap
) table th {
  font-size: var(--gc-type-label);
}

:is(
  .app-dialog,
  .client-info-modal,
  .feedback-modal,
  .have-sample-modal,
  .template-modal
) {
  border-radius: var(--gc-dialog-radius);
}

/* === 三段式表单弹窗 ===
   只处理“标题栏 + 可滚动表单 + 底部操作”外壳。
   客户评语、Peter AI、生产 QC 有独立尺寸，明确排除。 */
.gc-form-dialog-close {
  display: none;
}

body .modal-backdrop.gc-form-dialog-frame:not(.feedback-drawer):not(.peter-ai-open):not(.gc-prod-qc-modal) {
  padding: 20px;
  background: rgba(17, 24, 39, 0.28);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: opacity 140ms ease-out;
}

body .modal-backdrop.gc-form-dialog-frame:not(.feedback-drawer):not(.peter-ai-open):not(.gc-prod-qc-modal) > .modal {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(var(--gc-form-dialog-width), calc(100vw - 40px));
  max-width: var(--gc-form-dialog-width);
  max-height: var(--gc-form-dialog-max-height);
  overflow: hidden;
  border: 1px solid rgba(17, 24, 39, 0.14);
  border-radius: var(--gc-form-dialog-radius);
  background: rgba(255, 255, 255, 0.985);
  box-shadow: var(--gc-form-dialog-shadow);
  opacity: 0;
  transform: translateY(10px) scale(0.985);
  transition:
    transform 160ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 140ms ease-out;
}

body .modal-backdrop.gc-form-dialog-frame.open:not(.feedback-drawer):not(.peter-ai-open):not(.gc-prod-qc-modal) > .modal {
  opacity: 1;
  transform: translateY(0) scale(1);
}

body .modal-backdrop.gc-form-dialog-frame:not(.feedback-drawer):not(.peter-ai-open):not(.gc-prod-qc-modal) > .modal > .modal-header {
  position: static;
  display: flex;
  min-height: var(--gc-form-dialog-header-height);
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
}

body .modal-backdrop.gc-form-dialog-frame:not(.feedback-drawer):not(.peter-ai-open):not(.gc-prod-qc-modal) > .modal > .modal-header h3 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 18px;
  font-style: normal;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

body .modal-backdrop.gc-form-dialog-frame:not(.feedback-drawer):not(.peter-ai-open):not(.gc-prod-qc-modal) > .modal > .modal-body {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: var(--gc-form-dialog-body-padding);
}

body .modal-backdrop.gc-form-dialog-frame:not(.feedback-drawer):not(.peter-ai-open):not(.gc-prod-qc-modal) > .modal > .modal-footer {
  position: static;
  min-height: var(--gc-form-dialog-footer-height);
  align-items: center;
  padding: 10px 22px;
  border-top: 1px solid var(--line);
  background: #FAFAFA;
}

body .modal-backdrop.gc-form-dialog-frame:not(.feedback-drawer):not(.peter-ai-open):not(.gc-prod-qc-modal) > .modal > .modal-footer button {
  min-width: 76px;
  min-height: 36px;
}

body .modal-backdrop.gc-form-dialog-frame:not(.feedback-drawer):not(.peter-ai-open):not(.gc-prod-qc-modal) .gc-form-dialog-close {
  display: inline-flex;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition:
    background-color 120ms ease-out,
    color 120ms ease-out,
    transform 90ms ease-out;
}

body .modal-backdrop.gc-form-dialog-frame:not(.feedback-drawer):not(.peter-ai-open):not(.gc-prod-qc-modal) .gc-form-dialog-close svg {
  width: 20px;
  height: 20px;
}

body .modal-backdrop.gc-form-dialog-frame:not(.feedback-drawer):not(.peter-ai-open):not(.gc-prod-qc-modal) .gc-form-dialog-close:hover,
body .modal-backdrop.gc-form-dialog-frame:not(.feedback-drawer):not(.peter-ai-open):not(.gc-prod-qc-modal) .gc-form-dialog-close:focus-visible {
  background: var(--bg-sunken);
  color: var(--ink);
}

body .modal-backdrop.gc-form-dialog-frame:not(.feedback-drawer):not(.peter-ai-open):not(.gc-prod-qc-modal) .gc-form-dialog-close:active {
  transform: scale(0.94);
}

@media (max-width: 680px) {
  body .modal-backdrop.gc-form-dialog-frame:not(.feedback-drawer):not(.peter-ai-open):not(.gc-prod-qc-modal) {
    padding: 12px;
  }

  body .modal-backdrop.gc-form-dialog-frame:not(.feedback-drawer):not(.peter-ai-open):not(.gc-prod-qc-modal) > .modal {
    width: calc(100vw - 24px);
    max-height: 92svh;
  }

  body .modal-backdrop.gc-form-dialog-frame:not(.feedback-drawer):not(.peter-ai-open):not(.gc-prod-qc-modal) > .modal > .modal-header {
    min-height: 60px;
    padding: 0 16px;
  }

  body .modal-backdrop.gc-form-dialog-frame:not(.feedback-drawer):not(.peter-ai-open):not(.gc-prod-qc-modal) > .modal > .modal-body {
    padding: 18px 16px 22px;
  }

  body .modal-backdrop.gc-form-dialog-frame:not(.feedback-drawer):not(.peter-ai-open):not(.gc-prod-qc-modal) > .modal > .modal-footer {
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  body .modal-backdrop.gc-form-dialog-frame:not(.feedback-drawer):not(.peter-ai-open):not(.gc-prod-qc-modal),
  body .modal-backdrop.gc-form-dialog-frame:not(.feedback-drawer):not(.peter-ai-open):not(.gc-prod-qc-modal) > .modal,
  body .modal-backdrop.gc-form-dialog-frame:not(.feedback-drawer):not(.peter-ai-open):not(.gc-prod-qc-modal) .gc-form-dialog-close {
    transition-duration: 1ms !important;
  }
}

@media (prefers-reduced-transparency: reduce) {
  body .modal-backdrop.gc-form-dialog-frame:not(.feedback-drawer):not(.peter-ai-open):not(.gc-prod-qc-modal) {
    background: rgba(17, 24, 39, 0.42);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  body .modal-backdrop.gc-form-dialog-frame:not(.feedback-drawer):not(.peter-ai-open):not(.gc-prod-qc-modal) > .modal {
    background: var(--bg-elevated);
  }
}

/* === 全站文件上传状态：参考分段式上传列表，保留轻量浮层位置 === */
/* upload-status-sections-v2 */
.gc-upload-task-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10060;
  display: flex;
  width: min(360px, calc(100vw - 28px));
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.gc-upload-task {
  box-sizing: border-box;
  padding: 14px;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font-sans);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 14px 38px rgba(15, 23, 42, 0.14), 0 2px 8px rgba(15, 23, 42, 0.06);
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: opacity 160ms ease-out, transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.gc-upload-task-section {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.04em;
}

.gc-upload-task-state-icon {
  position: relative;
  display: inline-flex;
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  box-sizing: border-box;
  border: 1.5px solid var(--ink);
  border-right-color: transparent;
  border-radius: 50%;
  animation: gc-upload-task-spin 800ms linear infinite;
}

.gc-upload-task-file {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.gc-upload-task-file-icon {
  display: inline-flex;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.gc-upload-task-file-icon svg {
  width: 19px;
  height: 19px;
}

.gc-upload-task-content {
  min-width: 0;
  flex: 1 1 auto;
}

.gc-upload-task-head {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.gc-upload-task-label {
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gc-upload-task-percent {
  flex: 0 0 auto;
  color: var(--ink-mute);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.gc-upload-task-meta {
  margin-top: 2px;
  overflow: hidden;
  color: var(--ink-mute);
  font-size: 12px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gc-upload-progress {
  height: 3px;
  margin-top: 8px;
  overflow: hidden;
  background: var(--line);
  border-radius: 99px;
}

.gc-upload-progress-fill {
  width: 0;
  height: 100%;
  background: var(--ink);
  border-radius: inherit;
  transition: width 180ms ease-out, background-color 140ms ease-out;
}

.gc-upload-task.is-done .gc-upload-task-state-icon,
.gc-upload-task.is-failed .gc-upload-task-state-icon {
  align-items: center;
  justify-content: center;
  border-color: currentColor;
  animation: none;
}

.gc-upload-task.is-done .gc-upload-task-state-icon {
  color: var(--ok);
}

.gc-upload-task.is-done .gc-upload-task-state-icon::after {
  width: 6px;
  height: 3px;
  border-bottom: 1.5px solid currentColor;
  border-left: 1.5px solid currentColor;
  content: "";
  transform: translateY(-1px) rotate(-45deg);
}

.gc-upload-task.is-done .gc-upload-progress-fill {
  background: var(--ok);
}

.gc-upload-task.is-failed .gc-upload-task-state-icon {
  color: var(--danger);
}

.gc-upload-task.is-failed .gc-upload-task-state-icon::before,
.gc-upload-task.is-failed .gc-upload-task-state-icon::after {
  position: absolute;
  width: 7px;
  height: 1.5px;
  background: currentColor;
  border-radius: 99px;
  content: "";
}

.gc-upload-task.is-failed .gc-upload-task-state-icon::before {
  transform: rotate(45deg);
}

.gc-upload-task.is-failed .gc-upload-task-state-icon::after {
  transform: rotate(-45deg);
}

.gc-upload-task.is-failed .gc-upload-progress-fill {
  background: var(--danger);
}

.gc-upload-task.is-leaving {
  opacity: 0;
  transform: translateY(6px) scale(0.985);
}

@keyframes gc-upload-task-spin {
  to { transform: rotate(360deg); }
}

/* 图片删除：采用 macOS 常见的“对象 + 不可撤销”危险确认结构。 */
.app-dialog.gc-photo-delete-dialog {
  max-width: 420px;
}

.app-dialog-backdrop.peter-global-dialog-pilot .app-dialog.gc-photo-delete-dialog {
  width: min(420px, calc(100vw - 32px));
  max-width: 420px;
}

.app-dialog-backdrop.peter-global-dialog-pilot .gc-photo-delete-dialog .app-dialog-close {
  display: none;
}

.app-dialog-backdrop.peter-global-dialog-pilot .gc-photo-delete-dialog .app-dialog-main {
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 24px 24px 20px;
}

.app-dialog-backdrop.peter-global-dialog-pilot .gc-photo-delete-dialog .app-dialog-icon {
  width: 44px;
  height: 44px;
  flex-basis: 44px;
  margin: 0 0 14px;
}

.app-dialog-backdrop.peter-global-dialog-pilot .gc-photo-delete-dialog .app-dialog-title,
.app-dialog-backdrop.peter-global-dialog-pilot .gc-photo-delete-dialog .app-dialog-message {
  max-width: 30em;
  text-align: center;
}

.app-dialog-backdrop.peter-global-dialog-pilot .gc-photo-delete-dialog .app-dialog-message {
  margin-top: 7px;
}

.app-dialog-backdrop.peter-global-dialog-pilot .gc-photo-delete-dialog .app-dialog-actions {
  padding: 14px 20px;
}

@media (max-width: 640px) {
  .gc-upload-task-stack {
    right: 12px;
    bottom: calc(76px + env(safe-area-inset-bottom));
    width: calc(100vw - 24px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .gc-upload-task,
  .gc-upload-progress-fill {
    transition-duration: 1ms !important;
  }

  .gc-upload-task-state-icon {
    animation: none;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .gc-upload-task {
    background: var(--bg-elevated);
  }
}

/* === 页面中性色与主操作 === */
.client-info-page {
  background: var(--bg);
  color: var(--ink);
}

.global-tools {
  background: var(--bg-elevated);
  border-color: var(--line);
  box-shadow: var(--shadow-xs);
}

.global-tools > button {
  color: var(--ink-soft);
}

.global-tools > button + button {
  border-left-color: var(--line) !important;
}

body.peter-topbar-trial {
  --peter-search-border: var(--line-strong);
  --peter-search-focus: var(--apple-blue);
}

/* 新人指南属于日常工作台，沿用全站蓝色选中态，不建立另一套紫色主题。 */
.peter-ai-workbench-card.workbench-guide .peter-ai-workbench-icon,
.fg-stage-btn.active .fg-stage-no {
  background: var(--apple-blue);
  color: #FFFFFF;
}

.fg-header-copy > span {
  color: var(--apple-blue);
}

.fg-stage-btn.active,
.fg-result-btn.active {
  border-color: var(--apple-blue);
  background: var(--apple-blue-bg);
}

/* === 动效统一：只动必要属性 === */
:is(
  .app-dialog-btn,
  .client-info-add,
  .client-info-back-ai,
  .client-info-primary,
  .client-info-secondary,
  .ship-report-btn,
  .pq2-report-btn,
  .fg-back-btn
) {
  transition:
    color var(--gc-transition-fast),
    background-color var(--gc-transition-fast),
    border-color var(--gc-transition-fast),
    box-shadow var(--gc-transition-fast);
}

@media (max-width: 600px) {
  :is(
    .app-dialog-btn,
    .client-info-add,
    .client-info-back-ai,
    .client-info-danger,
    .client-info-secondary,
    .client-info-primary,
    .ship-report-btn,
    .pq2-report-btn,
    .fg-back-btn
  ) {
    min-height: var(--gc-control-lg);
  }
}

/* modal-performance-guard-v1:
   开单选款和新增款式都是重表单，禁止整块内容参与缩放位移。
   保留轻量透明度变化；Peter AI、客户评语和生产 QC 专用弹窗不受影响。 */
body #newStyleBackdrop.gc-form-dialog-frame > .modal,
body #updateBackdrop.gc-form-dialog-frame:not(.feedback-drawer):not(.peter-ai-open):not(.gc-prod-qc-modal) > .modal {
  animation: none !important;
  transform: none !important;
  transition: opacity 90ms ease-out;
}

body #newStyleBackdrop.gc-form-dialog-frame.open > .modal,
body #updateBackdrop.gc-form-dialog-frame.open:not(.feedback-drawer):not(.peter-ai-open):not(.gc-prod-qc-modal) > .modal {
  transform: none !important;
}

/* global-ui-i18n-v1: CSS-generated copy cannot be reached by the DOM translator. */
html[lang="en"] body.peter-recording-mode-active .sidebar-logo .logo-text::after {
  content: "Order Progress ERP";
}

html[lang="en"] .po-item::after {
  content: "Double-click to edit";
}

html[lang="en"] .today-card.search-selected-kept::after {
  content: "Selected";
}

html[lang="en"] .today-empty::after {
  content: "ALL STYLES ARE ON TRACK";
}

html[lang="en"] .prod-tile.urg-overdue-severe::after {
  content: "SEVERELY OVERDUE";
}

html[lang="en"] .v16-body .v16-fit-tbl td.link-cell:empty::before {
  content: "+ Add workbook link";
}

html[lang="en"] .v16-picker .pkr-row::after {
  content: "Double-click for details";
}
