/* EntityRow chrome (kit) — selectable / static / header rows, meta slots,
   trailing ⋯ menu, context menu sizing (`ui/entity_row`, `ui/context_menu`).
   `.brand-row` stays as an e2e alias of `.entity-row`. */

.brand-row-badges,
.entity-row__meta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  margin-left: auto;
  flex-shrink: 0;
}

/* Meta columns — `--entity-meta-slot-w` equalizes *end* (number) columns only.
   Start slots (status badges, icons, dates) hug content so a long pill like
   «not certifiable» cannot inflate every slot and crush the label. */
.entity-row__meta-slot {
  box-sizing: border-box;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-start;
  width: auto;
  min-width: 0;
  text-align: var(--align-text, left);
}

.entity-row__meta-slot[data-align="start"] {
  justify-content: flex-start;
  text-align: var(--align-text, left);
}

.entity-row__meta-slot[data-align="end"] {
  flex: 0 0 var(--entity-meta-slot-w, max-content);
  width: var(--entity-meta-slot-w, max-content);
  min-width: var(--entity-meta-slot-w, max-content);
  justify-content: flex-end;
  text-align: var(--align-number, right);
}

.entity-row__meta-slot[data-align="end"] .badge,
.entity-row__meta-slot[data-align="end"] .muted {
  font-variant-numeric: tabular-nums;
}

.entity-row__meta-slot .muted {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Status pills must show the full word — never ellipsis (`allowe…`).
   Center on the row cross-axis (base `.badge` is flex-start for form columns). */
.entity-row__meta-slot .badge {
  max-width: none;
  overflow: visible;
  flex-shrink: 0;
  align-self: center;
  white-space: nowrap;
}

/* Sparse column placeholder — keeps width via the slot; no visible chrome. */
.entity-row__meta-empty {
  display: block;
  width: 0;
  height: 1em;
  overflow: hidden;
}

.entity-row__badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  width: 1.1em;
  height: 1.1em;
  line-height: 0;
}

.entity-row__badge svg {
  display: block;
}

.entity-row__trailing {
  margin-left: auto;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.entity-row__shell {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  /* Shell owns the hairline so it runs under the trailing ellipsis. */
  border-bottom: 1px solid var(--border-subtle);
}

.entity-row__shell > .entity-row {
  flex: 1;
  min-width: 0;
  border-bottom: none;
}

.entity-row__shell:hover {
  background: var(--bg-elevated);
}

.entity-row__shell:hover > .entity-row,
.entity-row__shell:hover > .entity-row:hover {
  background: transparent;
}

.entity-row__shell:has(> .entity-row.selected) {
  background: var(--selection);
  box-shadow: inset 4px 0 0 var(--accent);
}

.entity-row__shell:has(> .entity-row.selected) > .entity-row.selected {
  background: transparent;
  box-shadow: none;
}

/* Select-row toolbar: sits beside the row button, never inside it. */
.entity-row__shell > .entity-row__toolbar {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  padding-right: var(--space-1);
}

.entity-row__shell > .entity-row__trailing {
  padding-right: var(--list-pad-x);
}

.entity-row__shell:has(> .entity-row.selected) .entity-row__menu-btn:hover {
  background: color-mix(in srgb, var(--text) 8%, transparent);
}

.entity-row__meta + .entity-row__trailing {
  margin-left: 0;
}

.entity-row__menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: calc(var(--u) * 6);
  height: calc(var(--u) * 6);
  margin: 0;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.entity-row__menu-btn:hover {
  background: var(--bg-elevated);
  color: var(--text);
}

.ui-context-menu {
  width: max-content;
  min-width: var(--ui-menu-min);
  max-width: min(18rem, calc(100vw - 24px));
}

.ui-context-menu__check {
  display: inline-flex;
  width: 0.85em;
  flex-shrink: 0;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}

.ui-context-menu--submenu {
  min-width: var(--ui-menu-min);
}

/* Selectable roster rows (brands / users). Keep .brand-row for e2e. */
.entity-row,
.brand-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-height: var(--row-h);
  margin: 0;
  padding: var(--space-2) var(--list-pad-x);
  border: none;
  border-bottom: 1px solid var(--border-subtle);
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.entity-row:hover,
.brand-row:hover {
  background: var(--bg-elevated);
}

.entity-row.selected,
.brand-row.selected {
  background: var(--selection);
  box-shadow: inset 4px 0 0 var(--accent);
  color: var(--text);
}

.entity-row--static {
  cursor: default;
  /* Same list gutter as selectable rows (atomics `list-pad-x`). Equal X/Y
     so framed / standalone static rows are not flush to the chrome edge. */
  padding: var(--list-pad-x);
  width: 100%;
  justify-content: flex-start;
}

.entity-row--static:hover {
  background: transparent;
}

/* Inspector entity header — no list rule, hug content */
.entity-row--header {
  border-bottom: none;
  padding: 0;
  width: 100%;
}

.entity-row--header .entity-row__text {
  flex: 1;
  min-width: 0;
}
