/* EVO TrustGuard — page-team-members.css
 *
 * Owned by:    team-members.html
 * Category:    portal feature page
 * Cascade:     tokens → base → utilities → components → portal-chrome → shared → shared-themes → page
 * Edit policy: rules unique to this page only. Anything used by 5+
 *              pages should be promoted to /css/components.css or
 *              /css/portal-chrome.css with a /css/AGENTS.md update.
 *
 * Extracted:   1 <style> block(s), 59 lines.
 * Method:      verbatim move — no token substitution applied yet.
 *              See C56 audit Section 10.A for the deferred token
 *              normalization sprint plan.
 */

  body { font-family: var(--font-sans); background: var(--bg); color: var(--dark); line-height: var(--leading-relaxed); min-height: 100vh; display: flex; flex-direction: column; padding-bottom: var(--space-6); }

  .top-bar { background: var(--white); border-bottom: 0.5px solid var(--border); padding: calc(12px + env(safe-area-inset-top)) 16px 12px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: var(--z-nav); }
  .top-bar-back { background: none; border: none; padding: var(--space-1-5); cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--dark); min-width: 36px; min-height: 36px; }
  .top-bar-back svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 2; fill: none; }
  .top-bar-title { font-family: var(--font-sans); font-size: var(--text-input); font-weight: var(--weight-semibold); color: var(--dark); }
  .top-bar-action { background: none; border: none; font-family: var(--font-sans); font-size: var(--text-base); color: var(--red); font-weight: var(--weight-bold); cursor: pointer; padding: var(--space-1-5) var(--space-1); }

  .page { max-width: 640px; margin: 0 auto; width: 100%; padding: var(--space-4) var(--space-4) var(--space-10); display: flex; flex-direction: column; gap: var(--space-3-5); }

  .card { background: var(--white); border-radius: var(--radius-lg); padding: 0; box-shadow: 0 1px 4px rgba(0,0,0,0.05); overflow: hidden; }
  .card-head { display: flex; align-items: center; justify-content: space-between; padding: var(--space-4) var(--space-4-5) 0; }
  .card-head h2 { font-family: var(--font-sans); font-size: var(--text-md); font-weight: var(--weight-bold); text-transform: uppercase; letter-spacing: var(--tracking-wider); color: var(--light); }
  .card-body { padding: var(--space-2) var(--space-4-5) var(--space-3); }

  .member-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) 0; border-bottom: 1px solid var(--border); }
  .member-row:last-child { border-bottom: none; }
  .avatar { width: 36px; height: 36px; border-radius: 10px; background: var(--border); color: var(--mid); display: flex; align-items: center; justify-content: center; font-size: var(--text-md); font-weight: var(--weight-bold); flex-shrink: 0; }
  .avatar.pending { background: #fef3c7; color: #92400e; font-size: var(--text-input); }
  .avatar.dashed  { background: var(--white); color: var(--mid); border: 1.5px dashed var(--border); font-size: var(--text-2xl); font-weight: var(--weight-regular); }
  .member-info { flex: 1; min-width: 0; }
  .member-name { font-size: var(--text-base); font-weight: var(--weight-semibold); color: var(--dark); line-height: var(--leading-snug); }
  .member-email { font-size: var(--text-sm); color: var(--light); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .role-pill { display: inline-flex; align-items: center; font-size: var(--text-xxs); font-weight: var(--weight-bold); padding: var(--space-1) var(--space-2-5); border-radius: var(--radius-lg); text-transform: uppercase; letter-spacing: var(--tracking-wide); flex-shrink: 0; }
  .role-pill.owner   { background: var(--dark); color: var(--white); }
  .role-pill.manager { background: #1e3a8a; color: var(--white); }
  .role-pill.rep     { background: var(--surface-light); color: var(--mid); }
  .member-action { background: none; border: none; color: var(--red); font-size: var(--text-sm); font-weight: var(--weight-bold); cursor: pointer; font-family: var(--font-sans); padding: var(--space-1-5) 0 var(--space-1-5) var(--space-3); text-transform: uppercase; letter-spacing: var(--tracking-wide); }
  .member-action:hover { text-decoration: underline; }
  .member-self-tag { font-size: var(--text-xs); color: var(--light); font-weight: var(--weight-medium); }

  /* PER-REP CONFIGURATION BLOCK (Sprint 3A.2.6a / LOCKED C76-A)
     Owner-only render path on /team-members.html. Sits below the
     member-row header, separated by a single solid border that
     replaces the member-row's own border-bottom (collapsed via the
     `:has()` selector below when supported; otherwise the page falls
     through to two stacked borders which is visually busier but
     functional). */
  /* ACCORDION (C107) — owner view wraps each member (header + config) in a
     .member-acc shell that collapses to the header and taps open to reveal
     the config (mirrors .svc-card / .ctr-card on client-detail). The shell
     owns the member-to-member separator; the header drops its own border so
     a collapsed list reads as one clean row per member. */
  .member-acc { border-bottom: 1px solid var(--border); }
  .member-acc:last-child { border-bottom: none; }
  .member-acc .member-row { border-bottom: none; cursor: pointer; }

  .member-chevron { width: 16px; height: 16px; stroke: var(--mid); stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; transition: transform 0.2s; }
  .member-acc.expanded .member-chevron { transform: rotate(180deg); }

  /* Animated drawer — max-height clip + border-top fade, same 300ms recipe
     as .svc-details. Padding + flex layout live on .member-config-inner so
     the outer overflow:hidden doesn't eat padding mid-animation. */
  .member-config { max-height: 0; overflow: hidden; border-top: 1px solid transparent; transition: max-height 300ms ease-in-out, border-top-color 300ms ease-in-out; }
  .member-acc.expanded .member-config { max-height: 2000px; border-top-color: var(--border); }
  .member-config-inner { padding: var(--space-3) 0 var(--space-3-5); display: flex; flex-direction: column; gap: var(--space-3); }
  .member-config-row { display: flex; flex-direction: column; gap: var(--space-1-5); }
  .member-config-label { font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--mid); text-transform: uppercase; letter-spacing: var(--tracking-wide); }
  .member-config-static { font-size: var(--text-base); color: var(--dark); font-weight: var(--weight-semibold); padding: var(--space-1) 0; }
  .member-config-helper { font-size: var(--text-xs); color: var(--light); margin-top: 2px; line-height: var(--leading-snug); }
  .member-config-select { width: 100%; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-md); background: var(--white); font-family: var(--font-sans); font-size: var(--text-md); color: var(--dark); min-height: 44px; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='none' stroke='%23666' stroke-width='1.5' d='M1 1l4 4 4-4'/></svg>"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 34px; }
  .member-config-select:focus { border-color: var(--red); outline: none; }
  .member-config-select:disabled { opacity: 0.7; cursor: default; }
  .member-config-toggles { display: flex; flex-direction: column; gap: var(--space-1-5); }

  /* Permission toggle row — checkbox + track + label. Mirrors the
     .toggle pattern on /profile.html but wraps in a single <label> so
     the entire row is tap-targetable on mobile (44px tap surface). */
  .member-toggle { display: flex; align-items: center; gap: var(--space-2-5); cursor: pointer; padding: var(--space-2-5) 0; min-height: 44px; }
  .member-toggle input { position: absolute; opacity: 0; pointer-events: none; }
  .member-toggle-track { position: relative; width: 44px; height: 24px; flex: 0 0 44px; background: var(--border); border-radius: var(--radius-lg); transition: background 0.2s; }
  .member-toggle-track::after { content: ''; position: absolute; width: 18px; height: 18px; background: var(--white); border-radius: 50%; top: 3px; left: 3px; transition: transform 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.15); }
  .member-toggle input:checked + .member-toggle-track { background: var(--red); }
  .member-toggle input:checked + .member-toggle-track::after { transform: translateX(20px); }
  .member-toggle input:disabled + .member-toggle-track { opacity: 0.6; cursor: default; }
  .member-toggle-label { font-size: var(--text-md); color: var(--dark); font-weight: var(--weight-medium); }

  /* COVERAGE STATES PICKER — mirrored from /css/page-profile-edit.css
     so the shared /js/_lib/coverage-states-picker.js module renders
     consistently on both /profile-edit.html (states_licensed) and
     /team-members.html (per-rep coverage_states). Keep in sync — when
     a third consumer surfaces, promote to /css/components.css per
     /css/AGENTS.md ("used by 5+ pages") with both call sites updated
     in the same commit. */
  .state-chip-list { display: flex; flex-wrap: wrap; gap: var(--space-1-5); margin-bottom: var(--space-2-5); min-height: 4px; }
  .state-chip-pill { display: inline-flex; align-items: center; gap: var(--space-1-5); padding: 7px 10px 7px 9px; background: #eff6ff; border: 0.5px solid #bfdbfe; border-left: 3px solid var(--status-pending-hover); border-radius: 6px; color: #1e3a8a; font-size: var(--text-md); font-weight: var(--weight-semibold); }
  .state-chip-remove { background: none; border: none; color: var(--status-pending-hover); font-size: var(--text-input); line-height: 1; cursor: pointer; padding: 0; display: inline-flex; }
  .state-chip-remove:hover { color: var(--danger-dark); }
  .state-picker-select { width: 100%; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-md); font-family: var(--font-sans); font-size: var(--text-lg); color: var(--dark); background: var(--white); outline: none; -webkit-appearance: none; appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='none' stroke='%23666' stroke-width='1.5' d='M1 1l4 4 4-4'/></svg>"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 34px; }
  .state-picker-select:focus { border-color: var(--red); }
  .state-picker-select:disabled { opacity: 0.7; cursor: default; }
  .state-picker-empty { font-size: var(--text-sm); color: var(--light); padding: var(--space-1-5) 0 var(--space-2); line-height: var(--leading-relaxed); }

  /* OWNER role pill — base rule uses background: var(--dark); which resolves
     to #f5f5f5 (near-white) in dark mode, so the pill renders white-on-white
     (illegible). Remap to the same C72 charcoal (#4b5563) used for the nav
     avatar — keeps white text legible and stays distinct from .rep (#1c1c1c)
     and .manager (#1e3a8a navy). */
  [data-theme="dark"] .role-pill.owner { background: #4b5563; color: var(--white); }

  /* Dark-mode overrides for the per-rep config block + picker. The
     .member-config border-top (collapsed transparent → expanded
     var(--border)) and the .member-chevron stroke (var(--mid)) both ride
     theme-adaptive tokens, so they need no explicit dark override here. */
  [data-theme="dark"] .member-config-select { background-color: var(--surface-light); border-color: var(--border); color: var(--dark); }
  [data-theme="dark"] .state-chip-pill { background: rgba(30, 58, 138, 0.25); color: #c7d2fe; border-color: rgba(191, 219, 254, 0.3); border-left-color: var(--status-pending-hover); }
  [data-theme="dark"] .state-picker-select { background-color: var(--surface-light); border-color: var(--border); color: var(--dark); }
  [data-theme="dark"] .state-picker-empty { color: var(--text-muted); }
  [data-theme="dark"] .member-toggle-label { color: var(--dark); }

  /* TrustGuard Glass Tier-1 RAISED card (Sprint 3G — LOCKED C97-A / C99-A,
     DARK-ONLY). The base .card is a flat dark surface; restyle the existing
     class name into the canonical Tier-1 recipe (mirrors .tg-tier1 +
     ::before in components.css). These cards are static info containers
     (no navigate / expand), so the spring :active is intentionally OMITTED.
     Page CSS loads after shared-themes.css → equal-specificity wins. */
  [data-theme="dark"] .card {
    position: relative;
    background: var(--tier1-bg);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-float);
  }
  [data-theme="dark"] .card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 14px;
    right: 14px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--edge-highlight), transparent);
    pointer-events: none;
  }

  /* Dashed invite tile renders white-in-dark (base rule at L35 uses
     background: var(--white)). Repaint onto the elevated surface with a
     muted glyph + token border so it reads as a recessed "add" affordance. */
  [data-theme="dark"] .avatar.dashed {
    background: var(--surface-elevated);
    color: var(--text-muted);
    border-color: var(--border);
  }

  .invite-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3-5) 0 var(--space-1); cursor: pointer; }
  .invite-row .member-info .member-name { color: var(--red); }

  .about-text { font-size: var(--text-md); color: var(--mid); line-height: var(--leading-relaxed); padding: var(--space-3-5) 0 var(--space-1); }

  .empty-row { padding: var(--space-3-5) 0 var(--space-1-5); font-size: var(--text-md); color: var(--light); }

  /* BOTTOM SHEET */
  .sheet-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 200; }
  .sheet-backdrop.open { display: block; }
  .sheet { display: none; position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); width: 100%; max-width: 640px; background: var(--white); border-radius: var(--radius-xl) var(--radius-xl) 0 0; padding: var(--space-5) var(--space-5) var(--space-7); z-index: 201; }
  .sheet.open { display: block; }
  .sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-4); }
  .sheet-title { font-size: var(--text-input); font-weight: var(--weight-bold); color: var(--dark); }
  .sheet-close { background: none; border: none; font-size: var(--text-3xl); line-height: 1; color: var(--light); cursor: pointer; padding: 0 var(--space-1); }
  .sheet-field { margin-bottom: var(--space-3-5); }
  .sheet-field label { display: block; font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--mid); margin-bottom: 5px; text-transform: uppercase; letter-spacing: var(--tracking-wide); }
  .sheet-field input { width: 100%; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-md); font-family: var(--font-sans); font-size: var(--text-lg); color: var(--dark); outline: none; }
  .sheet-field input:focus { border-color: var(--red); }
  .sheet-err { color: var(--red); font-size: var(--text-md); margin-bottom: var(--space-2-5); display: none; }
  .sheet-btn { display: block; width: 100%; background: var(--btn-primary-bg); color: var(--btn-primary-text); border: var(--btn-primary-border); box-shadow: var(--btn-primary-shadow); padding: 13px 20px; border-radius: var(--btn-radius); font-family: var(--font-sans); font-size: var(--text-lg); font-weight: var(--weight-bold); cursor: pointer; margin-top: var(--space-1); transition: filter 0.15s ease, transform 0.18s var(--ease-spring); }
  .sheet-btn:hover { filter: brightness(1.06); }
  .sheet-btn:active { transform: scale(var(--press-scale)); }
  .sheet-btn:disabled { opacity: 0.6; cursor: default; }

  .loading { padding: 60px 20px; text-align: center; color: var(--light); font-size: var(--text-base); }

  .nav-avatar { width: 44px; height: 44px; min-width: 44px; min-height: 44px; max-width: 44px; max-height: 44px; flex: 0 0 44px; border-radius: 10px; background: var(--dark); color: var(--white); display: flex; align-items: center; justify-content: center; overflow: hidden; text-decoration: none; font-size: var(--text-input); font-weight: var(--weight-bold); flex-shrink: 0; }
  .nav-avatar img { width: 100%; height: 100%; max-width: 100%; max-height: 100%; object-fit: cover; display: block; }

  .toast { position: fixed; left: 50%; bottom: var(--space-6); transform: translateX(-50%); background: var(--dark); color: var(--white); padding: var(--space-3) var(--space-5); border-radius: 10px; font-size: var(--text-md); font-weight: var(--weight-medium); z-index: 300; box-shadow: 0 4px 20px rgba(0,0,0,0.25); display: none; }
  .toast.show { display: block; }
