/* Teams (public/modules/teams.js) */
.menu-teams { gap: 10px; }
.tm-head { align-items: flex-end; gap: 16px; }
.tm-sub { margin: 6px 0 0; color: var(--ink-muted); font-size: 14.5px; max-width: 520px; }
#tm-invites, #tm-list { display: flex; flex-direction: column; gap: 14px; }
#tm-invites:empty { display: none; }

/* invite to you */
.tm-invite { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-color: color-mix(in srgb, var(--cta-a, #E8652B) 40%, var(--line)); background: color-mix(in srgb, var(--cta-a, #E8652B) 6%, var(--card)); }
.tm-invite > svg { flex-shrink: 0; width: 22px; height: 22px; color: var(--cta-a, #E8652B); }
.tm-inv-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tm-inv-t span { font-size: 13.5px; color: var(--ink-muted); }
.tm-inv-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* empty state */
.tm-empty { padding: 30px 28px; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.tm-empty-ic { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: color-mix(in srgb, var(--cta-a, #E8652B) 14%, transparent); color: var(--cta-a, #E8652B); }
.tm-empty-ic svg { width: 24px; height: 24px; }
.tm-empty h2 { margin: 4px 0 0; font-size: 20px; letter-spacing: -.01em; }
.tm-empty ul { margin: 0 0 6px; padding-left: 18px; color: var(--ink-muted); font-size: 14.5px; line-height: 1.55; display: flex; flex-direction: column; gap: 6px; }

/* a team */
.tm-team { padding: 0; overflow: hidden; }
.tm-team-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 20px 22px 16px; }
.tm-team-t h2 { margin: 0; font-size: 19px; letter-spacing: -.01em; }
.tm-meta { font-size: 13px; color: var(--ink-faint); }
.tm-team-actions { display: flex; gap: 8px; }
.tm-settings { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.tm-set { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 22px; border-bottom: 1px solid var(--line); }
.tm-set-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tm-set-t b { font-size: 14px; }
.tm-set-t span { font-size: 13px; color: var(--ink-faint); }
.tm-chip { flex-shrink: 0; padding: 3px 10px; border-radius: 999px; background: var(--chip-bg); color: var(--ink-muted); font-size: 12.5px; font-weight: 600; }
.tm-switch { position: relative; flex-shrink: 0; width: 40px; height: 23px; cursor: pointer; }
.tm-switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.tm-switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--field-line); transition: background .18s; pointer-events: none; }
.tm-switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .18s; }
.tm-switch input:checked + i { background: var(--select); }
.tm-switch input:checked + i::after { transform: translateX(17px); }
.tm-switch input:focus-visible + i { outline: 2px solid var(--select); outline-offset: 2px; }

.tm-block { padding: 16px 22px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.tm-block h3, .tm-dlg-block h3 { margin: 0 0 4px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); }
.tm-req { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-radius: 14px; background: color-mix(in srgb, #E8A21A 10%, var(--card)); border: 1px solid color-mix(in srgb, #E8A21A 35%, var(--line)); }
.tm-req.flash { animation: tm-flash 1.6s ease 2; }
@keyframes tm-flash { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, #E8A21A 40%, transparent); } }
.tm-req-t { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 2px; }
.tm-req-t span { font-size: 13px; color: var(--ink-muted); }
.tm-req-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.tm-person { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 0; }
.tm-person + .tm-person { border-top: 1px solid var(--line); }
.tm-person.pending .tm-person-t b { color: var(--ink-muted); font-weight: 600; }
.tm-av { flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; color: #fff; background: linear-gradient(135deg, #8B86FF, #5148E0); }
.tm-person.pending .tm-av { background: var(--chip-bg); color: var(--ink-faint); }
.tm-av.sm { width: 28px; height: 28px; font-size: 12px; }
.tm-person-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tm-person-t b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm-person-t span { font-size: 12.5px; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm-limit { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-muted); flex-shrink: 0; }
.tm-limit-u { color: var(--ink-faint); }
.tm-cap { width: 84px; height: 32px; padding: 0 8px; font-size: 13px; }
.tm-role { width: auto; height: 34px; padding: 0 30px 0 10px; font-size: 13px; flex-shrink: 0; }
.tm-rm { flex-shrink: 0; color: var(--ink-faint); }
.tm-rm:hover { color: var(--danger); }
.tm-invite-form { display: flex; gap: 8px; margin-top: 8px; }
.tm-invite-form .input[type="email"] { flex: 1; min-width: 0; }
.tm-foot { display: flex; justify-content: flex-end; padding: 12px 22px; }
.danger-text { color: var(--danger) !important; }

/* dialogs */
.pm-dlg.tm-dlg { max-width: 520px; }
.tm-dlg-block { display: flex; flex-direction: column; gap: 6px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.tm-dlg-block:last-of-type { border-bottom: 0; }
.tm-note { margin: 0; font-size: 13.5px; color: var(--ink-muted); line-height: 1.5; }
.tm-empty-line { margin: 0; font-size: 13.5px; color: var(--ink-faint); }
.tm-act { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow: auto; display: flex; flex-direction: column; }
.tm-act li { display: flex; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.tm-act li:last-child { border-bottom: 0; }
.tm-act li p { margin: 0; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.tm-act li span:not(.tm-av) { font-size: 12px; color: var(--ink-faint); }

/* viewers */
.tm-viewer-note { margin: 10px 12px 12px; padding: 12px 14px; border-radius: 14px; background: var(--chip-bg); color: var(--ink-muted); font-size: 13.5px; line-height: 1.45; text-align: center; }
.tm-viewer-note[hidden] { display: none; }

@media (max-width: 600px) {
  .tm-head { flex-direction: column; align-items: flex-start; }
  .tm-set { flex-direction: column; align-items: flex-start; }
  .tm-invite { flex-wrap: wrap; }
  .tm-inv-actions { width: 100%; justify-content: flex-end; }
  .tm-person { flex-wrap: wrap; }
  .tm-limit { order: 5; width: 100%; padding-left: 46px; }
  .tm-invite-form { flex-wrap: wrap; }
  .tm-invite-form .input[type="email"] { flex-basis: 100%; }
  .tm-team-head, .tm-block, .tm-set, .tm-foot { padding-left: 16px; padding-right: 16px; }
}
#tm-new { white-space: nowrap; flex-shrink: 0; }

/* Who pays: a sliding switch between two choices */
.tm-seg { position: relative; display: inline-grid; grid-template-columns: 1fr 1fr; flex-shrink: 0; padding: 3px; border-radius: 999px; background: var(--chip-bg); border: 1px solid var(--line); }
.tm-seg-thumb { position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); border-radius: 999px; background: var(--card); box-shadow: 0 1px 3px rgba(0, 0, 0, .14); transition: transform .26s cubic-bezier(.3, .7, .2, 1); }
.tm-seg.right .tm-seg-thumb { transform: translateX(100%); }
.tm-seg button { position: relative; z-index: 1; border: 0; background: none; font: inherit; font-size: 13px; font-weight: 600; color: var(--ink-muted); padding: 7px 14px; border-radius: 999px; cursor: pointer; white-space: nowrap; transition: color .2s; }
.tm-seg button[aria-checked="true"] { color: var(--ink); }
.tm-seg button:focus-visible { outline: 2px solid var(--select); outline-offset: 1px; }

/* Warning: members can use your whole balance */
.tm-warn { display: flex; align-items: flex-start; gap: 10px; margin: 0 22px 14px; padding: 11px 14px; border-radius: 12px; font-size: 13.5px; line-height: 1.45;
  background: color-mix(in srgb, #E8A21A 14%, var(--card)); border: 1px solid color-mix(in srgb, #E8A21A 45%, var(--line)); color: var(--ink-body, var(--ink)); }
.tm-warn svg { flex-shrink: 0; margin-top: 1px; color: #C77700; }
.tm-settings .tm-set:has(+ .tm-warn) { border-bottom: 0; }
.tm-settings .tm-warn + .tm-set { border-top: 1px solid var(--line); }
.tm-switch i, .tm-switch i::after { transition-duration: .22s; transition-timing-function: cubic-bezier(.3, .7, .2, 1); }

/* Role picker */
.tm-pick { flex-shrink: 0; }
.tm-pick-btn { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 10px 0 11px; border-radius: 10px; border: 1px solid var(--field-line); background: var(--field); color: var(--ink); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: border-color .15s, background .15s; }
.tm-pick-btn:hover { background: var(--hover); }
.tm-pick-btn[aria-expanded="true"] { border-color: var(--select); box-shadow: 0 0 0 3px color-mix(in srgb, var(--select) 18%, transparent); }
.tm-pick-btn > svg:first-child { color: var(--ink-muted); }
.tm-pick-chev { color: var(--ink-faint); margin-left: 2px; transition: transform .2s; }
.tm-pick-btn[aria-expanded="true"] .tm-pick-chev { transform: rotate(180deg); }
.tm-pick-list { position: fixed; z-index: 200; padding: 6px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-window);
  display: flex; flex-direction: column; gap: 2px; opacity: 0; transform: translateY(-4px) scale(.98); transform-origin: top right; transition: opacity .14s, transform .16s cubic-bezier(.3, .7, .2, 1); }
.tm-pick-list.in { opacity: 1; transform: none; }
.tm-pick-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 10px; background: none; color: var(--ink); text-align: left; font: inherit; cursor: pointer; }
.tm-pick-item:hover, .tm-pick-item:focus-visible { background: var(--hover); outline: none; }
.tm-pick-ic { flex-shrink: 0; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--chip-bg); color: var(--ink-muted); }
.tm-pick-item[aria-selected="true"] .tm-pick-ic { background: color-mix(in srgb, var(--select) 16%, transparent); color: var(--accent-text); }
.tm-pick-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.tm-pick-t b { font-size: 13.5px; }
.tm-pick-t small { font-size: 12px; color: var(--ink-faint); line-height: 1.35; }
.tm-pick-check { flex-shrink: 0; color: var(--accent-text); opacity: 0; }
.tm-pick-item[aria-selected="true"] .tm-pick-check { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .tm-seg-thumb, .tm-pick-list, .tm-switch i, .tm-switch i::after { transition: none; } }
@media (max-width: 600px) { .tm-warn { margin: 0 16px 14px; } .tm-seg { width: 100%; } }

.tm-viewer-note { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.tm-ask:disabled { opacity: .7; }
.tm-areq .tm-block { border-bottom: 0; }
