/* Extra columns retain the shared Companies directory treatment. */
#factories-table thead th:nth-child(1) { width: 34%; }
#factories-table thead th:nth-child(2) { width: 7%; }
#factories-table thead th:nth-child(3) { width: 16%; text-align: left; }
#factories-table thead th:nth-child(4) { width: 9%; text-align: right; }
#factories-table thead th:nth-child(5) { width: 270px; }
#profiles-table thead th:nth-child(1) { width: 38%; }
#profiles-table thead th:nth-child(2) { width: 120px; text-align: right; }
#profiles-table thead th:nth-child(3) { width: auto; text-align: left; }
.factory-directory__state, .factory-directory__location, .profile-directory__companies {
  color: var(--company-muted); font-size: .85rem; overflow-wrap: anywhere;
}
.profile-directory__companies a { color: var(--company-text); }
.profile-directory__companies a:hover { color: var(--company-accent); text-decoration: underline; }
.profile-directory__avatar .company-directory__logo { padding: 0; object-fit: cover; }
.premium-icon { width: .9rem; height: .9rem; vertical-align: super; fill: currentColor; }
.premium-icon.f { color: #D4AF37; }
.premium-icon.l1 { color: #C0C0C0; }
.premium-icon.l2 { color: #CD7F32; }
@media (max-width: 768px) {
  #factories-table thead th:nth-child(n), #profiles-table thead th:nth-child(n) { width: auto; text-align: left; }
  #factories-table .factory-directory__state, #factories-table .factory-directory__location,
  #profiles-table .profile-directory__companies { grid-column: 1 / -1; padding-left: 54px; }
  #factories-table .factory-directory__state::before { content: 'State: '; color: var(--company-muted); }
  #factories-table .factory-directory__location::before { content: 'Location: '; color: var(--company-muted); }
}

.profile-company-list { display: grid; gap: 10px; }
.profile-company-list .profile-company {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  width: fit-content; max-width: 100%; text-decoration: none;
}
.profile-company__logo { width: 28px; height: 28px; flex: 0 0 28px; padding: 3px; border-radius: 6px; background: #fff; object-fit: contain; }
.profile-company__logo[hidden] { display: none; }
.profile-company__name { min-width: 0; overflow-wrap: anywhere; }
.profile-company:hover .profile-company__name { text-decoration: underline; }
.profile-company .premium-icon { flex-shrink: 0; margin: 0; }
.profile-company__avatar { position: relative; display: grid; place-items: center; width: 28px; height: 28px; flex: 0 0 28px; overflow: hidden; border-radius: 6px; background: var(--company-soft); color: var(--company-muted); }
.profile-company__initials { font-size: .65rem; font-weight: 600; color: var(--company-accent); }
.profile-company__avatar .profile-company__logo { position: absolute; inset: 0; }
.profile-company__status { padding: 3px 6px; border-radius: 5px; background: var(--company-soft); color: var(--company-text); font-size: .65rem; line-height: 1.3; white-space: nowrap; }
.profile-company__status--former { background: transparent; color: var(--company-muted); border: 1px solid var(--company-line); }

/* One company per row; the full list opens outside the table. */
.profile-company-list { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 36px; }
.profile-company-list.is-collapsed > .profile-company:not(:first-child) { display: none; }
.profile-company-list > .profile-company { flex-wrap: nowrap; min-width: 0; }
.profile-company-list .profile-company__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-company-more { flex-shrink: 0; }
.profile-company-popover {
  --company-text: #243044; --company-muted: #667387; --company-line: #dce3ed; --company-soft: #f2f5fa; --company-accent: #315fb8;
}
html[data-theme="dark"] .profile-company-popover {
  --company-text: #edf0f6; --company-muted: #a6b1c1; --company-line: #354052; --company-soft: #242e3d; --company-accent: #a9c6ff;
}
.profile-company-popover__list { display: grid; gap: 12px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.profile-company-popover__list .profile-company { display: flex; align-items: center; gap: 8px; color: var(--company-text); font-size: .85rem; text-decoration: none; }
.profile-company-popover__list .profile-company__name { flex: 1; }
.profile-company-popover__list a:focus-visible { outline: 2px solid #648cf2; outline-offset: -2px; }

#profiles-table .company-directory__identity { min-height: 44px; }
.profile-directory__title { margin-top: 3px; color: var(--company-muted); font-size: .78rem; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
