/* team screens: members, invitations — in the system of design/canvas/Console-Keys and Console-Account (design/STYLE.md).
   Shared components are in /app.css. */
.tm { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.tm h2 { margin: 0; }
.tm .hint, .tm p { margin: 0; }

/* role pills */
.tm-role { text-transform: capitalize; background: var(--raised); }
.tm-role.owner { color: var(--accent-text); border-color: var(--warn-line); }
.tm-role.admin { color: var(--text); }
.tm-you { display: inline-flex; align-items: center; font-size: 12px; color: var(--muted); border: 1px solid var(--line-2); border-radius: 999px; padding: 1px 8px; line-height: 1.5; }

/* list cards (table inside a flush card, header row padded like the artboards) */
.card.tm-list { padding: 20px 0 4px; display: flex; flex-direction: column; gap: 8px; }
.tm-list-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; padding: 0 24px; }
.tm-table { min-width: 640px; }
.tm-list .table-wrap { position: relative; } /* keeps sr-only headers inside the scroller */
.tm-table caption { caption-side: bottom; text-align: left; padding: 14px 24px 12px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); }
.tm-table th:first-child, .tm-table td:first-child { padding-left: 24px; }
.tm-table th:last-child, .tm-table td:last-child { padding-right: 24px; }
.tm-table td { height: 56px; }
.tm-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tm-avatar { flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--raised); border: 1px solid var(--line-3); display: inline-flex; align-items: center; justify-content: center; font: 600 14px var(--display); color: var(--accent-text); }
.tm-email { font-weight: 500; overflow-wrap: anywhere; }
.tm-date { color: var(--body); white-space: nowrap; }
.tm-acts { text-align: right; white-space: nowrap; }
.tm-acts > * + * { margin-left: 6px; }
.tm-acts .copy { vertical-align: middle; }
.tm-role-sel { min-height: 34px; padding-left: 10px; font-size: 13px; }
.tm-empty { margin: 4px 24px 16px; border: 1px dashed var(--line-2); border-radius: 10px; padding: 20px 24px; text-align: center; }

/* invite form */
.tm-invite { display: flex; flex-direction: column; gap: 14px; }
.tm-inv-form { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px; }
.tm-inv-form label { min-width: 0; }
.tm-f-email { flex: 1.6 1 260px; }
.tm-f-role { flex: 1 1 160px; }
.tm-inv-form input, .tm-inv-form select { width: 100%; }
.tm-inv-form input[aria-invalid="true"] { border-color: var(--bad-line); }
.tm-f-btn { flex: 0 0 auto; display: flex; flex-direction: column; gap: 6px; }
.tm-spacer { font-size: 13px; line-height: 1.5; visibility: hidden; }
.tm-help { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; color: var(--body); background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 14px; }
.tm-invite .err-msg { margin-top: -6px; }

/* just invited */
.tm-done { border-color: var(--warn-line); display: flex; flex-direction: column; gap: 16px; }
.tm-done-top { display: flex; align-items: flex-start; gap: 12px; }
.tm-done-top > svg { flex: none; color: var(--accent-text); margin-top: 2px; }
.tm-done-top > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tm-done-top h2 { overflow-wrap: anywhere; }
.tm-link { display: flex; gap: 10px; align-items: center; }
.tm-link input { flex: 1 1 auto; min-width: 0; background: var(--well); font: 13px var(--mono); }
.tm-link .copy { min-height: 40px; width: 40px; }
.tm-done-foot { display: flex; justify-content: flex-end; border-top: 1px solid var(--line); padding-top: 12px; }

/* roles */
.tm-roles { display: flex; flex-direction: column; gap: 16px; }
.tm-role-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.tm-role-grid li { display: flex; flex-wrap: wrap; align-items: center; align-content: flex-start; gap: 8px; background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px; padding: 14px 16px; }
.tm-role-grid li.mine { border-color: var(--line-3); }
.tm-role-grid li p { flex-basis: 100%; color: var(--body); font-size: 13px; }

/* workspace settings */
.tm-settings { display: flex; flex-direction: column; gap: 16px; }
.tm-row-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.tm-row-form label { flex: 1 1 260px; }
.tm-row-form input { width: 100%; }
.tm-zone { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; border-top: 1px solid var(--line); padding-top: 16px; }
.tm-zone > div { flex: 1 1 320px; min-width: 0; }
.tm-zone h3 { margin: 0 0 2px; overflow-wrap: anywhere; }
.tm-zone.danger h3 { color: var(--bad); }

/* invitations page */
.tm-cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.tm-ivc { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px; }
.tm-ivc-main { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.tm-ivc-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.tm-ivc-title h2 { font-size: 18px; overflow-wrap: anywhere; }
.tm-ivc-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.tm-none { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 40px 24px; }
.tm-none > svg { color: var(--muted); }
.tm-none-t { font-weight: 600; }
.tm-none .body { max-width: 440px; margin-bottom: 8px; }

/* touch targets on phones and tablets */
@media (max-width: 860px) {
  .tm input, .tm select, .tm button, .tm .btn { min-height: 44px; }
  .tm .copy { min-width: 44px; }
}

/* phones: member and invitation tables become stacked rows */
@media (max-width: 640px) {
  .tm-table { min-width: 0; }
  .tm-table thead { display: none; }
  .tm-table { display: flex; flex-direction: column; }
  .tm-table tbody, .tm-table tr, .tm-table td { display: block; }
  .tm-table tr { padding: 12px 16px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; }
  .tm-table tbody tr:last-child { border-bottom: 0; }
  .tm-table td, .tm-table td:first-child, .tm-table td:last-child { padding: 0; height: auto; border: 0; }
  .tm-table td:first-child { grid-column: 1 / -1; }
  .tm-table td[data-k="Joined"]::before, .tm-table td[data-k="Expires"]::before, .tm-table td[data-k="Invited by"]::before { content: attr(data-k) " "; color: var(--muted); }
  .tm-table td[data-k="Invited by"] { grid-column: 1 / -1; white-space: normal; overflow-wrap: anywhere; }
  .tm-table td.tm-acts { grid-column: 1 / -1; text-align: left; white-space: normal; }
  .tm-table td.tm-acts:empty { display: none; }
  .tm-acts button { min-height: 44px; }
  .tm-acts .copy { width: 44px; }
  .tm-table caption { display: block; order: 1; padding: 12px 16px; }
  .tm-list-head { padding: 0 16px; }
  .tm-role-sel { min-height: 44px; }
  .tm-f-btn, .tm-f-btn button { width: 100%; }
  .tm-f-btn .tm-spacer { display: none; }
  .tm-ivc-acts { width: 100%; }
  .tm-ivc-acts button { flex: 1 1 0; min-height: 44px; }
}

/* workspace countries */
.tm-countries { display: flex; flex-direction: column; gap: 12px; padding-top: 20px; margin-top: 20px; border-top: 1px solid var(--line); }
.tm-countries h3 { margin: 0; }
.tm-countries .hint { margin: 0; }
.tm-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tm-chip { display: inline-flex; align-items: center; gap: 4px; padding: 0 4px 0 12px; min-height: 36px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--raised); font-size: 13px; }
.tm-chip button.icon.sm { width: 28px; min-height: 28px; border-radius: 999px; font-size: 16px; color: var(--muted); }
.tm-chip button.icon.sm:hover { color: var(--text); }
.tm-settings h2 + .tm-countries { border-top: 0; padding-top: 0; margin-top: 0; }
