/* Team admin panel (Team v1 S1.9) — user/group/grant management. */
.team-toolbar { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.team-content { padding: 14px 16px; }
/* detail + invite are forms — cap their width for readability on wide panels (the
   user LIST keeps the full width). */
.team-content-form { max-width: 680px; }

.team-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.team-table th { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); color: var(--text-dim); font-weight: 600; font-size: 12px; }
.team-table td { padding: 8px 6px; border-bottom: 1px solid var(--border); }
.team-tier-sel { min-width: 96px; }
.team-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

.team-card { border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin-bottom: 10px; }
.team-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.team-group-meta { color: var(--text-dim); font-size: 12px; }

.team-grant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.team-grant-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.team-grant-label { font-size: 13px; }

.team-grp-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; cursor: pointer; }

/* Account / sign-out block in the Settings panel (Team v1). */
.settings-account { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; margin-bottom: 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.settings-account-info { font-size: 13px; color: var(--text-dim); line-height: 1.4; }
.settings-account-info strong { color: var(--text); }
.settings-logout-btn { flex-shrink: 0; padding: 7px 14px; border: 1px solid var(--border); border-radius: 6px; background: transparent; color: var(--text); font-size: 13px; cursor: pointer; }
.settings-logout-btn:hover { background: var(--danger, #ef4444); color: #fff; border-color: transparent; }

/* Group permission matrix (modules × groups; segmented none/read/write cells). */
.team-matrix-wrap { overflow-x: auto; margin-top: 4px; }
.team-matrix { border-collapse: collapse; min-width: 100%; }
.team-matrix th, .team-matrix td { padding: 9px 14px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; vertical-align: middle; }
.team-matrix thead th { border-bottom: 2px solid var(--border); }
.team-mod { position: sticky; left: 0; background: var(--surface); z-index: 1; font-size: 13px; color: var(--text); }
.team-matrix-corner { color: var(--text-dim); font-size: 12px; font-weight: 600; }
.team-grp-th-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.team-grp-name { font-weight: 600; font-size: 14px; color: var(--text); }
.team-grp-mem { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.team-grp-del { border: none; background: transparent; color: var(--text-dim); cursor: pointer; font-size: 13px; line-height: 1; padding: 3px 5px; border-radius: 4px; }
.team-grp-del:hover { color: #fff; background: var(--danger, #ef4444); }
.team-seg { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.team-seg-btn { border: none; background: transparent; color: var(--text-dim); cursor: pointer; font-size: 12px; padding: 5px 13px; border-right: 1px solid var(--border); }
.team-seg-btn:last-child { border-right: none; }
.team-seg-btn:hover:not(.active) { background: var(--border); }
.team-seg-btn.active { background: var(--accent); color: #fff; }

/* WS1: per-user "Direct app access" section in the user modal */
.team-access-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-dim); margin-bottom: 6px; }
.team-access-hint { font-size: 11px; color: var(--text-dim); margin-bottom: 8px; }
.team-grant-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 0; }
.team-grant-app { font-size: 13px; color: var(--text); text-transform: capitalize; }

/* ── Users: responsive cards (identity | tier+position | status | groups) ──── */
.team-user-list { container-type: inline-size; display: flex; flex-direction: column; gap: 8px; }
.team-user-card {
  display: grid; align-items: center; gap: 4px 12px; cursor: pointer;
  grid-template-columns: 1fr auto;
  grid-template-areas: "id chev" "tags chev" "status chev" "groups chev";
  border: 1px solid var(--border); border-radius: 10px; padding: 11px 14px;
  background: var(--surface); transition: border-color .12s, background .12s;
}
.team-user-card:hover, .team-user-card:focus-visible { border-color: var(--accent); background: var(--bg); outline: none; }
.team-user-card.is-disabled { opacity: .55; }
.team-uc-id { grid-area: id; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.team-uc-name { font-weight: 600; font-size: 14px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team-uc-email { font-size: 12px; color: var(--text-dim); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.team-uc-email:hover { color: var(--accent); text-decoration: underline; }
.team-uc-tags { grid-area: tags; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.team-uc-pos { font-size: 12px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team-uc-status { grid-area: status; }
.team-uc-groups { grid-area: groups; display: flex; flex-wrap: wrap; gap: 5px; }
.team-uc-chev { grid-area: chev; align-self: center; color: var(--text-dim); font-size: 20px; line-height: 1; }
/* wide panel → spread across four columns instead of stacking */
@container (min-width: 560px) {
  .team-user-card {
    grid-template-columns: minmax(0, 2.4fr) minmax(0, 1.7fr) auto minmax(0, 1.5fr) auto;
    grid-template-areas: "id tags status groups chev"; gap: 10px 14px;
  }
}

/* consistent tier pill — same shape for admin/manager/member, colour-coded only */
.team-tier { display: inline-flex; align-items: center; font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 999px; text-transform: capitalize; line-height: 1.5; white-space: nowrap; }
.team-tier-admin { background: rgba(59,130,246,.16); color: #60a5fa; }
.team-tier-manager { background: rgba(168,85,247,.16); color: #c084fc; }
.team-tier-member { background: var(--border); color: var(--text-dim); }
/* status pill */
.team-status { display: inline-flex; align-items: center; font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.team-status-on { background: rgba(34,197,94,.16); color: #4ade80; }
.team-status-inv { background: rgba(245,158,11,.16); color: #fbbf24; }
.team-status-off { background: rgba(239,68,68,.16); color: #f87171; }
/* group chips */
.team-chip { display: inline-flex; align-items: center; font-size: 11px; padding: 1px 8px; border-radius: 999px; white-space: nowrap; }
.team-chip-group { background: transparent; border: 1px solid var(--accent); color: var(--accent); }

/* in-panel detail — editable name + email */
.team-detail-idbox { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 6px; }
.team-detail-name-input, .team-detail-email-input { width: 100%; background: transparent; border: 1px solid transparent; border-radius: 7px; color: var(--text); padding: 6px 8px; margin-left: -8px; }
.team-detail-name-input { font-size: 18px; font-weight: 700; }
.team-detail-email-input { font-size: 13px; color: var(--text-dim); }
.team-detail-name-input:hover, .team-detail-email-input:hover { border-color: var(--border); }
.team-detail-name-input:focus, .team-detail-email-input:focus { border-color: var(--accent); background: var(--surface); outline: none; }

/* delete = two options (deactivate / permanently delete) */
.team-del-opt { border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin-bottom: 10px; }
.team-del-opt.team-del-danger { border-color: var(--danger, #ef4444); }
.team-del-opt-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; color: var(--text); }
.team-del-opt-desc { font-size: 12px; color: var(--text-dim); line-height: 1.4; margin-bottom: 8px; }

/* inline "create a new group" (in detail + invite) */
.team-inline-newgrp { margin-top: 8px; }
.team-inline-newgrp-form { border: 1px dashed var(--border); border-radius: 8px; padding: 10px; margin-top: 6px; }
.team-invite-groups { display: flex; flex-direction: column; gap: 2px; }
