/* Screen tables share one compact policy; paper and business visibility stay intact. */
@media screen {
  :root { --ui-detail-control-height: 32px; }
  :root[data-ui-controls="large"] { --ui-detail-control-height: 44px; }
  .ui-detail-scroll { width: 100%; max-width: 100%; min-width: 0; overflow-x: auto; }
  .ui-detail-table {
    --ui-control-current-height: var(--ui-detail-control-height);
    --control-height: var(--ui-detail-control-height);
    --control-height-sm: var(--ui-detail-control-height);
  }
  /* Painted blank lines add screen space without adding rows to business data. */
  .ui-detail-table[data-ui-table-padding] {
    background-image: repeating-linear-gradient(to bottom,
      var(--panel) 0, var(--panel) calc(var(--ui-table-line-height) - 1px),
      var(--line) calc(var(--ui-table-line-height) - 1px), var(--line) var(--ui-table-line-height));
    background-size: 100% var(--ui-table-fill-height);
    background-repeat: no-repeat;
    background-position: left 0 bottom var(--ui-table-footer-height);
  }
  .ui-detail-table > tbody[data-ui-table-fill]::after {
    content: "";
    display: table-row;
    height: var(--ui-table-fill-height);
  }
  :is(.app-main, dialog, [role="dialog"]) table.ui-detail-table {
    display: table;
    width: 100%;
    border-collapse: collapse;
    font-size: var(--ui-font-body, 13px);
    line-height: 1.4;
  }
  :is(.app-main, dialog, [role="dialog"]) .ui-detail-table > thead { display: table-header-group; }
  :is(.app-main, dialog, [role="dialog"]) .ui-detail-table > tbody { display: table-row-group; }
  :is(.app-main, dialog, [role="dialog"]) .ui-detail-table > tfoot { display: table-footer-group; }
  :is(.app-main, dialog, [role="dialog"]) .ui-detail-table > :is(thead, tbody, tfoot) > tr {
    display: table-row;
    margin: 0;
    padding: 0;
    border-radius: 0;
  }
  :is(.app-main, dialog, [role="dialog"]) .ui-detail-table > :is(thead, tbody, tfoot) > tr > :is(th, td),
  :is(.app-main, dialog, [role="dialog"]) .ui-detail-table.ui-input-table :is(th, td)[data-ui-column] {
    display: table-cell;
    padding: var(--ui-table-padding-y, 5px) var(--ui-table-padding-x, 10px) !important;
    vertical-align: middle;
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
    border-bottom: 1px solid var(--line, #d7dfdb);
    border-right: 1px solid var(--line, #d7dfdb);
    line-height: 1.4;
    letter-spacing: 0;
  }
  :is(.app-main, dialog, [role="dialog"]) .ui-detail-table > thead > tr > th {
    background-color: var(--surface-subtle);
    font-size: var(--ui-font-small, 12px);
    color: var(--table-heading, var(--muted));
    font-weight: 600;
  }
  :where(.ui-detail-table) > tbody > tr { background-color: var(--panel); }
  :where(.ui-detail-table) > tbody > tr:hover { background-color: var(--row-hover, #f5f9f6); }
  :where(.ui-detail-table) > tbody > tr:focus-within:not(:where(.warning, .danger, .success, .inventory-row-error, [data-edited])) { background-color: var(--accent-soft); }
  :is(.app-main, dialog, [role="dialog"]) .ui-detail-table > :is(thead, tbody, tfoot) > tr > :last-child { border-right: 0; }
  :is(.app-main, dialog, [role="dialog"]) .ui-detail-table > tbody > tr > td::before { content: none; }
  :is(.app-main, dialog, [role="dialog"]) .ui-detail-table :is(td.empty, td[data-ui-column="note"]) {
    white-space: normal;
    overflow-wrap: anywhere;
  }
  :is(.app-main, dialog, [role="dialog"]) .ui-detail-table :is(input, select, button, .button):not([type="hidden"]):not([type="checkbox"]):not([type="radio"]) {
    min-height: var(--ui-detail-control-height);
    line-height: 1.35;
  }
  /* Read-only/disabled is still enforced by the original field attributes. */
  :is(.app-main, dialog, [role="dialog"]) .ui-detail-table :is(input, textarea):is(:read-only, :disabled):not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]),
  :is(.app-main, dialog, [role="dialog"]) .ui-detail-table select:disabled {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    opacity: 1;
    color: inherit;
  }
  :is(.app-main, dialog, [role="dialog"]) .ui-detail-table select:disabled { appearance: none; }
  :is(.app-main, dialog, [role="dialog"]) .ui-detail-table input:read-only:focus-visible {
    outline: 2px solid var(--accent, #1f7a58);
    outline-offset: 1px;
  }
  :is(.app-main, dialog, [role="dialog"]) .ui-detail-table [hidden],
  :is(.app-main, dialog, [role="dialog"]) .ui-detail-table[hidden] { display: none !important; }
}
@media screen and (max-width: 760px) {
  :root { --ui-detail-control-height: 44px; }
}
@media print {
  .ui-detail-scroll { display: contents; }
}
