/* Team & access */
.tm-tools { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.tm-tools .select { width: 180px; }
.tm-search { position: relative; flex: 1; min-width: 220px; }
.tm-search svg { position: absolute; left: 12px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--mute); pointer-events: none; }
.tm-search .input { padding-left: 36px; }

.tm-list { overflow: hidden; }
.tm-row { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.4fr) minmax(0, 1.3fr) 110px; gap: 16px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.tm-row:last-child { border-bottom: 0; }
.tm-headrow { padding: 11px 18px; font: 600 11px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--mute); background: var(--panel-2); }
.tm-person { cursor: pointer; transition: background .12s; }
.tm-person:hover, .tm-person:focus-visible { background: var(--panel-2); outline: none; }
.tm-person:focus-visible { box-shadow: inset 0 0 0 2px var(--acc); }
.tm-who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tm-who-t { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.tm-who-t b { font-weight: 600; display: flex; align-items: center; gap: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm-who-t > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm-title { color: var(--ink-2); }
.tm-you { background: var(--acc-soft); color: var(--acc-2); font-size: 10.5px; padding: 1px 7px; }
.tm-role { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tm-scope { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.tm-scope .chip { background: transparent; border: 1px dashed var(--line-2); font-weight: 500; }
.tm-status .chip { white-space: normal; }

/* chip picker */
.tm-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.tm-pick { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--panel); font-weight: 600; font-size: 12.5px; color: var(--ink-2); transition: background .15s, border-color .15s, color .15s; }
.tm-pick svg { width: 13px; height: 13px; }
.tm-pick:hover { border-color: var(--ink-2); }
.tm-pick[aria-pressed="true"] { background: var(--acc-soft); border-color: var(--acc-line); color: var(--acc-2); }
:root[data-theme="dark"] .tm-pick[aria-pressed="true"] { color: var(--acc); }
.tm-pick:disabled { opacity: .55; pointer-events: none; }

/* drawer */
.tm-dhead { display: flex; gap: 14px; align-items: center; }
.tm-dname { font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.tm-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r); }
.tm-ovr-head { margin-top: 8px; padding-top: 18px; border-top: 1px solid var(--line); }
.tm-ovr-head h3 { margin: 0 0 4px; font: 600 15px/1.2 var(--sans); }
.tm-ovr-head p { margin: 0; }
.tm-matrix { display: flex; flex-direction: column; gap: 14px; }
.tm-mg-title { font: 600 10.5px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--mute); padding: 4px 0 8px; }
.tm-mgroup { border: 1px solid var(--line); border-radius: var(--r); padding: 4px 14px 6px; background: var(--panel); }
.tm-mgroup .tm-mg-title { padding-top: 12px; }
.tm-mrow { display: grid; grid-template-columns: minmax(0, 1fr) auto 64px; gap: 12px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); }
.tm-mg-title + .tm-mrow { border-top: 0; }
.tm-mlabel { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; font-size: 13.5px; }
.tm-tri { display: inline-flex; padding: 2px; background: var(--panel-3); border-radius: 99px; gap: 1px; }
.tm-tri button { border: 0; background: transparent; padding: 4px 10px; border-radius: 99px; font: 600 12px/1.2 var(--sans); color: var(--mute); }
.tm-tri button[aria-pressed="true"] { background: var(--panel); color: var(--ink); box-shadow: var(--shadow-1); }
.tm-tri button.allow[aria-pressed="true"] { background: var(--ok-soft); color: var(--ok); box-shadow: none; }
.tm-tri button.deny[aria-pressed="true"] { background: var(--danger-soft); color: var(--danger); box-shadow: none; }
.tm-tri button:disabled { opacity: .5; pointer-events: none; }
.tm-eff { display: inline-flex; align-items: center; gap: 4px; justify-content: flex-end; font: 600 12px/1 var(--sans); }
.tm-eff svg { width: 14px; height: 14px; }
.tm-eff.yes { color: var(--ok); }
.tm-eff.no { color: var(--mute); }
.tm-ro .tm-actions { display: none; }

/* roles */
.tm-roles { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; margin-bottom: 26px; }
.tm-rcard { padding: 18px; display: flex; flex-direction: column; gap: 8px; cursor: pointer; transition: border-color .15s, transform .2s var(--ease), box-shadow .2s; }
.tm-rcard:hover, .tm-rcard:focus-visible { border-color: var(--acc-line); box-shadow: var(--shadow-2); outline: none; transform: translateY(-1px); }
.tm-rc-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tm-rc-top b { font: 500 20px/1.2 var(--display); }
.tm-rcard p { margin: 0; flex: 1; font-size: 13.5px; }
.tm-rc-foot { display: flex; justify-content: space-between; padding-top: 10px; border-top: 1px solid var(--line); }
.tm-rnew { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 6px; padding: 18px; border: 1.5px dashed var(--line-2); border-radius: var(--r-lg); background: transparent; color: var(--ink-2); text-align: left; min-height: 130px; transition: border-color .15s, background .15s, color .15s; }
.tm-rnew svg { width: 20px; height: 20px; color: var(--acc); }
.tm-rnew:hover { border-color: var(--acc); background: var(--acc-soft); color: var(--ink); }
.tm-rperms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tm-rgroup { border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.tm-rg-head { padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.tm-rg-head .mute { margin-left: auto; }
.tm-rp { align-items: flex-start; font-size: 13.5px; line-height: 1.4; }
.tm-rp input { margin-top: 2px; }
.tm-rperms .banner { grid-column: 1 / -1; }

/* matrix preview */
.tm-mx-card { overflow: hidden; }
.tm-mx-scroll { overflow: auto; max-height: 70vh; margin-top: 12px; border-top: 1px solid var(--line); }
.tm-mx { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 640px; font-size: 13px; }
.tm-mx th, .tm-mx td { padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--panel); }
.tm-mx thead th { position: sticky; top: 0; z-index: 3; font: 600 11px/1.2 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--mute); text-align: left; }
.tm-mx th.c, .tm-mx td.c { text-align: center; }
.tm-mx th:first-child, .tm-mx th.pl { position: sticky; left: 0; z-index: 2; text-align: left; min-width: 220px; font-weight: 500; box-shadow: 1px 0 0 var(--line); }
.tm-mx thead th:first-child { z-index: 4; }
.tm-mx tr.g th { background: var(--panel-2); font: 600 10.5px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--mute); }
.tm-mx tbody tr:not(.g):hover th, .tm-mx tbody tr:not(.g):hover td { background: var(--panel-2); }
.tm-tick { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); }
.tm-tick svg { width: 12px; height: 12px; stroke-width: 2.6; }
.tm-dash { color: var(--line-2); }

@media (max-width: 760px) {
  .tm-headrow { display: none; }
  .tm-row { grid-template-columns: 1fr auto; gap: 8px 12px; }
  .tm-who { grid-column: 1 / -1; }
  .tm-role { grid-column: 1; }
  .tm-status { grid-column: 1; }
  .tm-seen { grid-column: 2; grid-row: 2; align-self: start; }
  .tm-rperms { grid-template-columns: 1fr; }
  .tm-mrow { grid-template-columns: 1fr auto; }
  .tm-eff { grid-column: 2; grid-row: 1; }
  .tm-tri { grid-column: 1 / -1; justify-self: start; }
  .tm-tools .select { width: 100%; }
}
.tm-actions .btn:disabled, .tm-dhead + .tm-actions .btn:disabled { pointer-events: auto; cursor: not-allowed; }
