/* =========================================================
   PEOPLE PERFORMANCE
   Matches the current engine.js markup
========================================================= */

.team-performance-table {
  width: 100%;
  margin-top: 24px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 16px;
  background: rgba(7, 14, 24, 0.42);
}

/* Header and rows use the same grid */
.team-table-head,
.team-row {
  display: grid;
  grid-template-columns:
    minmax(230px, 1.45fr)
    minmax(140px, 0.85fr)
    minmax(140px, 0.85fr)
    minmax(160px, 0.95fr)
    minmax(120px, 0.65fr);
  align-items: center;
  column-gap: 24px;
}

/* =========================================================
   TABLE HEADER
========================================================= */

.team-table-head {
  min-height: 52px;
  padding: 0 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.025);
}

.team-table-head span {
  color: rgba(232, 238, 247, 0.44);
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* =========================================================
   TEAM ROW
========================================================= */

.team-row {
  min-height: 88px;
  padding: 16px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
  transition:
    background 160ms ease,
    border-color 160ms ease;
}

.team-row:last-child {
  border-bottom: 0;
}

.team-row:hover {
  background: rgba(255, 255, 255, 0.025);
}

/* =========================================================
   TEAM MEMBER
========================================================= */

.team-member {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.team-avatar {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(232, 82, 26, 0.26);
  border-radius: 12px;
  background: rgba(232, 82, 26, 0.09);
  color: #ff6730;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  box-shadow: inset 0 0 18px rgba(232, 82, 26, 0.025);
}

.team-member > div:last-child {
  min-width: 0;
}

.team-member strong {
  display: block;
  overflow: hidden;
  color: #f1f4f8;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-member span {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: rgba(232, 238, 247, 0.48);
  font-size: 12px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* =========================================================
   PERFORMANCE CELLS
========================================================= */

.performance-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.performance-track {
  position: relative;
  flex: 1;
  min-width: 70px;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.075);
}

.performance-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  transition: width 800ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* Healthy */
.performance-fill.good {
  background: linear-gradient(
    90deg,
    rgba(61, 214, 151, 0.65),
    #3dd697
  );
  box-shadow: 0 0 12px rgba(61, 214, 151, 0.24);
}

/* Monitor */
.performance-fill.attention {
  background: linear-gradient(
    90deg,
    rgba(255, 181, 71, 0.65),
    #ffb547
  );
  box-shadow: 0 0 12px rgba(255, 181, 71, 0.22);
}

/* Action required */
.performance-fill.critical {
  background: linear-gradient(
    90deg,
    rgba(255, 91, 91, 0.65),
    #ff6b6b
  );
  box-shadow: 0 0 12px rgba(255, 91, 91, 0.22);
}

.performance-value {
  flex: 0 0 auto;
  min-width: 48px;
  color: #eef2f7;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  font-weight: 600;
  text-align: right;
}

/* =========================================================
   STATUS BADGES
========================================================= */

.team-row > div:last-child {
  display: flex;
  justify-content: flex-start;
}

.team-status {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border: 1px solid rgba(61, 214, 151, 0.18);
  border-radius: 999px;
  background: rgba(61, 214, 151, 0.08);
  color: #47d99b;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.07em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.team-status::before {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  content: "";
}

/* These classes must match member.status in the JSON */

.team-status.good,
.team-status.healthy,
.team-status.stable,
.team-status.excellent {
  border-color: rgba(61, 214, 151, 0.2);
  background: rgba(61, 214, 151, 0.08);
  color: #47d99b;
}

.team-status.attention,
.team-status.watch,
.team-status.busy,
.team-status.monitor {
  border-color: rgba(255, 181, 71, 0.22);
  background: rgba(255, 181, 71, 0.08);
  color: #ffb547;
}

.team-status.critical,
.team-status.risk,
.team-status.action {
  border-color: rgba(255, 91, 91, 0.22);
  background: rgba(255, 91, 91, 0.08);
  color: #ff6b6b;
}

/* =========================================================
   EMPTY STATE
========================================================= */

#teamPerformance:empty::before {
  display: block;
  padding: 30px 24px;
  color: rgba(232, 238, 247, 0.45);
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  content: "NO TEAM PERFORMANCE DATA AVAILABLE";
}

/* =========================================================
   TABLET
========================================================= */

@media (max-width: 1100px) {
  .team-table-head,
  .team-row {
    grid-template-columns:
      minmax(190px, 1.3fr)
      minmax(120px, 0.8fr)
      minmax(120px, 0.8fr)
      minmax(140px, 0.9fr)
      minmax(110px, 0.65fr);
    column-gap: 16px;
  }

  .team-table-head,
  .team-row {
    padding-left: 18px;
    padding-right: 18px;
  }
}

/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 760px) {
  .team-performance-table {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .team-table-head {
    display: none;
  }

  #teamPerformance {
    display: grid;
    gap: 12px;
  }

  .team-row {
    grid-template-columns: 1fr 1fr;
    gap: 18px 20px;
    min-height: auto;
    padding: 18px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 14px;
    background: rgba(7, 14, 24, 0.48);
  }

  .team-row:last-child {
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  }

  .team-member {
    grid-column: 1 / -1;
  }

  .performance-cell {
    flex-direction: column;
    align-items: flex-start;
    gap: 7px;
  }

  .performance-track {
    width: 100%;
    min-width: 0;
  }

  .performance-value {
    min-width: auto;
    text-align: left;
  }

  .team-row > div:last-child {
    align-items: flex-end;
    justify-content: flex-start;
  }
}

@media (max-width: 520px) {
  .team-row {
    grid-template-columns: 1fr;
  }

  .team-member {
    grid-column: auto;
  }
}