/* ═══════════════════════════════════════════════════════════════════════
   Crew Social — global consistency sweep  (Builder C)
   Team + Settings/profile + shared chrome (headers, chips, avatars, modals,
   toasts, tab bar, login/gate states). Kills the surviving flat "Breakline"
   surfaces. Tokens only — every value is a var() so both themes track.
   Loaded LAST, so these win the cascade over the Breakline base.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Section headers: friendly font-round ink, NOT tiny system-font caps ── */
h2.section {
  font-family: var(--font-round);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -.01em;
  text-transform: none;
  color: var(--ink);
  margin: 4px 2px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
/* Soft count chip inside a section header (e.g. "Roster · 5"). */
.count-chip {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-family: var(--font-round);
  font-weight: 800;
  font-size: 12.5px;
  line-height: 1;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.count-chip.alert { color: #fff; background: var(--pepp); border-color: transparent; }

/* ── Cards: a touch more air, keep the warm shadow ── */
.card { padding: 16px 17px; }

/* ── Avatars: circular, font-round initials, 44px in content/roster rows ── */
.avatar { font-family: var(--font-round); font-weight: 900; letter-spacing: -.02em; }
.person { gap: 13px; padding: 12px 0; }
.person .avatar { width: 44px; height: 44px; font-size: 16px; border-radius: 50%; }
/* Name is the hero of the row: rounded, heavy, ink. */
.person .name {
  font-family: var(--font-round);
  font-weight: 900;
  font-size: 15.5px;
  letter-spacing: -.01em;
  color: var(--ink);
}
.person .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.person > .muted svg { width: 20px; height: 20px; opacity: .55; }
/* Gentle press feedback on tappable roster rows. */
.person[onclick] { cursor: pointer; transition: background .12s; }
.person[onclick]:active { background: color-mix(in srgb, var(--accent) 7%, transparent); }

/* ── Tags: soft rounded pills. Role tag keeps its colour but reads friendly ── */
.tag {
  font-family: var(--font-round);
  font-weight: 800;
  font-size: 10.5px;
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: .01em;
}
.tag.role {
  color: #fff;
  border: none;
  box-shadow: inset 0 0 0 100px rgba(0,0,0,.04);
}

/* ── Chips / filter pills: rounded-full, comfy tap target, soft accent-tint
      when active (not a hard fill) per the pill spec. ── */
button.chip {
  min-height: 34px;
  padding: 7px 14px;
  font-family: var(--font-round);
  font-weight: 700;
  font-size: 13px;
  border-radius: 999px;
}
button.chip.on {
  background: color-mix(in srgb, var(--accent) 16%, var(--surface-2));
  border-color: var(--accent);
  color: var(--ink);
}
/* Action chips inside rows (Resend / Approve / Deny) stay compact & tidy. */
.person .chip { min-height: 32px; padding: 6px 12px; margin: 0 0 0 6px; }

/* ── Buttons: primary is a warm, tappable block; secondary muted ── */
button.btn {
  min-height: 46px;
  border-radius: 15px;
  font-weight: 800;
  font-family: var(--font-round);
  letter-spacing: -.01em;
}
button.btn.secondary { font-weight: 700; }
button.btn svg { width: 18px; height: 18px; vertical-align: -3px; }
/* Login/loading state: dim + wait cursor while a request is in flight. */
button.btn[disabled], button.btn.loading { opacity: .6; cursor: progress; }

/* ── Add-affordance: dashed "+ Add" secondary buttons read as invitations ── */
button.btn.secondary[onclick*="editRole(0"],
button.btn.secondary[onclick*="openCreatePerson"] {
  background: transparent;
  border: 1.5px dashed var(--border);
  color: var(--muted);
}

/* ── Modals / bottom sheets ── */
.modal-wrap { background: color-mix(in srgb, var(--ink) 42%, transparent); }
.modal { padding: 8px 18px calc(24px + env(safe-area-inset-bottom)); }
.modal::before { background: var(--surface-3); width: 44px; }
.modal h3 { font-family: var(--font-round); font-weight: 900; font-size: 20px; letter-spacing: -.01em; margin: 4px 0 10px; }
/* Soften the raw 1px divider bars used between modal groups. */
.modal div[style*="height:1px"] { background: var(--hair) !important; }
.modal .person .sub { font-size: 13px; }

/* ── Toast: rounded, warm, font-round ── */
.toast {
  font-family: var(--font-round);
  font-weight: 700;
  font-size: 13.5px;
  padding: 12px 20px;
  border-radius: 16px;
  background: var(--ink);
  color: var(--bg);
}

/* ── Empty states: warm rounded microcopy (concept already sets font-round) ── */
.empty { line-height: 1.5; }

/* ── Skeleton avatars: circular to match the real circular avatars ── */
.skel-av { border-radius: 50%; }

/* ── Bottom tab bar: font-round labels; active label + icon go accent ── */
nav.tabbar button {
  font-family: var(--font-round);
  font-weight: 800;
  font-size: 10.5px;
  letter-spacing: -.01em;
}
nav.tabbar button.active { color: var(--accent); }
nav.tabbar button.active svg { color: var(--accent); }

/* ── Top nav (desktop): rounded font-round labels; active = accent tint ── */
.topnav button { font-family: var(--font-round); font-weight: 700; }
.topnav button.active {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--surface-2));
}
.topnav button.active svg { color: var(--accent); }

/* ── Header brand word ── */
header .word { font-weight: 900; }

/* ═══ Team-specific polish ═══ */
/* Role swatch reads as a friendly dot rather than a square. */
.role-swatch { width: 30px; height: 30px; border-radius: 50%; border: none; box-shadow: inset 0 0 0 2px var(--surface), 0 0 0 1px var(--border); }
/* Join-code hero: big rounded tabular code. */
.jc-code {
  font-family: var(--font-round);
  font-weight: 900;
  font-size: 38px;
  letter-spacing: .12em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.jc-code.off { opacity: .4; text-decoration: line-through; }
.jc-link { color: var(--muted); font-size: 13px; margin-top: 8px; word-break: break-all; }

/* ═══ Settings / profile ═══ */
/* Accent toggle: recolor the native checkbox to the brand accent. */
.modal input[type="checkbox"] { accent-color: var(--accent); width: 18px; height: 18px; }
/* Sign-out row already muted (secondary) — keep it quiet; nudge its icon. */
.modal button.btn.secondary[onclick*="logout"] svg { color: var(--muted); }

/* ═══ Login / gate / availability states ═══ */
/* The gate reuses class="section" for its title — force it back to a real
   heading (font-round, larger, centered) rather than the small header. */
#gate #gate-title.section, #availgate .section {
  font-size: 20px;
  font-weight: 900;
  color: var(--ink);
  margin: 6px 2px 8px;
  justify-content: center;
}
#gate .brandbig h1, #availgate .brandbig h1 { font-family: var(--font-round); font-weight: 900; }
/* Login/gate error text: friendlier weight, still the alert token colour. */
#login .err, #gate .err, #availgate .err { font-family: var(--font-round); font-weight: 700; text-align: center; }
/* Availability-gate toggle keeps the basil "good" tint; round the label. */
.av-toggle { font-family: var(--font-round); font-weight: 800; }

/* ═══ Hat pins: the reward shelf on a person sheet ═══ */
/* The shelf is what a teammate now reaches by tapping a colleague, where the app
   used to say they lacked permission to edit that person. Every colour comes
   from a token so both themes track; the medallion itself is fixed artwork and
   deliberately does NOT theme — a brass pin is brass in the dark too. */
.pin-shelf { margin: 14px 0 4px; }
.pin-shelf-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 8px; min-height: 30px;
}
.pin-shelf-title {
  font-family: var(--font-round); font-weight: 800; font-size: 12px;
  text-transform: uppercase; letter-spacing: .09em; color: var(--muted);
}
/* `button.btn` is width:100% with a top margin, so an inline action has to beat
   it on specificity rather than hope to override it — element+two classes. */
button.btn.pin-award-btn {
  width: auto; margin-top: 0; flex: none; padding: 7px 11px; font-size: 13px;
  display: flex; align-items: center; gap: 6px;
}
button.btn.pin-award-btn svg { width: 16px; height: 16px; }

.pin-grid {
  display: flex; flex-wrap: wrap; gap: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px;
}
/* Unearned pins: same tiles, dashed and drained, so the shelf reads as "here is
   the set and here is where you are in it" rather than a list that stops. */
.pin-grid.locked-row {
  background: transparent; border-style: dashed; margin-top: 8px; padding: 10px;
}
.pin-tile { width: 74px; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.pin-medal { position: relative; line-height: 0; }
.pin-art { display: block; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .28)); }
.pin-tile.locked .pin-art { filter: grayscale(1); opacity: .38; }
.pin-count {
  position: absolute; right: -5px; bottom: -3px;
  background: var(--ink); color: var(--bg); border-radius: 999px;
  font-size: 11px; font-weight: 800; line-height: 1.5; padding: 0 5px;
  font-variant-numeric: tabular-nums;
}
.pin-tile-name { font-size: 11px; line-height: 1.25; text-align: center; color: var(--muted); }
.pin-empty { font-size: 13px; margin: 2px 0 0; }

/* Who gave it and what for. A pin without its sentence is a sticker. */
.pin-log { list-style: none; margin: 12px 0 0; padding: 0; }
.pin-log li {
  display: flex; align-items: baseline; gap: 7px; font-size: 13px;
  border-top: 1px solid var(--hair); padding: 6px 0;
}
.pin-log-when {
  color: var(--muted); font-size: 11px; text-transform: uppercase;
  letter-spacing: .05em; flex: none; min-width: 42px;
}
/* A note is free text somebody typed on a phone, so it can arrive as one
   unbroken 200-character token. Without `min-width: 0` a flex item refuses to
   shrink below its content, which would push the undo button off the right edge
   of a 390px screen — the control would still exist and be unreachable. */
.pin-log-text { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.pin-undo {
  margin-left: auto; flex: none; background: none; border: 0;
  color: var(--muted); cursor: pointer; line-height: 0;
  /* The glyph stays 15px; the TAP TARGET is 43px. Padding grows the hit area and
     the negative margins hand the space back, so the row height does not change.
     This deletes something a colleague earned — it must not be a 19px target
     sitting beside a scrolling list. */
  display: flex; align-items: center; justify-content: center;
  padding: 14px; margin: -14px -4px -14px auto;
}
.pin-undo svg { width: 15px; height: 15px; }

/* The award form's pin picker. */
.pin-choices { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 12px; }
.pin-choice {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  min-width: 92px; padding: 10px; cursor: pointer;
  background: var(--surface-2); border: 2px solid transparent;
  border-radius: var(--radius-sm); color: var(--ink);
  font: inherit; font-size: 12px; font-weight: 600;
}
.pin-choice.on { border-color: var(--accent); background: var(--surface-3); }
.pin-choice:focus-visible,
.pin-undo:focus-visible,
button.btn.pin-award-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* The medallion inside the Activity announcement card. Left-aligned with the
   body text rather than centred: the card is a sentence with a picture, not a
   trophy presentation, and centring it orphans the artwork from the words. */
.pin-post-art { margin: 12px 0 2px; }
.pin-post-art .pin-art { filter: drop-shadow(0 3px 5px rgba(0, 0, 0, .30)); }

/* ═══════════════════════════════════════════════════════════════════════
   Team roster — search, A–Z rail, attention strip   (2026-08-26)
   Replaces the three stacked rows of filter chips and the flat 101-row list.
   Behaviour and reasoning: static/js/team-roster.js.
   ═══════════════════════════════════════════════════════════════════════ */

/* The sticky search + filter bar. Same anatomy as .feed-segments, deliberately:
   `main` is the scroll container and the header is its SIBLING, so top:0 sticks
   flush against the edge immediately under the header — no safe-area arithmetic,
   and no negative offset (which clips rather than tucks; see the note on
   .feed-segments in social-feedchats.css). */
.team-toolbar {
  position: sticky; top: 0; z-index: 12;
  display: flex; flex-direction: column; gap: 8px;
  padding: 8px; margin: 0 0 13px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--border); border-radius: 17px;
  box-shadow: 0 5px 18px -16px #000;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.team-search { position: relative; display: flex; align-items: center; }
.team-search svg {
  position: absolute; left: 11px; width: 17px; height: 17px;
  color: var(--muted); pointer-events: none;
}
/* 16px is the iOS auto-zoom floor the base stylesheet sets for every focusable
   control — not a size preference. Left padding clears the glyph above. */
.team-search input {
  width: 100%; margin: 0; padding: 11px 12px 11px 36px;
  font-size: 16px; border-radius: var(--radius-sm);
}
.team-search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.team-filter-row { display: flex; flex-wrap: wrap; gap: 6px; }
.team-filter {
  width: auto; flex: 1 1 auto; min-width: 0; margin: 0;
  padding: 8px 9px; font-size: 16px; font-weight: 600;
  border-radius: 999px; background: var(--surface-2);
}
.team-filter.on {
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent);
}

/* Attention strip. Amber is the third channel, never the only one — the heading,
   the count and the wording carry it without colour (same rule as .tag-warn). */
.team-attn {
  border-color: color-mix(in srgb, var(--warn) 42%, var(--border));
  background: color-mix(in srgb, var(--warn) 8%, var(--surface));
}
.team-attn-lead {
  margin: -4px 2px 8px; font-size: 12.5px; line-height: 1.4; color: var(--muted);
}
.team-attn .person:last-of-type { border-bottom: none; }
.team-attn-more {
  font-size: 12px; font-weight: 600; color: var(--muted);
  padding: 9px 2px 0; border-top: 1px solid var(--hair); margin-top: 2px;
}

/* The list. Room on the right for the rail, so a long name never runs under it. */
.team-roster { position: relative; padding-right: 30px; }
/* Letter headers span the card's own padding, iOS-style, without the list having
   to break out of .wrap — which would misalign on desktop, where .wrap is a
   centred 1040px column with different padding. */
.team-letter {
  position: sticky; top: 0; z-index: 1;
  margin: 0 -30px 0 -17px; padding: 4px 17px;
  background: var(--surface-2); border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
  font: 800 11.5px/1.5 var(--font); letter-spacing: .09em; color: var(--muted);
}
.team-letter:first-child { border-top: none; margin-top: -4px; }
.team-roster .person .sub { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.team-roster .person .sub .tag { margin-left: 0; }
.team-dot { opacity: .55; }

/* The A–Z rail. Absolute inside the card so it spans exactly the list and cannot
   float over the tab bar; the inner strip is sticky so it rides near the middle
   of the viewport while the list scrolls past it.
   `touch-action: none` is load-bearing: without it the WebView claims the drag
   as a page scroll and the rail only ever registers the first tap. */
.team-rail {
  position: absolute; top: 0; bottom: 0; right: 2px; width: 26px;
  display: flex; justify-content: center;
  touch-action: none; -webkit-user-select: none; user-select: none;
  cursor: pointer;
}
.team-rail-inner {
  position: sticky; top: calc(50vh - 160px);
  display: flex; flex-direction: column; align-items: center;
  padding: 6px 0; align-self: flex-start;
}
.team-rail span {
  font: 800 9.5px/1.32 var(--font); color: var(--muted);
  width: 100%; text-align: center;
}
.team-rail:active span { color: var(--accent); }
/* Pointer-fine devices scroll with a wheel and a scrollbar; the rail is a thumb
   affordance and at 9.5px it is a poor mouse target. */
@media (hover: hover) and (pointer: fine) {
  .team-rail { display: none; }
  .team-roster { padding-right: 17px; }
  .team-letter { margin-right: -17px; }
}
