/* Screen-only components. Keep print/PDF and the document's high-contrast controls independent. */
@media screen {
  html:root {
    --live-ink: var(--ds-text);
    --live-muted: var(--ds-secondary-text);
    --live-border: var(--ds-border);
    --live-bg: var(--ds-canvas);
    --live-teal: var(--ds-primary);
    --live-teal-dark: var(--ds-primary-hover);
    --live-soft: var(--ds-success-bg);
  }

  body, .live-workspace { background-color: var(--ds-canvas); color: var(--ds-text); }
  #erp-live, .live-modal { font-variant-numeric: tabular-nums; }
  :is(#erp-live, .live-modal) :is(button, input, select, textarea, code) { font-variant-numeric: inherit; }
  .live-workspace :is(.live-panel, .live-stat, .live-store-card, .fin-stat) {
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-card);
    background-color: var(--ds-surface);
    box-shadow: var(--ds-shadow);
  }
  .live-main :is(.live-panel-head, .op-heading, .home-queue-head, .live-toolbar, .fin-panel, .live-store-card) h2,
  .live-modal header h2 {
    color: var(--ds-text);
    font-size: var(--ds-heading-size);
    font-weight: var(--ds-heading-weight);
  }
  .live-main .live-muted, .live-panel .live-panel-head p {
    color: var(--ds-secondary-text);
    font-size: var(--ds-caption-size);
  }

  :is(#erp-live, .live-modal) .live-button {
    min-height: var(--ds-control-height);
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-control);
    padding: 4px 11px;
    font-size: var(--ds-body-size);
    font-weight: 550;
    line-height: 1.35;
    background: var(--ds-surface);
    color: var(--ds-secondary-text);
  }
  :is(#erp-live, .live-modal) .live-button:hover:not(:disabled) {
    background: var(--ds-table-head);
    border-color: var(--ds-muted);
    color: var(--ds-text);
  }
  :is(#erp-live, .live-modal) .live-button.primary {
    color: var(--ds-surface);
    background: var(--ds-primary);
    border-color: var(--ds-primary);
  }
  :is(#erp-live, .live-modal) .live-button.primary:hover:not(:disabled) {
    background: var(--ds-primary-hover);
    border-color: var(--ds-primary-hover);
  }
  :is(#erp-live, .live-modal) .live-button.danger {
    color: var(--ds-danger);
    background: var(--ds-danger-bg);
    border-color: var(--ds-danger-border);
  }
  :is(#erp-live, .live-modal) .live-button.danger:hover:not(:disabled) {
    border-color: var(--ds-danger);
  }
  :is(#erp-live, .live-modal) .live-button:is(.text, .ghost) {
    background: transparent;
    color: var(--ds-primary);
    border-color: transparent;
  }
  :is(#erp-live, .live-modal) .live-button:is(.text, .ghost):hover:not(:disabled) {
    background: var(--ds-table-head);
    border-color: var(--ds-border);
    text-decoration: underline;
  }
  :is(#erp-live, .live-modal) .live-button[aria-pressed="true"] {
    color: var(--ds-primary-hover);
    border-color: var(--ds-primary);
    background: var(--ds-success-bg);
  }
  :is(#erp-live, .live-modal) :is(.live-button.small, td .live-button, .live-pagination .live-button) {
    min-height: var(--ds-compact-height);
    padding: 3px 8px;
  }

  :is(#erp-live, .live-modal) :is(input:not([type]), input:is([type="text"], [type="number"], [type="date"], [type="search"], [type="password"], [type="email"], [type="url"]), select:not([multiple]):not([size]), select[size="1"]:not([multiple])) {
    height: var(--ds-field-height, var(--ds-control-height));
    min-height: var(--ds-field-height, var(--ds-control-height));
    padding-block: 0;
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-control);
    font-size: var(--ds-body-size);
    color: var(--ds-text);
    background-color: var(--ds-surface);
  }
  :is(#erp-live, .live-modal) :is(td, .live-pagination, .op-pagination, .fin-pagination) {
    --ds-field-height: var(--ds-compact-height);
  }

  :is(#erp-live, .live-modal) select:not([multiple]):is(:not([size]), [size="1"]) {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    align-content: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: normal;
    padding-inline: .65rem 2rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%23475569' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-position: right .65rem center;
    background-repeat: no-repeat;
    background-size: 1rem;
  }
  :is(#erp-live, .live-modal) select:not([multiple]):is(:not([size]), [size="1"])::picker-icon { display: none; }
  :is(#erp-live, .live-modal) select:not([multiple]):is(:not([size]), [size="1"])::-ms-expand { display: none; }
}

@media screen and (min-width: 761px) {
  .live-main .live-table { font-size: var(--ds-body-size); line-height: 1.45; }
  .live-main .live-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    padding-block: 8px;
    background-color: var(--ds-table-head);
    color: var(--ds-secondary-text);
    border-color: var(--ds-border);
    font-size: var(--ds-caption-size);
    font-weight: var(--ds-heading-weight);
  }
  .live-main .live-table th.live-sticky-action { z-index: 4; }
  .live-main .live-table tbody tr { height: var(--ds-text-row); }
  .live-main .live-table tbody tr:has(:is(img, .op-no-image, .live-product-art, .pv-placeholder)) { height: var(--ds-image-row); }
  .live-main .live-table tbody td {
    padding-block: 6px;
    color: var(--ds-secondary-text);
    font-size: var(--ds-body-size);
    border-color: var(--ds-border);
  }
}

@media screen and (forced-colors: active) {
  :is(#erp-live, .live-modal) select:not([multiple]):is(:not([size]), [size="1"]) {
    -webkit-appearance: auto;
    -moz-appearance: auto;
    appearance: auto;
    background-image: none;
  }
  :is(#erp-live, .live-modal) select:not([multiple]):is(:not([size]), [size="1"])::picker-icon { display: revert; }
  :is(#erp-live, .live-modal) select:not([multiple]):is(:not([size]), [size="1"])::-ms-expand { display: inline; }
}

/* Let short titles, store labels and identifiers share a row. Keep long specifications and fee notes readable. */
@media screen and (min-width: 761px) {
  #erp-live :is(.product-table, .of-table) .live-product > span:last-child {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: wrap;
    gap: 1px 6px;
    align-items: baseline;
  }
  #erp-live :is(.product-table, .of-table) .live-product > span:last-child > * {
    margin-block: 0;
    line-height: 1.3;
  }
  #erp-live .product-table .live-product-title { flex: 1 1 100%; }
  #erp-live .op-table .op-item { max-width: none; }
  #erp-live .op-table .op-item > div {
    display: grid;
    grid-template-columns: max-content max-content;
    gap: 2px 8px;
    align-items: center;
    min-width: 0;
  }
  #erp-live .op-table .op-item > div > strong {
    max-width: 24ch;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.3;
  }
  #erp-live .op-table .op-item > div > small { margin: 0; line-height: 1.3; }
  #erp-live .of-table .live-order-skus { display: flex; flex-wrap: wrap; gap: 2px 5px; margin-top: 2px; }
  #erp-live .of-table .live-order-skus > span {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 3px;
    max-width: 100%;
  }
  #erp-live .of-table .of-order .of-meta { margin-top: 2px; }
}
