/*
 * Orders workbench usability refresh · 2026-08-23
 *
 * The Orders page is an immutable Element Plus build. These rules keep the
 * existing order/filter/detail behavior intact while giving dense data a
 * stable scroll area and a single visual hierarchy for actions.
 */

/* Filters: let controls wrap at meaningful boundaries instead of squeezing
 * every fixed-width control onto one line. */
.orders-page > .filter-bar {
  align-items: stretch;
  row-gap: 10px;
}
.orders-page > .filter-bar > :first-child[style*="display:flex"] {
  flex: 1 0 100%;
}
.orders-page > .filter-bar > .el-radio-group {
  flex: 0 0 auto;
}
.orders-page > .filter-bar > .el-input {
  flex: 1 1 240px;
  min-width: 220px;
}
.orders-page > .filter-bar > .el-select {
  flex: 1 1 132px;
  min-width: 120px;
}
.orders-page > .filter-bar > .el-date-editor {
  flex: 1 1 230px;
  min-width: 220px;
}
.orders-page > .filter-bar > .el-button {
  flex: 0 0 auto;
}
.orders-page > .filter-bar > .filter-spacer {
  display: none;
}

/* Main table: keep the header and action column usable while the body scrolls
 * inside a bounded viewport for large order sets. */
.orders-page > .el-table {
  width: 100%;
  min-width: 980px;
  height: auto;
}
.orders-page > .el-table:has(.el-table__body-wrapper tbody tr:nth-child(10)) {
  height: clamp(360px, calc(100vh - 420px), 620px);
}
.orders-page > .el-table .el-table__body-wrapper,
.orders-page > .el-table .el-table__header-wrapper {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
.orders-page > .el-table .el-table__body-wrapper {
  overflow-y: auto;
}
.orders-page > .el-table .el-table__body-wrapper::-webkit-scrollbar,
.orders-page > .el-table .el-table__header-wrapper::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}
.orders-page > .el-table .el-table__body-wrapper::-webkit-scrollbar-thumb,
.orders-page > .el-table .el-table__header-wrapper::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #cbd5e1;
}
.orders-page > .el-table .el-table__cell:last-child .cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.orders-page > .el-table .el-table__cell:last-child .el-button {
  min-width: 48px;
  margin: 0;
  padding-inline: 9px;
}
.orders-page > .el-table .el-table__cell:last-child .el-button:first-child {
  color: #fff !important;
  background: var(--suya-primary-dark) !important;
  border-color: var(--suya-primary-dark) !important;
}
.orders-page > .el-table .el-table__cell:last-child .el-button:nth-child(2) {
  color: var(--suya-primary-dark) !important;
  background: #f0fdfa !important;
  border: 1px solid #99f6e4 !important;
}
.orders-page > .el-table .el-table__cell:last-child .el-button:hover {
  transform: none;
  box-shadow: none;
}

/* Detail workbench: one card with clear sub-panels and a scrollable product
 * table, so the five fulfillment actions remain easy to scan. */
#order-detail-workbench {
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--suya-border-light);
  border-radius: 12px;
  background: var(--suya-surface);
  box-shadow: var(--suya-shadow-card);
}
#order-detail-workbench .preview-grid--top {
  grid-template-columns: minmax(0, 2fr) minmax(280px, .9fr);
  gap: 16px;
  align-items: start;
}
#order-detail-workbench .preview-products,
#order-detail-workbench .preview-links,
#order-detail-workbench .preview-log {
  min-width: 0;
}
#order-detail-workbench .preview-products {
  overflow-x: auto;
}
#order-detail-workbench .preview-products .el-table {
  width: 100%;
  min-width: 760px;
}
#order-detail-workbench .preview-products .el-table__body-wrapper {
  overflow-x: auto;
  scrollbar-width: thin;
}
#order-detail-workbench .preview-links {
  padding: 12px;
  border: 1px solid var(--suya-border-light);
  border-radius: 10px;
  background: var(--suya-surface-muted);
}
#order-detail-workbench .linked-actions,
#order-detail-workbench .quick-actions[style*="display: flex"] {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
  align-items: stretch;
}
#order-detail-workbench .quick-actions[style*="display: none"] {
  display: none !important;
}
#order-detail-workbench .linked-actions .el-button,
#order-detail-workbench .linked-actions .linked-doc,
#order-detail-workbench .quick-actions .el-button {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  margin: 0;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
}
#order-detail-workbench .linked-actions .linked-doc {
  display: inline-flex;
  align-items: center;
  border: 1px solid #99f6e4;
  background: #f0fdfa;
  color: var(--suya-primary-dark);
}
#order-detail-workbench .quick-actions {
  flex: 1 1 620px;
  min-width: 0;
}
#order-detail-workbench .quick-actions .el-button--primary.is-plain,
#order-detail-workbench .quick-actions .el-button--success.is-plain {
  color: var(--suya-primary-dark) !important;
  border-color: #99f6e4 !important;
  background: #f0fdfa !important;
}
#order-detail-workbench .quick-actions .el-button--primary.is-plain:hover,
#order-detail-workbench .quick-actions .el-button--success.is-plain:hover {
  background: #ccfbf1 !important;
  border-color: #5eead4 !important;
}
#order-detail-workbench .tracking-editor {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 12px;
  align-items: end;
  padding: 14px;
  border: 1px solid var(--suya-border-light);
  border-radius: 10px;
  background: var(--suya-surface-muted);
}
#order-detail-workbench .tracking-editor label {
  min-width: 0;
  gap: 6px;
  color: var(--suya-text-secondary);
  font-size: 12px;
  font-weight: 600;
}
#order-detail-workbench .tracking-editor label > .el-input,
#order-detail-workbench .tracking-editor label > .el-select {
  width: 100% !important;
  min-width: 0;
}
#order-detail-workbench .tracking-editor > .el-button {
  width: 100%;
  min-width: 116px;
  align-self: end;
  margin: 0;
}
#order-detail-workbench > .tracking-editor:nth-of-type(4) {
  grid-template-columns: minmax(0, 280px) minmax(116px, 160px);
}
#order-detail-workbench .preview-header {
  gap: 14px;
  align-items: flex-start;
  flex-wrap: wrap;
  padding: 2px 0;
}
#order-detail-workbench .preview-header > div:first-child {
  flex: 1 1 260px;
  min-width: 0;
  line-height: 1.55;
}
#order-detail-workbench .log-list {
  max-height: 260px;
  padding-right: 2px;
  scrollbar-width: thin;
}
#order-detail-workbench .log-item {
  border: 1px solid var(--suya-border-light);
  border-radius: 8px;
  background: var(--suya-surface-muted);
}

@media (max-width: 1200px) {
  #order-detail-workbench .preview-grid--top { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  #order-detail-workbench { padding: 12px; }
  #order-detail-workbench .quick-actions[style*="display: flex"],
  #order-detail-workbench .linked-actions,
  #order-detail-workbench .tracking-editor { grid-template-columns: 1fr 1fr; }
  #order-detail-workbench > .tracking-editor:nth-of-type(4) { grid-template-columns: 1fr; }
}
