/* Data-display primitives: tables, status pills, tags, avatars, SLA badges,
   metric strips, load bars, pagination and empty states.

   Loaded alongside components.css, which holds the interactive controls. */

/* ---------- tables ---------- */

.table-wrap {
  overflow-x: auto;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-md);
}
table.data th {
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.045em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: var(--surface-2);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data th a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: inherit;
}
table.data th a:hover {
  color: var(--ink-2);
}
table.data th svg {
  width: 11px;
  height: 11px;
  opacity: 0;
}
table.data th a:hover svg {
  opacity: 0.5;
}
table.data th.is-sorted a {
  color: var(--ink);
}
table.data th.is-sorted svg {
  opacity: 1;
}
table.data td {
  padding: var(--space-3);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data tbody tr:last-child td {
  border-bottom: none;
}
table.data tbody tr:hover {
  background: var(--surface-2);
}
table.data tbody tr.is-selected {
  background: var(--accent-soft);
}
table.data tbody tr.is-unread .cell-subject a {
  font-weight: 650;
}

.cell-check {
  width: 34px;
  padding-right: 0 !important;
}
.cell-id {
  font-family: var(--mono);
  font-size: var(--text-sm);
  color: var(--ink-3);
  white-space: nowrap;
}
.cell-subject {
  min-width: 240px;
}
.cell-subject a {
  font-weight: 550;
  color: var(--ink);
}
.cell-subject a:hover {
  color: var(--accent-ink);
  text-decoration: underline;
}
.cell-subject .sub {
  display: block;
  font-size: var(--text-sm);
  color: var(--ink-3);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 42ch;
}
.cell-meta {
  color: var(--ink-2);
  white-space: nowrap;
}
.cell-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.cell-who {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  white-space: nowrap;
}

input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ---------- pills, tags, avatars ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.005em;
  white-space: nowrap;
}
.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentcolor;
  flex: none;
}
.pill-new {
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-color: var(--accent-line);
}
.pill-open {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger-line);
}
.pill-pending {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: var(--warn-line);
}
.pill-on_hold {
  background: var(--surface-3);
  color: var(--ink-2);
  border-color: var(--border-strong);
}
.pill-solved {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: var(--ok-line);
}

.pri {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--text-sm);
  font-weight: 550;
  color: var(--ink-2);
  white-space: nowrap;
}
.pri::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 2px;
  flex: none;
  background: var(--border-strong);
}
.pri-urgent {
  color: var(--danger);
}
.pri-urgent::before {
  background: var(--danger);
}
.pri-high::before {
  background: var(--warn);
}
.pri-normal::before {
  background: var(--accent);
}
.pri-low::before {
  background: var(--border-strong);
}

.tag {
  display: inline-block;
  padding: 1px 7px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: var(--text-xs);
  font-weight: 500;
  white-space: nowrap;
}
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 50%;
  color: var(--ink-inverse);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.02em;
  user-select: none;
  /* --avatar-h is set per user from a hash of their name. */
  background: oklch(0.56 0.115 var(--avatar-h, 250));
}
.avatar-sm {
  width: 22px;
  height: 22px;
  font-size: 9px;
}
.avatar-lg {
  width: 34px;
  height: 34px;
  font-size: var(--text-md);
}
.avatar-none {
  background: var(--surface-3);
  color: var(--ink-3);
  border: 1px dashed var(--border-strong);
}

.stack {
  display: flex;
  align-items: center;
}
.stack .avatar + .avatar {
  margin-left: -7px;
  box-shadow: 0 0 0 2px var(--surface);
}

/* ---------- sla ---------- */

.sla {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  white-space: nowrap;
}
.sla svg {
  width: 13px;
  height: 13px;
}
.sla-soon {
  color: var(--warn);
  font-weight: 600;
}
.sla-breached {
  color: var(--danger);
  font-weight: 600;
}
.sla-met {
  color: var(--ink-3);
}

/* ---------- metrics ---------- */

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.metric {
  padding: var(--space-3) var(--space-4);
  border-left: 1px solid var(--border);
}
.metric:first-child {
  border-left: none;
}
.metric dt {
  font-size: var(--text-sm);
  color: var(--ink-2);
  font-weight: 500;
}
.metric dd {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 3px;
}
.metric .value {
  font-size: var(--text-2xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.metric .note {
  font-size: var(--text-sm);
  color: var(--ink-3);
}
.metric .trend-up {
  color: var(--ok);
  font-weight: 600;
}
.metric .trend-down {
  color: var(--danger);
  font-weight: 600;
}

/* Horizontal load bar — workload by agent, volume by view. */
.bar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: center;
  gap: var(--space-3);
  padding: 7px 0;
}
.bar-row + .bar-row {
  border-top: 1px solid var(--border);
}
.bar-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  font-size: var(--text-md);
}
.bar-label span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-track {
  grid-column: 1 / -1;
  height: 5px;
  border-radius: 3px;
  background: var(--surface-3);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transition: width var(--dur) var(--ease-out);
}
.bar-fill.is-hot {
  background: var(--warn);
}
.bar-fill.is-over {
  background: var(--danger);
}
.bar-count {
  text-align: right;
  font-size: var(--text-md);
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}

/* ---------- empty ---------- */

.empty {
  display: grid;
  justify-items: center;
  gap: var(--space-2);
  padding: var(--space-10) var(--space-6);
  text-align: center;
}
.empty svg {
  width: 30px;
  height: 30px;
  color: var(--ink-3);
  margin-bottom: var(--space-1);
}
.empty h3 {
  font-size: var(--text-base);
  font-weight: 600;
}
.empty p {
  font-size: var(--text-md);
  color: var(--ink-2);
  max-width: 46ch;
}
.empty .btn {
  margin-top: var(--space-2);
}


/* ---------- pagination ---------- */

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.pager-info {
  font-size: var(--text-md);
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.pager-nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.pager-nav .btn {
  min-width: 28px;
  padding: 0 7px;
}
.pager-nav .btn.is-on {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent-ink);
  font-weight: 650;
}
.pager-gap {
  padding: 0 3px;
  color: var(--ink-3);
}

/* ---------- bulk action bar ---------- */

.bulkbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--accent-soft);
  border-bottom: 1px solid var(--accent-line);
  font-size: var(--text-md);
  color: var(--accent-ink);
}
.bulkbar[hidden] {
  display: none;
}
.bulkbar strong {
  font-variant-numeric: tabular-nums;
}

