/* Presentation only: retain OrderCenter's DOM, data, states and native details.
 * The html/body type selectors outrank the later runtime stylesheet without
 * !important; every selector remains restricted to the order content region.
 */
html body .oc-root .oc-content {
  container-type: inline-size;
  container-name: d51-orders-compact;
  min-width: 0;
}

html body .oc-root .oc-content .oc-hero {
  padding: 12px 14px;
  gap: 8px;
}

html body .oc-root .oc-content .oc-title-row {
  gap: 8px;
}

html body .oc-root .oc-content .oc-title {
  font-size: 17px;
  line-height: 1.5;
  gap: 4px 8px;
}

html body .oc-root .oc-content .oc-sub {
  font-size: 11px;
  overflow-wrap: anywhere;
}

/* Keep both date labels and all existing controls; flatten only their rows. */
html body .oc-root .oc-content .order-search {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
  min-width: 0;
}

html body .oc-root .oc-content .order-search > .os-row {
  display: contents;
}

html body .oc-root .oc-content .order-search .osf {
  flex: 0 1 128px;
  min-width: 0;
  max-width: 100%;
  gap: 4px;
}

html body .oc-root .oc-content .os-row-primary > .osf:first-child {
  flex: 0 1 132px;
}

html body .oc-root .oc-content .os-row-primary > .osf-kw {
  flex: 1 1 180px;
}

html body .oc-root .oc-content .os-row-secondary > .osf:last-of-type {
  flex: 0 1 96px;
}

html body .oc-root .oc-content .osf label {
  font-size: 11px;
  line-height: 16px;
}

html body .oc-root .oc-content .osf input,
html body .oc-root .oc-content .osf select {
  height: 36px;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  padding: 0 8px;
  font-size: 12px;
}

html body .oc-root .oc-content .osf input.os-date {
  min-width: 0;
  padding: 0 7px;
}

html body .oc-root .oc-content .osf-kw input {
  padding-left: 28px;
}

html body .oc-root .oc-content .date-sep {
  display: none;
}

html body .oc-root .oc-content .search-go,
html body .oc-root .oc-content .search-reset {
  height: 36px;
  min-width: 0;
  max-width: 100%;
  flex: 0 1 auto;
  padding: 0 10px;
  font-size: 12px;
}

html body .oc-root .oc-content .filter-bar {
  margin: 8px 0 0;
  padding: 6px 12px;
  gap: 6px;
  font-size: 11px;
}

html body .oc-root .oc-content .f-opts {
  gap: 2px 4px;
  min-width: 0;
}

html body .oc-root .oc-content .f-opt {
  padding: 3px 7px;
  gap: 4px;
}

html body .oc-root .oc-content .result-bar {
  margin: 6px 0 0;
  gap: 4px 8px;
  font-size: 11px;
}

html body .oc-root .oc-content .sort-item {
  padding: 3px 5px;
}

html body .oc-root .oc-content .order-list {
  margin: 6px 0 0;
  gap: 10px;
}

html body .oc-root .oc-content .order-head {
  padding: 7px 12px;
  gap: 4px 12px;
  font-size: 11px;
  line-height: 1.6;
}

html body .oc-root .oc-content .order-head > span {
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

html body .oc-root .oc-content .oh-status {
  font-size: 11px;
  padding: 2px 8px;
}

/* The existing three direct children stay unchanged: products occupy row one,
 * amounts and actions share row two, and each group may naturally wrap.
 */
html body .oc-root .oc-content .order-main {
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.65fr);
  align-items: stretch;
  gap: 0;
}

html body .oc-root .oc-content .order-main > .order-items {
  grid-column: 1 / -1;
  padding: 0 12px;
  min-width: 0;
}

html body .oc-root .oc-content .order-body,
html body .oc-root .oc-content .order-body + .order-body,
html body .oc-root .oc-content .order-body:last-child {
  padding: 9px 0;
  min-height: 72px;
  box-sizing: border-box;
  gap: 10px;
}

html body .oc-root .oc-content .item-img-wrap {
  width: 56px;
  gap: 4px;
}

html body .oc-root .oc-content .item-img {
  width: 52px;
  height: 52px;
  box-sizing: border-box;
}

html body .oc-root .oc-content .item-info {
  gap: 4px;
}

html body .oc-root .oc-content .item-part {
  font-size: 15px;
  line-height: 22px;
  white-space: normal;
  overflow-wrap: anywhere;
}

html body .oc-root .oc-content .item-attrs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 14px;
  font-size: 12px;
}

html body .oc-root .oc-content .item-attrs > .attr {
  gap: 4px;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

html body .oc-root .oc-content .attr .al {
  font-size: 11px;
}

/* Only direct summary rows become inline; expanded fee rows retain their
 * original label/value layout and native closed/open disclosure behavior.
 */
html body .oc-root .oc-content .order-main > .amount-col {
  grid-column: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  align-content: center;
  gap: 4px 14px;
  padding: 8px 12px;
}

html body .oc-root .oc-content .amount-col > .ac-title {
  display: none;
}

html body .oc-root .oc-content .amount-col > .ac-row {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  justify-content: flex-start;
  flex: 0 1 auto;
  gap: 5px;
  padding: 0;
  font-size: 11px;
  max-width: 100%;
}

html body .oc-root .oc-content .amount-col > .ac-row .ac-l {
  flex: 0 1 auto;
}

html body .oc-root .oc-content .amount-col > .ac-row .ac-v {
  flex: 0 1 auto;
  text-align: left;
  font-size: 12px;
  max-width: 100%;
}

html body .oc-root .oc-content .amount-col > .ac-total {
  align-items: baseline;
  justify-content: flex-start;
  border-left: 0;
  border-top: 0;
  padding: 0;
  text-align: left;
}

html body .oc-root .oc-content .amount-col > .ac-total .ac-l {
  text-align: left;
}

html body .oc-root .oc-content .amount-col > .ac-total .ac-v {
  font-size: 17px;
  line-height: 1.3;
  text-align: left;
}

html body .oc-root .oc-content .amount-col > .amount-details {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
}

html body .oc-root .oc-content .amount-col > .amount-details[open] {
  flex: 1 1 100%;
}

html body .oc-root .oc-content .amount-details summary {
  padding: 4px 0;
  font-size: 11px;
  line-height: 20px;
}

html body .oc-root .oc-content .order-main > .item-action {
  grid-column: 2;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
}

html body .oc-root .oc-content .item-action > button,
html body .oc-root .oc-content .item-action > a {
  width: auto;
  max-width: 100%;
  min-height: 32px;
  flex: 0 1 auto;
  font-size: 11px;
}

html body .oc-root .oc-content .item-action .btn-buy,
html body .oc-root .oc-content .item-action .btn-line,
html body .oc-root .oc-content .item-action .btn-danger {
  height: auto;
  min-height: 32px;
  padding: 4px 8px;
}

html
  body
  .oc-root
  .oc-content
  .item-action
  > button.ui-chat-action.ui-chat-action-fullwidth {
  width: auto;
  height: auto;
  min-height: 32px;
  padding: 4px 8px;
  white-space: normal;
}

html body .oc-root .oc-content .order-logistics .express-col {
  padding: 8px 12px;
  gap: 4px 12px;
}

html body .oc-root .oc-content .ec-title,
html body .oc-root .oc-content .ec-no,
html body .oc-root .oc-content .ec-none,
html body .oc-root .oc-content .ec-more {
  font-size: 11px;
  white-space: normal;
  overflow-wrap: anywhere;
}

html body .oc-root .oc-content .order-foot {
  padding: 8px 12px;
  gap: 4px 14px;
  font-size: 11px;
}

html body .oc-root .oc-content .of-item {
  gap: 4px;
}

html body .oc-root .oc-content .pagination {
  padding: 12px 0;
  gap: 5px;
}

/* Query the real right-hand content width, not the viewport or sidebar. */
@container d51-orders-compact (max-width: 560px) {
  html body .oc-root .oc-content .oc-hero {
    padding: 12px;
  }

  html body .oc-root .oc-content .os-row-primary > .osf:first-child,
  html body .oc-root .oc-content .os-row-primary > .osf-kw {
    flex: 1 1 100%;
  }

  html body .oc-root .oc-content .os-row-secondary > .osf:nth-of-type(-n + 2) {
    flex: 1 1 calc(50% - 4px);
  }

  html body .oc-root .oc-content .os-row-secondary > .osf:last-of-type {
    flex: 1 1 88px;
  }

  html body .oc-root .oc-content .order-main {
    grid-template-columns: minmax(0, 1fr);
  }

  html body .oc-root .oc-content .order-main > .amount-col,
  html body .oc-root .oc-content .order-main > .item-action {
    grid-column: 1 / -1;
  }

  html body .oc-root .oc-content .order-main > .amount-col {
    gap: 4px 12px;
  }

  html body .oc-root .oc-content .order-main > .item-action {
    padding-top: 6px;
    padding-bottom: 6px;
  }

  html body .oc-root .oc-content .item-part {
    font-size: 14px;
  }

  html body .oc-root .oc-content .item-attrs {
    gap: 2px 10px;
  }

  html body .oc-root .oc-content .result-count {
    width: 100%;
    margin-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html body .oc-root .oc-content .order-card,
  html body .oc-root .oc-content button,
  html body .oc-root .oc-content input,
  html body .oc-root .oc-content select,
  html body .oc-root .oc-content a,
  html body .oc-root .oc-content summary,
  html body .oc-root .oc-content svg {
    transition: none;
    animation: none;
    scroll-behavior: auto;
  }
}
