/* Tables scroll inside their own box, so a wide one never pushes a phone's page sideways. Numbers sit right in tabular
   figures so they line up digit under digit. */

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.table th {
  position: sticky;
  top: 0;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-sunk);
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

.table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table .is-number {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.table th:first-child,
.table td:first-child {
  padding-left: 20px;
}

.table th:last-child,
.table td:last-child {
  padding-right: 20px;
}

.table-dense td {
  padding-top: 8px;
  padding-bottom: 8px;
}

.chart-table .table th:first-child,
.chart-table .table td:first-child {
  padding-left: 0;
}

.chart-table .table th:last-child,
.chart-table .table td:last-child {
  padding-right: 0;
}

.chart-table .table th {
  background: var(--surface);
}

.table tr.is-openable {
  cursor: pointer;
}

.table tr.is-openable:hover td {
  background: var(--surface-hover);
}

.table tr.is-openable:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.table tr.is-deleted td {
  color: var(--ink-3);
}

.nowrap,
.table .mono {
  white-space: nowrap;
}

.cell-stack {
  display: flex;
  flex-direction: column;
  gap: 1px;
  white-space: nowrap;
}

.cell-stack .muted {
  font-size: 12px;
}

.cell-order,
.cell-code {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.cell-message {
  display: block;
  min-width: 220px;
  max-width: 520px;
  overflow-wrap: anywhere;
}

/* Lists that become cards on a phone */
.phone-list {
  display: none;
  margin: 0;
  padding: 0;
  list-style: none;
}

.phone-row {
  display: block;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
}

.phone-row.is-openable {
  cursor: pointer;
}

.phone-row.is-openable:active {
  background: var(--surface-hover);
}

.phone-row.is-deleted {
  color: var(--ink-3);
}

.phone-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 12px;
  align-items: center;
  font-size: 13px;
}

.phone-card-wide {
  grid-column: 1 / -1;
  overflow-wrap: anywhere;
  color: var(--ink-3);
}

.phone-card-picture {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

@media (max-width: 640px) {
  .has-phone-list > .table-scroll {
    display: none;
  }

  .has-phone-list > .phone-list {
    display: block;
  }
}
