/* Read-only screen text only. Numeric values and controls are never clipped. */
.screen-table-text {
  display: block;
  width: 100%;
  max-width: var(--screen-table-text-width, 320px);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.screen-table-text-host {
  min-width: 0;
  max-width: 100%;
}

/* Existing tables style descendant spans; a clipping span must inherit its text host. */
body[data-screen-table-display="true"] table :is(td, th) .screen-table-text {
  margin: 0;
  color: inherit;
  font: inherit;
}

.screen-table-text:focus-visible {
  outline: 2px solid var(--ui-primary);
  outline-offset: -2px;
}

.screen-table-tooltip {
  position: fixed;
  z-index: 11000;
  max-width: min(560px, calc(100vw - 24px));
  max-height: min(320px, 45vh);
  overflow: auto;
  padding: 9px 12px;
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--ui-radius-sm);
  background: var(--ui-surface-raised);
  color: var(--ui-text);
  box-shadow: var(--ui-shadow-md);
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.screen-table-tooltip[hidden] { display: none; }

@media print {
  .screen-table-text {
    width: auto;
    max-width: none;
    overflow: visible;
    white-space: inherit;
    text-overflow: clip;
  }
  .screen-table-tooltip { display: none !important; }
}
