/* Team bar "who and why" sheet (js/ui/team-bar-why.js, owner 2026-10-19).
   A popover under the bar; a bottom sheet on phones (.is-sheet). */
.team-bar-why {
  position: fixed;
  z-index: 10050;
  width: 380px;
  max-width: calc(100vw - 16px);
  max-height: min(560px, calc(100vh - 32px));
  display: flex;
  flex-direction: column;
  background: var(--surface-primary, #fff);
  color: var(--text-primary, #1e293b);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 18px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.22);
  font-family: inherit;
  overflow: hidden;
}
.team-bar-why[hidden] { display: none; }
.team-bar-why .tbw-grab { display: none; }
.team-bar-why.is-sheet {
  left: 0 !important;
  right: 0;
  bottom: 0;
  top: auto !important;
  width: auto;
  max-width: none;
  max-height: 72vh;
  border-radius: 22px 22px 0 0;
  border-bottom: 0;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.team-bar-why.is-sheet .tbw-grab {
  display: block;
  width: 38px;
  height: 5px;
  border-radius: 3px;
  background: var(--slate-300, #cbd5e1);
  margin: 8px auto 0;
}

.tbw-tabs {
  /* Never squeezed by a long list: the body scrolls, the tabs and head keep
     their height (a long list clipped the tabs' second line). */
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
  padding: 12px 14px 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.tbw-tabs::-webkit-scrollbar { display: none; }
/* The popover is narrow: its tabs wrap. The phone sheet keeps one swipeable row. */
.team-bar-why:not(.is-sheet) .tbw-tabs { flex-wrap: wrap; overflow-x: visible; }
.tbw-tab {
  flex: 0 0 auto;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px 0 8px;
  border-radius: 14px;
  border: 1px solid var(--border-color, #e2e8f0);
  background: var(--surface-secondary, #f8fafc);
  color: inherit;
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.tbw-tab {
  /* 1px border + 1px inset ring when picked: the box never changes size. */
  box-shadow: inset 0 0 0 1px transparent;
}
/* Picked = the app's soft teal tint + teal outline (owner 2026-10-30: the
   black box was inconsistent with the design). */
.tbw-tab[aria-selected="true"] {
  background: var(--primary-50, #f0fdfa);
  border-color: var(--primary-600, #0d9488);
  box-shadow: inset 0 0 0 1px var(--primary-600, #0d9488);
  color: var(--primary-900, #134e4a);
}
/* The outline already marks the picked tab (open() focuses it); the global
   3px ring + halo (button:focus-visible, !important) on top read as a second
   box. Other tabs keep the ring for the keyboard. */
.team-bar-why .tbw-tab[aria-selected="true"]:focus-visible {
  outline: none !important;
  box-shadow: inset 0 0 0 1px var(--primary-600, #0d9488) !important;
}
body.dark-mode .team-bar-why .tbw-tab[aria-selected="true"]:focus-visible { box-shadow: inset 0 0 0 1px #2dd4bf !important; }
.tbw-sw {
  width: 8px;
  height: 28px;
  border-radius: 4px;
  background: #64748b;
}
.tbw-tab[data-whole] .tbw-sw { background: var(--slate-500, #64748b); }
.tbw-tab-t { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.tbw-tab-t b { font-size: 12px; font-weight: 700; }
.tbw-tab-t span { font-size: 11px; opacity: 0.8; }

.tbw-head {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 0;
}
.tbw-when { font-size: 12px; font-weight: 600; color: var(--text-secondary, #475569); }
/* The stretch is the headline: its times, then its length, then the count. */
.tbw-title {
  margin: 2px 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.tbw-len {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-700, #0f766e);
}
.tbw-count { margin: 4px 0 0; font-size: 15px; font-weight: 700; color: var(--text-primary, #1e293b); }
.tbw-close {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 22px;
  background: var(--surface-secondary, #f1f5f9);
  color: inherit;
  cursor: pointer;
}
.tbw-note { margin: 4px 16px 0; font-size: 12px; color: var(--text-secondary, #475569); }

.tbw-body { flex: 1 1 auto; min-height: 0; padding: 6px 16px 8px; overflow-y: auto; }
.tbw-h {
  margin: 10px 0 2px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.tbw-h-can { color: #15803d; }
.tbw-h-cant { color: #b91c1c; }
.tbw-list { list-style: none; margin: 0; padding: 0; }
.tbw-aside { margin-top: 6px; border-top: 1px solid var(--border-color, #e2e8f0); opacity: 0.85; }
.tbw-row { display: flex; align-items: center; gap: 12px; min-height: 52px; }
.tbw-av {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}
.tbw-who { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.tbw-name { font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbw-place { font-weight: 500; color: var(--text-secondary, #64748b); }
.tbw-why { font-size: 12px; color: var(--text-secondary, #475569); }
.tbw-pill {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.tbw-pill[data-tone="ok"] { background: #dcfce7; color: #166534; }
.tbw-pill[data-tone="soft"] { background: #fef3c7; color: #92400e; }
.tbw-pill[data-tone="no"] { background: #fee2e2; color: #b91c1c; }
.tbw-pill[data-tone="sleep"] { background: #ede9fe; color: #5b21b6; }

.tbw-note { flex: 0 0 auto; }
.tbw-foot { flex: 0 0 auto; padding: 8px 16px 14px; border-top: 1px solid var(--border-color, #e2e8f0); }
.tbw-create {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  background: var(--primary-600, #0d9488);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

body.dark-mode .tbw-tab[aria-selected="true"] { background: rgba(20, 184, 166, 0.16); border-color: #2dd4bf; box-shadow: inset 0 0 0 1px #2dd4bf; color: #ccfbf1; }
body.dark-mode .tbw-len { color: #5eead4; }
body.dark-mode .tbw-h-can { color: #4ade80; }
body.dark-mode .tbw-h-cant { color: #f87171; }
body.dark-mode .tbw-pill[data-tone="ok"] { background: rgba(34, 197, 94, 0.18); color: #86efac; }
body.dark-mode .tbw-pill[data-tone="soft"] { background: rgba(245, 158, 11, 0.18); color: #fcd34d; }
body.dark-mode .tbw-pill[data-tone="no"] { background: rgba(239, 68, 68, 0.18); color: #fca5a5; }
body.dark-mode .tbw-pill[data-tone="sleep"] { background: rgba(139, 92, 246, 0.2); color: #c4b5fd; }
