/* The order list pairs a clear reading column with a separate action column. */
.order-workbench-tools {
  min-width: 0;
  padding: clamp(12px, 1.7vw, 22px);
  background: var(--surface);
  border-color: var(--line);
  box-shadow: none;
}

.order-tools-group {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  padding: 12px 0;
}

.order-tools-label {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.order-archive-tabs,
.order-tools-actions,
.order-search-form,
.order-date-fields {
  flex-wrap: wrap;
  gap: 8px;
}

.order-search-form {
  align-items: end;
}

.order-workbench-tools .order-search-input {
  flex: 1 1 240px;
  max-width: none;
}

.order-workbench-tools .order-filter-field {
  display: grid;
  flex: 1 1 148px;
  gap: 5px;
  min-width: 0;
  font-size: 14px;
}

.order-workbench-tools .order-filter-field select {
  width: 100%;
  min-width: 0;
}

.order-workbench-tools .order-search-form :is(input, select) {
  min-height: 42px;
  max-width: 100%;
  border-color: var(--line);
  background: var(--surface);
  font-size: 15px;
}

.order-workbench-tools .order-date-fields {
  color: var(--muted);
  font-size: 14px;
}

.order-workbench-tools .order-date-fields input {
  width: min(100%, 154px);
}

.order-workbench-tools .order-advanced-filters {
  grid-template-columns: repeat(auto-fit, minmax(min(165px, 100%), 1fr));
  gap: 10px 12px;
}

.order-workbench-tools .order-advanced-filters .field {
  min-width: 0;
  margin: 0;
}

.order-workbench-tools .button,
.orders-table .row-actions .button,
.order-recipient-actions .button {
  min-height: 38px;
  font-size: 14px;
  line-height: 1.45;
  white-space: normal;
}

.orders-table-wrap {
  container: order-list / inline-size;
  max-width: 100%;
}

#app .shell .orders-table.orders-contact-table :is(th, td) {
  padding: 14px 16px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  text-shadow: none;
}

#app .shell .orders-table.orders-contact-table th {
  background: var(--surface-muted);
  color: var(--ink);
  font-weight: 650;
}

.orders-table.orders-contact-table .order-select-cell {
  width: 44px;
  padding-inline: 12px 4px;
}

.orders-table.orders-contact-table .order-reference-cell { width: 26%; }
.orders-table.orders-contact-table .order-recipient-cell { width: 34%; }
.orders-table.orders-contact-table .order-actions-cell {
  position: static;
  width: 144px;
  border-inline-start: 1px solid var(--line);
}

.orders-table .order-actions-cell .row-actions {
  align-items: stretch;
  gap: 6px;
}

.order-reference-line .order-number,
.order-recipient-value,
.order-logistics-summary,
.order-progress-details {
  font-size: 15px;
  line-height: 1.55;
}

.order-product-name,
.order-recipient-name .order-recipient-value {
  color: var(--ink);
  font-size: 17px;
  font-weight: 700;
}

.order-sku,
.order-created,
.order-source,
.order-recipient-line .order-field-label,
.order-recipient-line > .copy-inline,
.order-result-notification,
.order-result-notification p,
.order-list-scope {
  font-size: 13px;
}

.order-recipient-line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 8px;
}

.order-recipient-line .order-field-label {
  flex: 0 0 62px;
}

.order-recipient-value {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
}

.order-photo-preview.button {
  width: min(136px, 100%);
  font-size: 13px;
}

.order-photo-preview img {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
}

body:has(.shell) > dialog.modal .order-detail-section {
  padding: clamp(14px, 2.2vw, 24px);
  background: var(--surface);
  border-color: var(--line);
  box-shadow: none;
}

.order-detail-section h3 { font-size: 18px; }
.order-detail-fields dt { font-size: 14px; }
.order-detail-fields dd { font-size: 16px; }

/* Keep table rows readable when the navigation takes part of the viewport. */
@container order-list (max-width: 920px) {
  .orders-table.orders-contact-table,
  .orders-table.orders-contact-table :is(tbody, thead) {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .orders-table.orders-contact-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .orders-table.orders-selectable thead {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
  }

  .orders-table.orders-selectable thead th:not(.order-select-cell) {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  #app .shell .orders-table.orders-selectable thead .order-select-cell {
    display: flex;
    align-items: center;
    width: auto;
    gap: 8px;
  }

  .orders-table.orders-selectable thead .order-select-cell::after {
    content: "选择本页";
  }

  .orders-table.orders-contact-table tbody {
    padding: 10px;
    display: grid;
    gap: 10px;
  }

  .orders-table.orders-contact-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
  }

  #app .shell .orders-table.orders-contact-table tbody td {
    display: block;
    width: auto;
    min-width: 0;
    max-width: none;
    padding: 12px;
    border: 0;
  }

  .orders-table.orders-contact-table tbody td[data-label]::before {
    display: block;
    margin-bottom: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
    content: attr(data-label);
  }

  #app .shell .orders-table.orders-contact-table tbody :is(.order-select-cell, .order-actions-cell) {
    border-block-start: 1px solid var(--line);
    background: var(--surface-muted);
  }

  .orders-table .order-select-label { display: flex; gap: 8px; align-items: center; }
  .orders-table .order-select-label > span { display: inline; font-size: 14px; }
  .orders-table .order-actions-cell .row-actions { flex-direction: row; flex-wrap: wrap; }
}

@media (max-width: 720px) {
  .order-tools-group { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .order-tools-label { margin: 0; padding: 0; }
  .order-workbench-tools .order-date-fields { width: 100%; }
  .order-workbench-tools .order-date-fields input { width: 100%; }
}

@media (max-width: 460px) {
  .order-workbench-tools .order-date-fields {
    grid-template-columns: max-content minmax(0, 1fr);
  }
}

/* Distribution, settlement and account screens use the same readable scale. */
:is(.agent-management, .agent-network, .commission-programs, .commission-refund-review) {
  min-width: 0;
  font-size: 15px;
}

.agent-management .agent-management-heading h2 {
  color: var(--ink);
  font-size: clamp(21px, 2vw, 26px);
}

.agent-management .agent-management-filters {
  gap: 14px;
  border-color: var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.agent-management .agent-management-field {
  flex: 1 1 160px;
  min-width: min(100%, 130px);
  max-width: none;
  font-size: 14px;
}

.agent-management .agent-management-field :is(input, select),
.commission-programs .commission-program-filters :is(input, select) {
  min-width: 0;
  min-height: 42px;
  font-size: 15px;
}

#app .shell .agent-management .agent-management-table :is(td, th),
#app .shell .commission-programs .commission-program-table :is(td, th),
#app .shell .commission-refund-review .data-table :is(td, th) {
  padding: 13px 15px;
  vertical-align: top;
  font-size: 15px;
  line-height: 1.55;
}

.agent-management .agent-management-table small,
.commission-programs .commission-program-table small {
  color: var(--muted);
  font-size: 13px;
}

.agent-management .agent-management-table td strong { max-width: none; }
.agent-management .agent-management-actions { max-width: none; }

.agent-management .agent-management-actions .button,
.agent-network .agent-rule-actions .button,
.commission-programs .commission-program-table .button {
  font-size: 14px;
  min-height: 36px;
  white-space: normal;
}

.agent-network .agent-panel-heading,
.agent-network .agent-code-row,
.agent-network .agent-rule-summary,
.commission-program-pagination {
  flex-wrap: wrap;
}

.agent-network :is(.agent-help, .agent-rule-guide, .agent-label),
.commission-program-filters label,
.commission-confirm-form label {
  font-size: 14px;
}

.agent-network .agent-rule-value {
  color: var(--green);
  font-size: 25px;
  font-variant-numeric: tabular-nums;
}

.agent-network .agent-invitation-image { max-width: min(480px, 100%); }
.commission-programs .commission-program-filters {
  grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr));
  align-items: end;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.commission-programs .commission-program-table .actions {
  flex-flow: row wrap;
  align-items: center;
  min-width: 105px;
}

.commission-confirm-form .commission-confirm-item { border-color: var(--line); }
.commission-refund-review .toolbar { align-items: end; }

/* Settings and settlement forms keep their contents within their panels. */
.settings-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  align-items: start;
  gap: 16px;
}

.settings-grid > .section-card { min-width: 0; margin: 0; }
.settings-grid :is(.setting-label, .setting-value) { font-size: 15px; overflow-wrap: anywhere; }
.settings-grid .status-list li { flex-wrap: wrap; gap: 8px 14px; }
.settings-grid .status-list li > div { min-width: 0; overflow-wrap: anywhere; }
.settings-grid .export-select { width: 100%; max-width: 100%; font-size: 15px; }

#order-security-settings .form-grid {
  min-width: 0;
  margin: 16px 0 0;
}

#order-security-settings .form-grid + .form-grid {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

#order-security-settings .field-hint,
.customer-service-settings .field-hint {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.fee-preview { font-size: 15px; }
.fee-preview .fee-row { flex-wrap: wrap; gap: 6px 12px; }
.legacy-financial-history .legacy-financial-history-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; }
.legacy-financial-history-filters label { display: grid; flex: 1 1 220px; min-width: 0; gap: 5px; }
.legacy-financial-history-filters input { width: 100%; min-height: 38px; }
.section-card .endpoint { flex-wrap: wrap; font-size: 14px; }
.section-card .endpoint code { min-width: 0; overflow-wrap: anywhere; }
