/* Shared table density, column geometry and node identity colors. */

table {
  width: max-content;
  border-collapse: collapse;
  text-align: left;
  white-space: nowrap;
  font-size: 12px;
  line-height: var(--table-line-height);
  font-variant-numeric: tabular-nums;
}

table th, table td {
  padding: var(--table-cell-y) var(--table-cell-x);
  vertical-align: middle;
  line-height: var(--table-line-height);
}

table th {
  background: var(--table-header);
  color: var(--text-secondary);
  font-weight: 600;
}

table td {
  border-top: 1px solid var(--table-border);
  font-family: ui-monospace, monospace;
}

table tbody tr:hover:not(.editing) {
  background: var(--table-hover);
}

table :is(button, .quiet, .danger) {
  min-height: 26px;
  padding: 4px 8px;
  font-size: 12px;
  line-height: 18px;
  vertical-align: middle;
}

table .tag {
  padding: 2px 6px;
  font-size: 11px;
  line-height: 16px;
  vertical-align: middle;
}

.query-identity {
  display: inline-flex;
  align-items: center;
  gap: 4px 8px;
  vertical-align: middle;
  white-space: nowrap;
}

.query-identity-name {
  font-size: inherit;
}

.query-identity > .tag {
  flex-shrink: 0;
}

table td small {
  font-size: 11px;
  line-height: 1.4;
}

table .empty {
  padding: 24px var(--table-cell-x);
}

.query-logs :is(.log-location, .log-domain, .log-ecs, .log-upstream) {
  line-height: var(--table-line-height);
}

.query-logs .log-location {
  font-family: inherit;
  max-width: none;
  white-space: nowrap;
  overflow-wrap: normal;
}

table .code-tree-path > div {
  min-height: 26px;
}

table .code-tree-toggle, table .code-tree-file {
  padding: 2px 6px;
  line-height: 20px;
}

.table-wrap {
  max-width: 100%;
  overflow: auto;
}

.panel.table-wrap {
  width: fit-content;
}

.record-table .record-actions {
  flex-wrap: nowrap;
  gap: 4px;
  margin-top: 0px;
}

.analytics-ranking .analytics-identity {
  min-width: 0px;
  max-width: 300px;
  white-space: nowrap;
}

.analytics-ranking .analytics-text {
  max-width: 260px;
  white-space: normal;
  overflow-wrap: anywhere;
}

:is(.record-table, .query-logs table, .analytics-ranking table, .code-tree) {
  min-width: 0px;
}

:is(.record-table, .query-logs table, .analytics-ranking table, .code-tree) td {
  min-width: 0px;
}

.packet-table {
  white-space: normal;
  table-layout: auto;
}

.packet-table th:first-child {
  width: auto;
}

table:has(tbody > tr:only-child > td.empty:only-child) {
  width: 100%;
}

.panel.table-wrap:has(tbody > tr:only-child > td.empty:only-child) {
  width: 100%;
}

.query-logs :is(.log-location, .log-domain, .log-ecs, .log-upstream, .source-asn), .code-tree .code-tree-path, .record-table :is(.record-owner, .record-values) {
  min-width: 0px;
}

table .value {
  min-width: 0px;
}

table button, table button:is(.quiet, .danger, .primary), table button:is(:hover, :disabled) {
  border: 0px;
  background: transparent;
  box-shadow: none;
  color: rgb(40, 110, 91);
}

table button:hover:not(:disabled) {
  border: 0px;
  background: rgb(231, 243, 238);
  color: rgb(18, 109, 84);
}

table button.danger, table button.danger:hover:not(:disabled) {
  color: rgb(168, 77, 66);
  background: transparent;
}

table button.danger:hover:not(:disabled) {
  background: rgb(255, 240, 236);
}

table button:disabled, table button:is(.quiet, .danger, .primary):disabled {
  border: 0px;
  background: transparent;
  color: var(--text-muted);
  opacity: 0.5;
  cursor: not-allowed;
}

.query-logs .tag.nxdomain {
  background: rgb(234, 242, 255);
  color: rgb(40, 100, 180);
}

.query-logs .tag.nodata {
  background: var(--status-warning-bg);
  color: var(--status-warning-text);
}

.query-logs .log-source-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 20px;
  white-space: nowrap;
}

.query-logs .log-source-line + .log-source-line {
  margin-top: 4px;
}

.query-logs .log-source-location {
  font-family: inherit;
  color: var(--text-secondary);
}

.node-badge {
  display: inline-flex;
  align-items: center;
  font-family: inherit;
  font-weight: 600;
  white-space: nowrap;
}

.tag.node-green {
  background: rgb(225, 243, 234);
  color: rgb(23, 100, 72);
}

.tag.node-blue {
  background: rgb(230, 238, 251);
  color: rgb(40, 92, 163);
}

.tag.node-purple {
  background: rgb(239, 232, 248);
  color: rgb(112, 68, 154);
}

.tag.node-amber {
  background: rgb(255, 240, 214);
  color: rgb(137, 92, 21);
}

.tag.node-slate {
  background: rgb(233, 237, 241);
  color: rgb(72, 92, 112);
}

/* Shared actions and interaction for rows that open a detail dialog. */
.table-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

tr.detail-row {
  cursor: pointer;
  transition: background 0.12s;
}

tr.detail-row:hover {
  background: rgb(241, 249, 246);
}

tr.detail-row:focus-visible {
  outline: rgb(22, 140, 112) solid 2px;
  outline-offset: -2px;
  background: rgb(237, 248, 243);
}

/* Scenario rows use the shared table density and DNS name/type presentation. */
.response-table .scenario-cell {
  white-space: nowrap;
}

.response-table .scenario-cell-name {
  min-width: 152px;
  max-width: 272px;
}

.response-table .scenario-cell-match .scenario-cell-text {
  max-width: 280px;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
}

.response-table .scenario-cell-text {
  display: block;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.response-table .scenario-cell-description .scenario-cell-text {
  max-width: 340px;
}

.response-table .scenario-step {
  display: block;
  white-space: nowrap;
}
