.page {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  max-width: none;
  margin: 0;
  padding: 0;
}
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.header h1 {
  margin: 0;
  font-size: 1.25rem;
}
.actions {
  display: flex;
  gap: 0.5rem;
}
button {
  padding: 0.35rem 0.75rem;
  cursor: pointer;
}
button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.actions .link-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: 2px;
  background: #f8f8f8;
  color: inherit;
  text-decoration: none;
  font-size: inherit;
}
.actions .link-btn:hover {
  background: #eee;
}
.msg.ok {
  color: #0b6e45;
}
.msg.err {
  color: #b00020;
}
.hint {
  color: #666;
}
.table-wrap {
  overflow-x: auto;
}
.grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.grid th,
.grid td {
  border: 1px solid #ddd;
  padding: 0.35rem 0.5rem;
  text-align: left;
  vertical-align: middle;
}
.grid th {
  background: #f5f5f5;
}
.grid tfoot .grid-totals-row td {
  background: #f0f4f8;
  font-weight: 600;
  border-top: 2px solid #bbb;
}
.grid-totals-row__num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.grid input[type="number"]::-webkit-outer-spin-button,
.grid input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}
.grid input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}
.cell {
  width: 5.5rem;
  max-width: 100%;
  box-sizing: border-box;
}
.cell.wide {
  width: 10rem;
}

.form-section {
  margin-bottom: 1.5rem;
}
.section-title {
  font-size: 1rem;
  margin: 0 0 0.75rem 0;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 0.75rem 1rem;
}
.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.875rem;
}
.form-field input {
  padding: 0.35rem 0.5rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  box-sizing: border-box;
}
.modal-panel {
  background: #fff;
  border-radius: 6px;
  max-width: min(96vw, 900px);
  max-height: 90vh;
  overflow: auto;
  padding: 1rem 1.25rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

/* 快速录入：标题与渠道固定，仅表格区域滚动；表头 sticky */
.modal-panel--quick-entry {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-panel--quick-entry .modal-panel__scroll-fixed-top {
  flex-shrink: 0;
}
.modal-panel--quick-entry .table-wrap--sticky-head {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.modal-panel--quick-entry .table-wrap--sticky-head .grid thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f5f5f5;
  box-shadow: 0 1px 0 #ddd;
}
.modal-panel--quick-entry .modal-actions {
  flex-shrink: 0;
  margin-top: 0.75rem;
}

.modal-panel h3 {
  margin: 0 0 0.75rem 0;
  font-size: 1rem;
}
.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid #eee;
}

/* 生产进度：按单右键 / ⋮ 菜单 */
.context-menu {
  position: fixed;
  z-index: 1100;
  min-width: 8rem;
  margin: 0;
  padding: 0.25rem 0;
  list-style: none;
  background: #fff;
  border: 1px solid #c5c5c5;
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  font-size: 0.875rem;
}
.context-menu__item {
  display: block;
  width: 100%;
  padding: 0.4rem 0.75rem;
  margin: 0;
  border: none;
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
  color: #111;
  box-sizing: border-box;
}
.context-menu__item:hover {
  background: #f0f7ff;
}
.po-cell {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  cursor: context-menu;
}
.po-cell__text {
  flex: 1;
  min-width: 0;
}
.po-cell__trigger {
  flex-shrink: 0;
  padding: 0.1rem 0.35rem;
  line-height: 1;
  border: 1px solid #ddd;
  border-radius: 3px;
  background: #fafafa;
  color: #555;
  font-size: 1rem;
  cursor: pointer;
}
.po-cell__trigger:hover {
  background: #eee;
  border-color: #ccc;
}

/* 生产进度：整单编辑弹层（列多，加宽） */
.modal-panel--production-po-edit {
  max-width: min(96vw, 1400px);
  width: 100%;
}
.modal-panel--inbound-detail {
  max-width: min(96vw, 900px);
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}
.inbound-detail-block {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #eee;
}
.inbound-detail-block:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
}
.inbound-detail-block__title {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #333;
}
.inbound-detail-adjust {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
  margin-top: 0.5rem;
}
.inbound-detail-adjust__label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: #555;
}
.grid--compact th,
.grid--compact td {
  padding: 0.35rem 0.5rem;
  font-size: 0.85rem;
}
.cell-error-msg {
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #a33;
  font-size: 0.85rem;
}
.production-po-edit-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
  align-items: center;
}
.production-po-edit-actions .flex-spacer {
  flex: 1 1 auto;
  min-width: 0;
}

.modal-panel--transfer-in-edit {
  max-width: min(96vw, 520px);
  width: 100%;
}

.exclude-panel {
  margin-top: 1rem;
}
.exclude-panel__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.exclude-panel__title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
}
.exclude-panel__footer {
  margin-top: 0.75rem;
}
.exclude-panel__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.exclude-panel__file-input {
  display: none;
}
.exclude-panel__body {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.exclude-panel__table-scroll {
  max-height: min(52vh, 420px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.exclude-panel__table-scroll .grid thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f5f5f5;
  box-shadow: 0 1px 0 #ddd;
}
.exclude-panel__count {
  margin: 0.5rem 0 0;
}
.exclude-panel--compact .exclude-panel__title {
  font-size: 1rem;
}
.modal-panel--exclude-add {
  max-width: min(96vw, 480px);
  width: 100%;
}
.form-grid--exclude-add {
  grid-template-columns: 1fr;
  margin-bottom: 0.5rem;
}
.form-field--full {
  grid-column: 1 / -1;
}
.grid td.cell-remark {
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-plan-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.order-plan-header__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.filter-apply--secondary {
  background: transparent;
  color: inherit;
  border: 1px solid rgba(0, 0, 0, 0.2);
}
.order-plan-jobs {
  margin-top: 0.5rem;
}
.job-status {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8125rem;
  font-weight: 500;
}
.job-status--pending {
  background: #f0f0f0;
  color: #555;
}
.job-status--running {
  background: #e3f2fd;
  color: #1565c0;
}
.job-status--success {
  background: #e8f5e9;
  color: #2e7d32;
}
.job-status--failure {
  background: #ffebee;
  color: #c62828;
}
.btn-link-action {
  padding: 0.2rem 0.4rem;
  margin-right: 0.5rem;
  font-size: 0.8125rem;
  border: none;
  background: none;
  color: #1565c0;
  cursor: pointer;
  text-decoration: underline;
}
.btn-link-action:hover {
  color: #0d47a1;
}
.modal-panel--exclude-modal {
  max-width: min(96vw, 920px);
  width: 100%;
  max-height: min(90vh, 800px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-panel--exclude-modal .exclude-panel {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin-top: 0;
}
.modal-panel--exclude-modal .exclude-panel__body {
  flex: 1 1 auto;
  min-height: 0;
}
.modal-panel--exclude-modal .exclude-panel__table-scroll {
  max-height: none;
  flex: 1 1 auto;
  min-height: 8rem;
}
.modal-panel--exclude-modal .modal-actions {
  flex-shrink: 0;
  margin-top: 0.75rem;
}
.modal-panel__head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.modal-panel__head-row h3 {
  margin: 0;
}
.modal-panel__close {
  border: none;
  background: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
}
.grid td.col-actions {
  width: auto;
  min-width: 7rem;
  text-align: left;
}
.order-plan-jobs__error-cell {
  max-width: 22rem;
  white-space: normal;
  word-break: break-word;
  color: #666;
}
.order-plan-jobs__error-cell--failure {
  color: #c62828;
}
.order-plan-jobs__pending-hint {
  margin: 0.25rem 0 0;
  font-size: 0.75rem;
  color: #888;
}
.form-grid--transfer-edit {
  grid-template-columns: 1fr;
  margin-bottom: 1rem;
}
.grid th.col-actions,
.grid td.col-actions {
  width: 4rem;
  white-space: nowrap;
  text-align: center;
}
.btn-danger-text {
  padding: 0.2rem 0.4rem;
  font-size: 0.8125rem;
  border: none;
  background: none;
  color: #b00020;
  cursor: pointer;
  text-decoration: underline;
}
.btn-danger-text:hover {
  color: #8a0018;
}
.btn-danger-text:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.suggest-wrap {
  position: relative;
}
.suggest-list {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin: 2px 0 0 0;
  padding: 0;
  list-style: none;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 2px;
  max-height: 12rem;
  overflow-y: auto;
  z-index: 50;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  font-size: 0.8125rem;
}
.suggest-list li {
  padding: 0.35rem 0.5rem;
  cursor: pointer;
}
.suggest-list li:hover {
  background: #f0f7ff;
}
.matrix-input {
  width: 4rem;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0.25rem;
}

.filters {
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: 4px;
  font-size: 0.875rem;
}
.filters-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.85rem;
}
.filters-inline .filter-label {
  min-width: auto;
  flex-shrink: 0;
}
.filters-inline .filter-apply {
  margin-left: 0;
}
.filter-group {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}
.filter-dropdown {
  position: relative;
}
.filter-dropdown__trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 11rem;
  max-width: 20rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid #c5c5c5;
  border-radius: 4px;
  background: #fff;
  font-size: inherit;
  font-family: inherit;
  color: #333;
  cursor: pointer;
  text-align: left;
  line-height: 1.25;
}
.filter-dropdown__trigger:hover {
  border-color: #999;
}
.filter-dropdown__value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.filter-dropdown__caret {
  flex-shrink: 0;
  font-size: 0.65rem;
  opacity: 0.75;
  line-height: 1;
}
.filter-dropdown__panel {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  z-index: 100;
  min-width: 100%;
  padding: 0.4rem 0.5rem;
  background: #fff;
  border: 1px solid #c5c5c5;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.filter-dropdown__option {
  padding: 0.1rem 0;
}
.filter-input--narrow {
  min-width: 7rem;
  max-width: 11rem;
  width: 9rem;
}
.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin-bottom: 0.5rem;
}
.filter-row:last-child {
  margin-bottom: 0;
}
.filter-label {
  font-weight: 600;
  color: #444;
  min-width: 4rem;
}
.filter-check {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
}
.filter-input {
  padding: 0.35rem 0.5rem;
  min-width: 12rem;
}
.filter-apply {
  margin-left: auto;
}
.page-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid #eee;
}
.page-footer .pagination {
  margin-bottom: 0;
}
.pagination {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.page-info {
  color: #555;
  font-size: 0.875rem;
}

.grid tbody tr.row-tip {
  cursor: help;
}

/* —— 全站壳层（index.html） —— */
.site-body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: #1a1a1f;
  background: #f0f2f7;
  position: relative;
}
.site-backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: radial-gradient(
      1200px 600px at 10% -10%,
      rgba(59, 130, 246, 0.09),
      transparent 55%
    ),
    radial-gradient(
      900px 500px at 100% 0%,
      rgba(14, 165, 233, 0.08),
      transparent 50%
    ),
    linear-gradient(180deg, #eef1f8 0%, #f0f2f7 40%, #e8ecf4 100%);
  pointer-events: none;
}
:root {
  --site-content-max: 1200px;
  --site-gutter-x: 1.25rem;
}
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}
.site-header__inner {
  box-sizing: border-box;
  max-width: var(--site-content-max);
  margin: 0 auto;
  padding: 0.75rem var(--site-gutter-x);
}
.site-header__bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.site-menu-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.site-menu-btn:hover {
  background: rgba(37, 99, 235, 0.06);
  border-color: rgba(37, 99, 235, 0.25);
}
.site-menu-btn__icon {
  width: 1.375rem;
  height: 1.375rem;
  display: block;
  pointer-events: none;
}
.site-drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: 199;
  background: rgba(15, 23, 42, 0.4);
  border: 0;
  padding: 0;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
body.site-drawer-open .site-drawer-scrim {
  opacity: 1;
  visibility: visible;
}
.site-drawer-scrim[hidden] {
  display: none !important;
}
.site-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 200;
  width: min(17.5rem, 86vw);
  max-width: 100%;
  background: #fff;
  border-right: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 8px 0 32px rgba(15, 23, 42, 0.12);
  transform: translateX(-100%);
  transition: transform 0.22s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body.site-drawer-open .site-drawer {
  transform: translateX(0);
}
.site-drawer__head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}
.site-drawer__title {
  font-size: 0.9375rem;
  font-weight: 650;
}
.site-drawer__close {
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
}
.site-drawer__close:hover {
  background: rgba(15, 23, 42, 0.06);
  color: #1a1a1f;
}
.site-drawer-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0 1rem;
}
.site-drawer-list,
.site-drawer-sub {
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-drawer-list > li {
  margin: 0;
}
.site-drawer-link {
  display: block;
  padding: 0.55rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #334155;
  text-decoration: none;
  border-radius: 0;
  transition: background 0.15s ease, color 0.15s ease;
}
.site-drawer-link:hover {
  background: rgba(37, 99, 235, 0.08);
  color: #1d4ed8;
}
.site-drawer-link--accent {
  color: #1d4ed8;
  font-weight: 600;
}
.site-drawer-group {
  margin-top: 0.35rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
}
.site-drawer-group__label {
  display: block;
  padding: 0.35rem 1rem 0.25rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
}
.site-drawer-sub .site-drawer-link {
  padding-left: 1.35rem;
  font-size: 0.8125rem;
}
.site-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: inherit;
}
.site-brand__text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  line-height: 1.2;
}
.site-brand__title {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.site-brand__subtitle {
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 500;
}
.site-main {
  flex: 1;
  width: 100%;
  max-width: var(--site-content-max);
  margin: 0 auto;
  padding: 1.5rem var(--site-gutter-x) 2.5rem;
  box-sizing: border-box;
}
.site-hero {
  max-width: 900px;
}
.site-hero__title {
  margin: 0 0 0.5rem;
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.site-hero__lead {
  margin: 0 0 1.75rem;
  font-size: 0.95rem;
  color: #64748b;
  line-height: 1.55;
}
.site-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.site-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.15rem 1.2rem;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
  transition: transform 0.18s ease, box-shadow 0.18s ease,
    border-color 0.18s ease;
}
.site-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.1);
  border-color: rgba(37, 99, 235, 0.25);
}
.site-card--accent {
  border-color: rgba(37, 99, 235, 0.35);
  background: linear-gradient(
    160deg,
    #fff 0%,
    rgba(239, 246, 255, 0.85) 100%
  );
}
.site-card__title {
  font-size: 1rem;
  font-weight: 650;
}
.site-card__desc {
  font-size: 0.8125rem;
  color: #64748b;
  line-height: 1.45;
}
.site-footer {
  margin-top: auto;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
  background: rgba(255, 255, 255, 0.55);
}
.site-footer__inner {
  box-sizing: border-box;
  max-width: var(--site-content-max);
  margin: 0 auto;
  padding: 0.85rem var(--site-gutter-x);
  font-size: 0.8rem;
  color: #64748b;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.35rem;
}
.site-footer__sep {
  opacity: 0.5;
}
