/* Profile (S5): one record's page (dashboard-profile.js), and the note the
   router puts above the old company page opened with ?legacy=1 under the
   Arkham shell (nexus-rooms.js legacyNotice). Tokens only. Labels stay in
   normal case with no tracking; each count or ref sits in its own mono chip.
   Every control is at least 32 px high. */

.pf-room {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 1440px;
  min-width: 0;
}
.pf-room .btn {
  min-height: 32px;
}
.pf-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 16px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.pf-face {
  flex: none;
  width: 48px;
  height: 48px;
  background: var(--bg-3);
  border: 1px solid var(--border-strong);
}
.pf-face-square {
  border-radius: var(--radius-md);
}
.pf-face-round {
  border-radius: 50%;
}
.pf-face-hex {
  border: 0;
  clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0 50%);
}
.pf-face-pill {
  width: 72px;
  border-radius: var(--radius-full);
}
.pf-title {
  display: flex;
  flex: 1 1 240px;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.pf-name {
  margin: 0;
  color: var(--text-1);
  font-size: 24px;
  font-weight: 300;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.pf-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pf-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  color: var(--text-2);
  font-size: 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.pf-ref {
  overflow-wrap: anywhere;
}
.pf-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
/* Ask about this record (nexus-ask.js), opened from the header's Ask. */
.pf-ask {
  min-width: 0;
}
.pf-ask[hidden] {
  display: none;
}
.pf-room a:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
.pf-empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 24px 16px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.pf-empty-text {
  margin: 0;
  color: var(--text-2);
  font-size: 14px;
}
.pf-legacy-note {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px 16px;
  color: var(--text-2);
  font-size: 13px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.pf-legacy-note .btn {
  min-height: 32px;
}

.pf-face {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-1);
  font-family: var(--font-mono);
  font-size: 14px;
}
.pf-counts .pf-badge {
  color: var(--text-1);
}
.pf-icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.pf-icon-link:hover {
  color: var(--text-1);
  background: var(--bg-2);
}
.pf-room .os-menu-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
}
.pf-room .os-menu-item {
  min-height: 32px;
}

/* The four panels: two columns at desktop width, one below 760 px. Each
   panel grows with what it holds (at least 400 px in the first row and 440 px
   in the second), so nothing is ever clipped under a scroll edge. */
.pf-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: minmax(400px, auto) minmax(440px, auto);
  gap: 12px;
}
.pf-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.pf-panel:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
.pf-panel-head {
  display: flex;
  flex: none;
  align-items: stretch;
  min-height: 40px;
  padding: 0 8px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.pf-panel-title {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0 8px;
  color: var(--text-1);
  font-size: 13px;
  font-weight: 500;
}
.pf-tabs {
  display: flex;
  align-items: stretch;
  gap: 4px;
}
.pf-tab {
  min-height: 40px;
  padding: 0 12px;
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 12px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}
.pf-tab:hover {
  color: var(--text-1);
}
.pf-tab[aria-selected="true"] {
  color: var(--text-1);
  border-bottom-color: var(--accent);
}
.pf-tab:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: -2px;
}
.pf-panel-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 16px;
}
.pf-section-title {
  margin: 16px 0 8px;
  color: var(--text-1);
  font-size: 13px;
  font-weight: 500;
}
.pf-muted {
  margin: 0;
  color: var(--text-2);
  font-size: 13px;
}
.pf-link {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  color: var(--link);
  font-size: 13px;
  overflow-wrap: anywhere;
}
.pf-name-text {
  color: var(--text-1);
  font-size: 13px;
  overflow-wrap: anywhere;
}

/* Facts: what is known, where it comes from and when. */
.pf-facts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}
.pf-fact {
  display: grid;
  grid-template-columns: minmax(96px, 140px) minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 12px;
  color: var(--text-1);
  font-size: 13px;
}
.pf-fact-label {
  color: var(--text-2);
}
.pf-fact-value {
  overflow-wrap: anywhere;
}
.pf-fact-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}
.pf-fact-reason {
  display: block;
  padding-left: 12px;
  color: var(--text-2);
}
.pf-overview-facts[hidden],
.pf-edge-holder[hidden],
.pf-tab-body[hidden] {
  display: none;
}

/* The dossier, mounted inside the first panel: Profile has its own header,
   and its folder tabs stand in for the dossier's own. */
.pf-room .os-map-dossier-head,
.pf-room .os-map-dossier-tabs {
  display: none;
}
.pf-room .pf-dossier {
  padding: 0;
  border: 0;
  background: transparent;
}

/* Rows: a record chip and its state chips. */
.pf-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.pf-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 40px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.pf-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.pf-case {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  color: var(--text-1);
  font-size: 14px;
}
.pf-case-word {
  color: var(--text-2);
}
.pf-gate {
  margin: 0 0 8px;
  color: var(--text-1);
  font-size: 13px;
}
.pf-room .nx-chip-main,
.pf-room .nx-chip-more {
  min-height: 32px;
}

/* Relationships (nexus-profile-relationships.js). */
.pf-rel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
  min-height: 0;
}
.pf-rel-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.pf-rel-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pf-rel-modes {
  display: inline-flex;
  gap: 4px;
}
.pf-rel-mode,
.pf-rel-chip {
  min-height: 32px;
  padding: 0 12px;
  color: var(--text-2);
  font-size: 12px;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
}
.pf-rel-mode[aria-pressed="true"],
.pf-rel-chip[aria-pressed="true"] {
  color: var(--text-1);
  border-color: var(--accent-line);
  background: var(--accent-wash);
}
.pf-rel-mode:focus-visible,
.pf-rel-chip:focus-visible,
.pf-rel-node:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
.pf-rel-canvas {
  position: relative;
  flex: none;
  height: 344px;
  overflow: hidden;
}
.pf-rel-canvas[hidden],
.pf-rel-tablebox[hidden] {
  display: none;
}
.pf-rel-edges {
  position: absolute;
  inset: 0;
  color: var(--border-strong);
}
.pf-rel-edge {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}
.pf-rel-edge-inferred {
  stroke-dasharray: 4 4;
}
.pf-rel-edge-on {
  color: var(--accent);
  stroke-width: 2;
}
.pf-rel-marker {
  color: var(--border-strong);
}
.pf-rel-layer {
  position: absolute;
  inset: 0;
}
.pf-rel-node {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 168px;
  min-height: 44px;
  padding: 8px 12px;
  color: var(--text-1);
  text-decoration: none;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
}
a.pf-rel-node:hover {
  border-color: var(--accent-line);
}
.pf-rel-node-focus {
  border-color: var(--accent-line);
  background: var(--accent-wash);
}
.pf-rel-face {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: var(--text-1);
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--bg-3);
}
.pf-rel-face-square {
  border-radius: var(--radius-sm);
}
.pf-rel-face-round {
  border-radius: 50%;
}
.pf-rel-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.pf-rel-name,
.pf-rel-type {
  overflow-wrap: anywhere;
}
.pf-rel-name {
  font-size: 13px;
}
.pf-rel-type {
  color: var(--text-2);
  font-size: 12px;
}
.pf-rel-chip {
  position: absolute;
}
.pf-rel-table {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}
.pf-rel-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.pf-rel-row-on {
  background: var(--accent-wash);
}
.pf-rel-sentence {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 13px;
}
.pf-rel-predicate,
.pf-rel-self {
  color: var(--text-2);
}
.pf-rel-row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

@media (max-width: 760px) {
  .pf-head {
    gap: 12px;
  }
  .pf-face {
    width: 40px;
    height: 40px;
  }
  .pf-face-pill {
    width: 60px;
  }
  .pf-name {
    display: -webkit-box;
    overflow: hidden;
    font-size: 20px;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
  .pf-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
  }
  .pf-rel-canvas {
    height: 320px;
  }
  .pf-panel-overview {
    order: 1;
  }
  .pf-panel-activity {
    order: 2;
  }
  .pf-panel-relationships {
    order: 3;
  }
  .pf-panel-last {
    order: 4;
  }
  .pf-fact {
    grid-template-columns: minmax(0, 1fr);
  }
  .pf-fact-meta {
    justify-content: flex-start;
  }
  .pf-actions .pf-category-add,
  .pf-actions .btn-secondary {
    display: none;
  }
}
