/* The Team tab (views/team.js). Colours, sizes and corners come from tokens.css only; .tile, .tile-h and .feed are in frame.css. */

.team { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 20px 24px 28px; align-content: start; }
.team-card { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.team-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.team-head h1 { margin: 0; font-size: var(--fs-title); font-weight: 650; letter-spacing: -.01em; line-height: 1.15; }
.team-head p { margin: 4px 0 0; color: var(--mute); font-size: var(--fs-body); }
.search-people { width: min(320px, 100%); }

.team-table { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--panel); }
.trow { display: grid; grid-template-columns: minmax(260px, 1fr) repeat(4, 92px) 150px; align-items: center; min-height: 52px; }
.trow > * { padding: 0 12px; }
.thead { min-height: 36px; background: var(--panel2); color: var(--dim); font-size: var(--fs-caption); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--line); }
.thead .tc { font-size: var(--fs-caption); font-family: var(--font); font-weight: 600; color: var(--dim); display: flex; align-items: center; justify-content: center; gap: 6px; }
.thead .tc::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--c); flex: none; }
.thead .tc-active { --c: var(--st-inprogress); } .thead .tc-blocked { --c: var(--st-blocked); } .thead .tc-failed { --c: var(--st-failed); } .thead .tc-done { --c: var(--st-done); }
.trow-account, .trow-override { border-top: 1px solid var(--line); cursor: pointer; }
.thead + .trow { border-top: 0; }
.trow-account:hover, .trow-override:hover { background: var(--panel2); }
.trow.is-selected { background: var(--panel3); outline: 1px solid var(--acc); outline-offset: -1px; }
.trow:focus-visible { outline: 2px solid var(--acc); outline-offset: -2px; }
.tr-who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tr-name { font-size: var(--fs-body); font-weight: 600; color: var(--text); }
.tr-chev { display: inline-grid; place-items: center; width: 28px; height: 28px; border: 0; background: transparent; border-radius: var(--r-sm); color: var(--dim); transform: rotate(-90deg); flex: none; padding: 0; cursor: pointer; }
.tr-chev.is-open { transform: none; }
.tr-chev:hover { background: var(--panel3); color: var(--text); }
.tr-chev-gap { width: 28px; flex: none; }
.chip-tag { padding: 1px 8px; border: 1px solid var(--line2); border-radius: var(--r-sm); background: var(--panel2); color: var(--mute); font-size: var(--fs-caption); white-space: nowrap; }
.trow-override { min-height: 48px; }
.trow-override .tr-who { padding-left: 40px; }
.tr-tree { position: relative; width: 22px; height: 48px; flex: none; margin: 0 -4px 0 -8px; }
.tr-tree::before { content: ""; position: absolute; left: 6px; top: 0; height: 24px; width: 14px; border-left: 1px solid var(--line2); border-bottom: 1px solid var(--line2); border-bottom-left-radius: var(--r-sm); }
.trow-override:not(.is-last) .tr-tree::after { content: ""; position: absolute; left: 6px; top: 24px; bottom: 0; border-left: 1px solid var(--line2); }
.tr-handle { color: var(--acc2); font-size: var(--fs-caption); white-space: nowrap; }
.tc { text-align: center; font-family: var(--mono); font-size: var(--fs-body); font-weight: 600; color: var(--text); }
.tc.is-zero { color: var(--dim); font-weight: 400; }
.tc-when { color: var(--mute); font-size: var(--fs-caption); font-family: var(--mono); }
.team-none { margin: 0; padding: 18px; color: var(--mute); }

/* Initials. The ring carries the colour; the letter is always the text colour, so it reads in both themes. */
.team-card .avatar, .team-detail .avatar { background: var(--panel3); color: var(--text); border: 2px solid var(--c, var(--line2)); font-weight: 600; }
.avatar.av-0 { --c: var(--st-inprogress); } .avatar.av-1 { --c: var(--st-paused); } .avatar.av-2 { --c: var(--st-done); }
.avatar.av-3 { --c: var(--st-failed); } .avatar.av-4 { --c: var(--acc2); } .avatar.av-5 { --c: var(--acc); }

.team-detail { display: grid; grid-template-columns: minmax(240px, 1.1fr) minmax(140px, .8fr) minmax(140px, .8fr) minmax(240px, 1.6fr); align-items: center; border: 1px solid var(--line); border-radius: var(--r); padding: 14px 6px; background: var(--panel2); }
.d-who { display: flex; align-items: center; gap: 14px; padding: 0 16px; }
.d-names { display: grid; gap: 2px; }
.d-name { font-size: var(--fs-heading); font-weight: 650; }
.d-handle { color: var(--mute); font-size: var(--fs-caption); }
.d-cell { display: grid; gap: 3px; padding: 4px 20px; border-left: 1px solid var(--line); }
.d-label { color: var(--dim); font-size: var(--fs-caption); text-transform: uppercase; letter-spacing: .06em; }
.d-who, .d-cell { min-width: 0; }
.d-cell b { overflow-wrap: anywhere; font-size: var(--fs-body); font-weight: 600; }
.d-sub { color: var(--mute); font-size: var(--fs-caption); }
.team-foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; color: var(--mute); font-size: var(--fs-caption); padding: 0 2px; }

.team-activity { min-width: 0; }
.team-activity .tile-h { margin-bottom: 4px; }
.team-activity .who b { font-weight: 600; color: var(--text); }
.team-activity .who .acct { color: var(--dim); }
.team-state { margin: 20px 24px; }

@container page (max-width: 1060px) {
  .trow { grid-template-columns: minmax(220px, 1fr) repeat(4, 76px) 120px; }
}
@container page (max-width: 860px) {
  .team { padding: 14px; }
  .team-head h1 { font-size: var(--fs-title); }
  .trow { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-areas: "who who who who" "a b f d" "when when when when"; min-height: 0; padding: 10px 0; row-gap: 6px; }
  .thead { display: none; }
  .trow .tr-who { grid-area: who; }
  .trow .tc-when { grid-area: when; }
  .tc::before { display: block; font-size: var(--fs-caption); font-weight: 400; font-family: var(--font); color: var(--dim); text-align: center; text-transform: uppercase; letter-spacing: .04em; }
  .tc-active::before { content: "Active"; } .tc-blocked::before { content: "Blocked"; } .tc-failed::before { content: "Failed"; } .tc-done::before { content: "Done"; }
  .team-detail { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 12px; padding: 12px 4px; }
  .d-who, .d-wide { grid-column: 1 / -1; }
  .d-cell { border-left: 0; padding: 4px 16px; }
  .tr-handle { display: none; }
  .trow-override .tr-who { padding-left: 24px; }
  .tr-who { flex-wrap: wrap; }
  .tr-name { min-width: 0; overflow-wrap: anywhere; }
}
