/* REQ-126: the Team page. The colour tokens (:root) and shared components are in ../styles.css; this file never defines :root variables. */

/* Team page (#team, REQ-22 / REQ-23): the organogram and the idea-to-feature flow. Semantic variables only;
   --pod is a team's own colour from its Firestore document. */
.tm { gap: 36px; }
.tm-sec { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.tm-sec > h2 { margin: 0; font: 800 24px/1.15 var(--font-display); }
.tm-org { display: flex; flex-direction: column; gap: 0; min-width: 0; }
.tm-owner { display: flex; align-items: center; gap: 14px; align-self: center; max-width: 100%; padding: 14px 20px; border-radius: 16px; background: var(--accent-soft); border: 1px solid var(--line); }
.tm-owner h3 { margin: 0; font: 800 20px/1.2 var(--font-display); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tm-owner p { margin: 2px 0 0; color: var(--mute); font-size: 14px; }
.tm-owner > div { min-width: 0; overflow-wrap: anywhere; } 
/* REQ-112: a long name or role wraps instead of widening the page */
.tm-stem { width: 2px; height: 22px; background: var(--line); align-self: center; }
.tm-tag { display: inline-block; font: 700 11px/1 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; padding: 4px 7px; border-radius: 8px; background: var(--sunken); color: var(--mute); margin-left: 6px; }
.tm-tag--owner { background: var(--panel); color: var(--accent); margin-left: 0; }
.tm-av { --sz: 36px; flex: none; border-radius: 50%; background: var(--sunken); object-fit: cover; }
span.tm-av { display: inline-grid; place-items: center; width: var(--sz); height: var(--sz); font: 800 calc(var(--sz) * .42)/1 var(--font-display); }
.tm-av--human { background: var(--accent); color: var(--panel); }
.tm-av--group { background: var(--sunken); color: var(--mute); border: 1px solid var(--line); font-family: var(--font-mono); }
.tm-pods { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1100px) { .tm-pods { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 860px) { .tm-pods { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .tm-pods { grid-template-columns: minmax(0, 1fr); margin-left: 12px; padding-left: 14px; border-left: 2px solid var(--line); }
  .tm-owner { align-self: stretch; }
  .tm-stem { display: none; }
  .tm-org > .tm-owner { margin-bottom: 14px; }
}
.tm-pod, .tm-loose { background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--pod, var(--line)); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.tm-loose { margin-top: 14px; border-top: 1px dashed var(--faint); border: 1px dashed var(--faint); background: transparent; }
.tm-pod h3, .tm-loose h3 { margin: 0; font: 800 17px/1.2 var(--font-display); display: flex; align-items: center; gap: 8px; }
.tm-pod h3 i { width: 10px; height: 10px; border-radius: 50%; background: var(--pod); flex: none; }
.tm-pod-head { display: flex; flex-direction: column; gap: 6px; }
.tm-focus { margin: 0; color: var(--mute); font-size: 13.5px; }
.tm-lead { margin: 0; display: inline-flex; align-items: center; flex-wrap: wrap; gap: 2px; width: fit-content; max-width: 100%; padding: 5px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--ink); font: 700 13px/1.2 var(--font-body); }
.tm-lead.none { background: var(--sunken); color: var(--mute); }
.tm-lead-i { color: var(--accent); margin-right: 2px; }
/* REQ-112.1.3 (UAT-156): a long lead name wraps instead of widening the page (.ag-chip is nowrap elsewhere). */
.tm-lead .ag-chip { white-space: normal; overflow-wrap: anywhere; min-width: 0; }
.tm-pick { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--mute); }
/* REQ-112: WebKit (Safari, and Chrome on an iPhone) gives a <select> its own
   intrinsic width; a full-width select can't push the card wider. */
.tm-pick { min-width: 0; }
.tm-pick select { min-height: 44px; width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; }
.tm-small { margin: 0; font-size: 12px; color: var(--faint); overflow-wrap: anywhere; } 
/* "Lead set by <email>" */
.tm-members { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.tm-person { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px 6px; border-radius: 10px; color: var(--ink); text-decoration: none; min-width: 0; }
a.tm-person:hover { background: var(--accent-soft); }
a.tm-person:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.tm-who { display: flex; flex-direction: column; min-width: 0; }
.tm-who b { font-size: 14px; overflow-wrap: anywhere; }
.tm-who span { font-size: 12.5px; color: var(--mute); overflow-wrap: anywhere; }
.tm-who .tm-podname { color: var(--faint); }
.tm-none { color: var(--mute); font-size: 13.5px; padding: 6px; }

.tm-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: space-between; }
.tm-bar .seg button { min-height: 44px; }
/* Phones: the four products in a 2 x 2 grid, so every tab is on screen and reachable by touch. */
@media (max-width: 760px) {
  .tm-bar .seg { display: grid; grid-template-columns: 1fr 1fr; overflow: visible; width: 100%; }
  .tm-bar .seg button { white-space: normal; min-width: 0; }
}
.tm-propose { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 14px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 12px; }
.tm-propose p { margin: 0; flex: 1 1 220px; }
.tm-propose .btn { min-height: 44px; }
.tm-editbtn { min-height: 44px; }
.tm-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: var(--mute); }
.tm-legend li { display: inline-flex; align-items: center; gap: 6px; }
.tm-state { display: inline-flex; align-items: center; gap: 3px; font: 700 11px/1 var(--font-mono); letter-spacing: .04em; padding: 4px 7px; border-radius: 8px; white-space: nowrap; }
.tm-state--implemented { background: var(--done-soft); color: var(--done); }
.tm-state--partly { background: var(--needs-soft); color: var(--needs); }
.tm-state--planned { background: var(--review-soft); color: var(--review); }
.tm-state--proposed { background: transparent; color: var(--faint); border: 1px dashed var(--faint); }
.tm-legend { margin-bottom: 4px; }
.tm-steps { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 12px 22px; align-items: stretch; }
.tm-stepli { position: relative; display: flex; flex-direction: column; width: 196px; }
.tm-stepli:has(.tm-detail) { width: 100%; }
.tm-stepli .tm-step { width: 196px; height: auto; flex: 1 1 auto; }
.tm-stepli:has(.tm-detail) .tm-step { flex: none; }
.tm-detail { flex: none; }
.tm-detail { margin-top: 10px; }
.tm-arrow { position: absolute; right: -19px; top: 22px; width: 16px; text-align: center; color: var(--faint); font-size: 16px; line-height: 1; }
.tm-stepli:last-child .tm-arrow, .tm-stepli:has(.tm-detail) .tm-arrow { display: none; }
.tm-step { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; min-width: 0; max-width: 100%; box-sizing: border-box; text-align: left; min-height: 44px; height: 100%; padding: 12px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); color: var(--ink); font: inherit; cursor: pointer; }
.tm-step:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.tm-step:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tm-step[aria-expanded="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.tm-step--proposed { border: 1px dashed var(--faint); background: transparent; }
.tm-step-n { font: 800 14.5px/1.25 var(--font-display); max-width: 100%; overflow-wrap: anywhere; }
/* REQ-112: WebKit sizes a -webkit-box (line-clamp) to its unwrapped text, which
   made the steps wider than a phone; cap it at the card's width. */
.tm-step-w { font-size: 12.5px; color: var(--mute); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 100%; min-width: 0; overflow-wrap: anywhere; }
.tm-step--proposed .tm-step-n, .tm-step--proposed .tm-step-w { color: var(--faint); }
.tm-step-f { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; width: 100%; margin-top: auto; }
.tm-faces { display: inline-flex; align-items: center; }
.tm-faces .tm-av { width: 24px; height: 24px; margin-left: -6px; border: 2px solid var(--panel); box-sizing: content-box; }
.tm-faces .tm-av:first-child { margin-left: 0; }
.tm-faces span.tm-av { --sz: 24px; }
.tm-more { margin-left: 4px; font: 700 11.5px/1 var(--font-mono); color: var(--mute); }
.tm-detail, .tm-dialog { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 10px; color: var(--ink); }
.tm-detail { width: 100%; box-sizing: border-box; }
.tm-detail-top { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.tm-detail h3, .tm-dialog h2 { margin: 0; font: 800 18px/1.2 var(--font-display); }
.tm-detail h4, .tm-dialog h4 { margin: 4px 0 0; font: 700 10.5px/1 var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.tm-what, .tm-why, .tm-req { margin: 0; font-size: 14px; color: var(--mute); }
.tm-detail .tm-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
.tm-detail .btn.ghost, .tm-dialog .btn.ghost { align-self: flex-start; min-height: 44px; }
.tm-dialog { width: min(480px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; padding: 16px; box-sizing: border-box; }
.tm-dialog[open] { display: flex; }
.tm-dialog:not([open]) { display: none; } 
/* the display:flex above would show a closed dialog */
.tm-dialog::backdrop { background: rgba(8, 6, 14, 0.5); }
@media (max-width: 760px) {
  .tm-steps { flex-direction: column; flex-wrap: nowrap; gap: 8px; }
  .tm-stepli, .tm-stepli:has(.tm-detail) { width: 100%; }
  .tm-stepli .tm-step { width: 100%; }
  .tm-arrow { display: none; }
}
.tm-toast, .inv-toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60; max-width: calc(100vw - 24px); padding: 12px 16px; border-radius: 12px; background: var(--ink); color: var(--bg); font: 700 14px/1.3 var(--font-body); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3); }
.tm-toast.bad, .inv-toast.bad { background: var(--blocked); color: var(--panel); }
.tm-toast[hidden], .inv-toast[hidden] { display: none; }
.tm-edit { display: flex; flex-direction: column; gap: 12px; }
.tm-edit-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 12px; }
.tm-edit-step fieldset { margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tm-edit-step legend { font: 700 11px/1 var(--font-mono); color: var(--mute); padding: 0 6px; }
.tm-field { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--mute); }
.tm-field input, .tm-field textarea, .tm-field select { font: 600 14px/1.3 var(--font-body); padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); min-height: 40px; box-sizing: border-box; width: 100%; }
.tm-field input:focus-visible, .tm-field textarea:focus-visible, .tm-field select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.tm-edit-act, .tm-edit-foot { display: flex; flex-wrap: wrap; gap: 8px; }
.tm-edit-act .btn, .tm-edit-foot .btn { min-height: 44px; }
.tm-problems { margin: 0; padding-left: 20px; }
.tm-dialog { max-width: 880px; }
.tm-member-edit { display: flex; align-items: center; gap: 8px; }
.tm-member-edit .tm-person { flex: 1; min-width: 0; }
.tm-profile { min-height: 44px; flex: none; }

/* REQ-172.2 (Pablo): teams per product. The Segmented filter scrolls inside
   itself at 375 px (.seg has overflow-x: auto), never the page; sections
   stack; 'Shared' is a chip, not a different card style. */
.tm-pfilter { display: flex; margin: 0 0 12px; max-width: 100%; min-width: 0; }
.tm-pfilter .seg button { min-height: 44px; white-space: nowrap; }
.tm-admin { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 12px; }
.tm-admin .btn { min-height: 44px; }
.tm-psec { margin: 0 0 18px; min-width: 0; }
.tm-ptitle { margin: 0 0 10px; font: 800 19px/1.2 var(--font-display); }
.chip.tm-shared { margin-left: 6px; color: var(--ink); font-weight: 700; box-shadow: inset 0 0 0 1px var(--line); }
.tm-sheet { width: min(640px, calc(100vw - 32px)); }
.tm-field { display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; color: var(--mute); }
.tm-field .role-select { min-height: 44px; }
.tm-table-wrap { max-width: 100%; overflow-x: auto; }
.tm-mig { width: 100%; border-collapse: collapse; font-size: 14px; }
.tm-mig th, .tm-mig td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tm-mig thead th { font: 700 10.5px/1 var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.tm-mig .role-select { min-height: 44px; min-width: 150px; }
