.agent-profile-link {
  color: #6841bf;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
}

.agent-profile-link:hover { text-decoration-color: currentColor; }
.agent-profile-link:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.profile-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 14px;
  color: #6841bf;
  font-weight: 650;
  text-decoration: none;
}

.profile-breadcrumb:hover { text-decoration: underline; }
.profile-breadcrumb:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.profile-state {
  min-height: 180px;
  display: grid;
  place-items: center;
  padding: 32px;
  color: var(--muted);
  text-align: center;
}

.profile-state[hidden], #profile-content[hidden] { display: none; }

.profile-error-copy { max-width: 520px; line-height: 1.6; }

.profile-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  padding: 24px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--surface) 55%, var(--purple-soft));
}

.profile-identity {
  min-width: 0;
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

.profile-avatar {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(194, 65, 12, 0.2);
  border-radius: 50%;
  background: var(--purple-soft);
  color: var(--purple);
  font-size: 20px;
  font-weight: 800;
}

.profile-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.profile-title-row h1 { margin: 0; font-size: 25px; letter-spacing: -0.03em; }
.profile-summary { max-width: 720px; margin: 8px 0 0; color: #555; line-height: 1.55; }
.profile-last-review { display: block; margin-top: 7px; color: var(--muted); font-size: 11px; }

.profile-risk {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 750;
}

.profile-risk-empty, .profile-risk-limited { color: var(--muted); }
.profile-score-panel { display: grid; grid-template-columns: repeat(2, minmax(92px, 1fr)); align-content: center; gap: 8px; }
.profile-score-panel div { padding: 12px 14px; border: 1px solid var(--border); border-radius: 6px; background: rgba(255, 255, 255, 0.82); }
.profile-score-panel span, .profile-score-panel small { display: block; color: var(--muted); font-size: 10px; }
.profile-score-panel strong { display: block; margin: 4px 0; font-size: 22px; }

.profile-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.profile-kpi { min-height: 100px; padding: 15px; }
.profile-kpi span { color: var(--muted); font-size: 10px; font-weight: 650; text-transform: uppercase; }
.profile-kpi strong { display: block; margin: 9px 0 5px; font-size: 25px; letter-spacing: -0.04em; }
.profile-kpi small { color: var(--muted); }
.profile-kpi-pass { border-top: 3px solid var(--green-fill); background: linear-gradient(145deg, var(--green-soft), #fff 76%); }
.profile-kpi-issue { border-top: 3px solid var(--red-fill); background: linear-gradient(145deg, var(--red-soft), #fff 76%); }
.profile-kpi-unable { border-top: 3px solid var(--unable-fill); background: linear-gradient(145deg, var(--unable-soft), #fff 76%); }
.profile-kpi-technical { border-top: 3px solid var(--technical-fill); background: linear-gradient(145deg, var(--technical-soft), #fff 76%); }
.profile-kpi-pass > span, .profile-kpi-pass > strong { color: var(--green); }
.profile-kpi-issue > span, .profile-kpi-issue > strong { color: var(--red); }
.profile-kpi-unable > span, .profile-kpi-unable > strong { color: var(--unable); }
.profile-kpi-technical > span, .profile-kpi-technical > strong { color: var(--technical); }

.profile-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1.25fr) minmax(300px, 0.75fr);
  gap: 12px;
}

.profile-outcomes, .profile-categories { display: grid; gap: 13px; }
.profile-outcome-row { display: grid; grid-template-columns: 130px minmax(100px, 1fr) 38px; align-items: center; gap: 10px; }
.profile-outcome-row strong { text-align: right; }
.profile-outcome-track, .profile-category-track { height: 8px; overflow: hidden; border-radius: 999px; background: var(--chart-track); }
.profile-outcome-track > span, .profile-category-track > span { display: block; height: 100%; min-width: 2px; border-radius: inherit; background: var(--technical-fill); }
.profile-outcome-track .outcome-pass { background: var(--green-fill); }
.profile-outcome-track .outcome-issue { background: var(--red-fill); }
.profile-outcome-track .outcome-insufficient_evidence { background: var(--unable-fill); }
.profile-outcome-track .outcome-technical_failure { background: var(--technical-fill); }
.profile-category { display: grid; grid-template-columns: minmax(120px, 1fr) 1.5fr 32px; align-items: center; gap: 10px; }
.profile-category strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-category-track > .problem-bar { background: linear-gradient(90deg, var(--red-fill), var(--red)); }
.profile-category > span:last-child { color: var(--muted); text-align: right; }

.profile-history-table { min-width: 860px; table-layout: fixed; }
.profile-history-table th:nth-child(1) { width: 15%; }
.profile-history-table th:nth-child(2) { width: 34%; }
.profile-history-table th:nth-child(3) { width: 22%; }
.profile-history-table th:nth-child(4) { width: 11%; }
.profile-history-table th:nth-child(5) { width: 10%; }
.profile-history-table th:nth-child(6) { width: 8%; }

@media (max-width: 1180px) {
  .profile-kpi-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  .profile-hero { grid-template-columns: 1fr; }
  .profile-score-panel { max-width: 360px; }
  .profile-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .profile-hero { padding: 18px; }
  .profile-identity { grid-template-columns: 48px minmax(0, 1fr); }
  .profile-avatar { width: 48px; height: 48px; font-size: 16px; }
  .profile-title-row h1 { font-size: 20px; }
  .profile-kpi-grid { grid-template-columns: 1fr; }
  .profile-score-panel { grid-template-columns: 1fr 1fr; }
  .profile-outcome-row { grid-template-columns: 120px minmax(70px, 1fr) 32px; }
}

@media (prefers-reduced-motion: reduce) {
  .agent-profile-link { scroll-behavior: auto; }
}
