/* ── Table base ──────────────────────────────────────────────────────── */

.service-group { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1.25rem; }

.service-group h3 {
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

th, td {
  text-align: left;
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
  vertical-align: top;
}

th { background: #222634; color: var(--muted); font-weight: 500; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }

tbody tr:nth-child(even) { background: #1e2231; }
tbody tr:hover { background: #252840; }

thead th { position: relative; }

#inv-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  box-shadow: inset 0 -1px 0 var(--border);
}

#inv-table { table-layout: fixed; }
#inv-table td { overflow-wrap: anywhere; }
#inv-table th:first-child,
#inv-table td:first-child {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: normal;
}

th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--text); }
th.sort-asc::after  { content: " ↑"; color: var(--accent); }
th.sort-desc::after { content: " ↓"; color: var(--accent); }

td pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 20rem;
  overflow: auto;
  font-size: 0.8rem;
  color: var(--muted);
  background: #11141b;
  padding: 0.5rem;
  border-radius: 4px;
}

td.num { text-align: center; }

/* ── In-header search inputs + filter buttons ────────────────────────── */

th.th-with-search { white-space: normal; vertical-align: top; }
th.th-with-search.sort-asc::after,
th.th-with-search.sort-desc::after { content: none; }
th.th-with-search.sort-asc .th-label-row::after  { content: " ↑"; color: var(--accent); }
th.th-with-search.sort-desc .th-label-row::after { content: " ↓"; color: var(--accent); }

.th-label-row { white-space: nowrap; }

th .th-search {
  display: block;
  width: 100%;
  min-width: 60px;
  margin-top: 4px;
  font-size: 0.72rem;
  padding: 2px 5px;
  height: 22px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}
th .th-search:focus { border-color: var(--accent); }
th .th-search::placeholder { color: var(--muted); opacity: 0.7; }
th .th-search::-webkit-search-cancel-button { cursor: pointer; }

.th-filter-btn {
  display: block;
  width: 100%;
  min-width: 60px;
  margin-top: 4px;
  font-size: 0.72rem;
  padding: 2px 6px;
  height: 22px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
  border-color: var(--border);
}
.th-filter-btn:hover { border-color: var(--accent); color: var(--text); }
.th-filter-btn.filter-active { border-color: var(--accent); color: var(--accent); background: rgba(79,140,255,0.1); }

/* ── Column resize handle ────────────────────────────────────────────── */

.col-resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 5px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
  z-index: 2;
  transition: background 0.12s;
}
.col-resizer:hover { background: var(--accent); opacity: 0.6; }
body.col-resizing { cursor: col-resize !important; user-select: none; }
body.col-resizing .col-resizer { background: var(--accent); opacity: 0.6; }

/* ── Row highlight + selection (inventory) ───────────────────────────── */

tr.row-highlight { background: #1b2a1b; outline: 1px solid #6ee7a8; }
#inv-tbody tr { cursor: pointer; }
#inv-table tr.row-selected { background: #1c2540; outline: 1px solid var(--accent); }
#inv-table tr.row-selected:hover { background: #1c2540; }

/* ── Badges ──────────────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 500;
  background: var(--border);
  color: var(--text);
  text-transform: lowercase;
}

.status-running { background: #1b3a2a; color: #6ee7a8; }
.status-creating, .status-modifying, .status-backing-up, .status-updating { background: #3a2f1b; color: #f6c76a; }
.status-deleting, .status-failed, .status-stopped, .status-inaccessible-encryption-credentials { background: #3a1b1b; color: #ff7a7a; }

.sev-critical { background: #3a1b1b; color: #ff7a7a; }
.sev-high     { background: #3a2a1b; color: #ffaa55; }
.sev-medium   { background: #3a2f1b; color: #f6c76a; }
.sev-low      { background: #1b2f1b; color: #6ee7a8; }

/* ── Cluster grouping — expand/collapse + child rows ───────────────── */

/* Cluster Identifier cell — the whole cell is the expand/collapse click
   target. Inline chevron + child-count badge are visual cues; the click
   handler lives on the TD and stopPropagations so the row's detail-drawer
   handler never sees it. Other cells on the same row remain clickable for
   the drawer. */
.cluster-id-cell {
  cursor: pointer;
  user-select: none;
}
.cluster-id-cell:hover { background: #1f2635; }

.inline-chevron {
  display: inline-block;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1;
  min-width: 14px;
  margin-right: 6px;
  text-align: center;
}
.cluster-id-cell:hover .inline-chevron { color: var(--text); }

.child-count-badge {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0 6px;
  border-radius: 9px;
  font-size: 0.68rem;
  background: #1f2635;
  border: 1px solid #2e3950;
  color: #a6c2e5;
  letter-spacing: 0.02em;
  text-transform: lowercase;
}

.comp-row.child-row { background: #14171f; }
.comp-row.child-row td { border-top: 1px dashed #242938; }
.comp-row.child-hidden { display: none; }
.child-row-cell { color: var(--muted); }
