*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 13px;
  background: #f1f5f9;
  color: #1e293b;
}

/* ─── Controls bar ─────────────────────────────────────────────────────────── */

.controls {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.group-modes {
  display: flex;
  gap: 3px;
}

.group-btn {
  padding: 4px 11px;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  color: #475569;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.group-btn:hover  { background: #f1f5f9; }
.group-btn.active { background: #1d4ed8; color: #fff; border-color: #1d4ed8; }

.filters {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.filters select,
.filters input[type="search"] {
  height: 28px;
  padding: 0 8px;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  font-size: 12px;
  color: #1e293b;
  background: #fff;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.filters select:focus,
.filters input[type="search"]:focus {
  border-color: #1d4ed8;
  box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.15);
}

#search { width: 180px; }

.result-count {
  margin-left: auto;
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
}

/* ─── Table layout ─────────────────────────────────────────────────────────── */

.table-wrap {
  padding: 16px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  min-width: 820px;
}

/* ─── Header ───────────────────────────────────────────────────────────────── */

thead th {
  background: #f8fafc;
  padding: 8px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.055em;
  color: #64748b;
  border-bottom: 1px solid #e2e8f0;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: background 0.1s;
}
thead th:hover  { background: #f1f5f9; color: #475569; }
thead th.sorted { color: #1d4ed8; }

.sort-arrow { font-size: 10px; margin-left: 3px; }

/* ─── Body rows ────────────────────────────────────────────────────────────── */

tbody tr { border-bottom: 1px solid #f1f5f9; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover td { background: #f8fafc; }

tbody td {
  padding: 6px 12px;
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

td[data-col="family"] { max-width: 160px; }
td[data-col="description"] { max-width: 260px; }
td[data-col="status"]      { text-align: center; width: 52px; }
td[data-col="uuid"]        { font-family: monospace; font-size: 12px; color: #64748b; }
td[data-col="name"]        { font-weight: 600; }

/* ─── Group headers ────────────────────────────────────────────────────────── */

tr.group-header td {
  background: #eff6ff;
  border-top: 1px solid #bfdbfe;
  border-bottom: 1px solid #bfdbfe;
  font-weight: 600;
  font-size: 14px;
  color: #1e40af;
  padding: 5px 12px 5px 12px;
  height: 52px;
  vertical-align: bottom;
  letter-spacing: 0.02em;
  max-width: none;
}

/* ─── Per-group column headers ─────────────────────────────────────────────── */

tr.col-header th {
  background: #f1f5f9;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.055em;
  color: #64748b;
  border-bottom: 1px solid #e2e8f0;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: background 0.1s;
}
tr.col-header th:hover  { background: #e2e8f0; color: #475569; }
tr.col-header th.sorted { color: #1d4ed8; }

/* ─── Status dot ───────────────────────────────────────────────────────────── */

.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ─── Last seen age colours ────────────────────────────────────────────────── */

.age-now    { color: #16a34a; }
.age-recent { color: #2563eb; }
.age-old    { color: #7c3aed; }
.age-stale  { color: #dc2626; }

/* ─── Empty state ──────────────────────────────────────────────────────────── */

.no-results {
  text-align: center;
  color: #94a3b8;
  padding: 40px 12px !important;
  font-style: italic;
  max-width: none !important;
}
