/* TBH Retreat — Phase 1 stylesheet */

:root {
  --brand-blue:        #1E5A96;
  --brand-blue-bright: #4A90E2;
  --brand-blue-deep:   #0D3D6E;

  --group-1: #3FAE6A;
  --group-2: #E6C547;
  --group-3: #E08740;

  --radius-sm: 8px;
  --radius:    14px;
  --radius-lg: 22px;

  --shadow-card: 0 4px 18px rgba(0,0,0,0.35);
  --shadow-soft: 0 2px 10px rgba(0,0,0,0.18);

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Inter", var(--font-sans);

  --t-fast:  140ms;
  --t-med:   260ms;
  --t-slow:  480ms;
}

[data-theme="dark"] {
  --bg-0: #0A0F16;
  --bg-1: #131E2B;
  --bg-2: #1B2A3D;
  --bg-3: #243651;

  --fg-0: #FFFFFF;
  --fg-1: #C9D4E2;
  --fg-2: #8FA1B8;
  --fg-3: #5C6E85;

  --border:  rgba(255,255,255,0.14);
  --border-strong: rgba(255,255,255,0.24);

  --accent: var(--brand-blue-bright);
  --accent-fg: #FFFFFF;

  --first-timer-glow: #F5C24A;
}

[data-theme="light"] {
  --bg-0: #F5F7FA;
  --bg-1: #FFFFFF;
  --bg-2: #EEF2F7;
  --bg-3: #DDE5EF;

  --fg-0: #0E1A2A;
  --fg-1: #2A3A50;
  --fg-2: #56697F;
  --fg-3: #8595A8;

  --border:  rgba(14,26,42,0.10);
  --border-strong: rgba(14,26,42,0.20);

  --accent: var(--brand-blue);
  --accent-fg: #FFFFFF;

  --first-timer-glow: #E69A1A;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg-0);
  color: var(--fg-0);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100%;
}

body {
  padding-bottom: 60px;
  transition: background var(--t-med) ease, color var(--t-med) ease;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

/* ========== Top nav ========== */

.topnav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg-0) 88%, transparent);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.topnav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 720px;
  margin: 0 auto;
  padding: 14px 18px 6px;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  font-size: 15px;
}
.brand__mark {
  width: 28px; height: 28px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--brand-blue-bright), var(--brand-blue-deep));
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 13px;
  box-shadow: var(--shadow-soft);
}
.brand__title { color: var(--fg-0); }
.brand__sub   { color: var(--fg-2); font-weight: 500; margin-left: 8px; font-size: 12px; }

.theme-toggle {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--fg-1);
  transition: background var(--t-fast), color var(--t-fast);
}
.theme-toggle:hover { background: var(--bg-2); color: var(--fg-0); }
.theme-toggle svg { width: 18px; height: 18px; }

.nav-tabs {
  display: flex;
  gap: 4px;
  max-width: 720px;
  margin: 0 auto;
  padding: 4px 12px 8px;
  overflow-x: auto;
}
.nav-tab {
  flex: 1 1 0;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--fg-2);
  border-radius: var(--radius-sm);
  text-align: center;
  letter-spacing: 0.3px;
  transition: color var(--t-fast), background var(--t-fast);
  white-space: nowrap;
}
.nav-tab[aria-current="page"] {
  color: var(--fg-0);
  background: var(--bg-2);
}
.nav-tab:hover:not([aria-current="page"]) { color: var(--fg-1); }

/* ========== Layout ========== */

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 18px 80px;
}

.view {
  animation: fade-up var(--t-slow) ease both;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ========== Main / dashboard ========== */

.hero {
  border-radius: var(--radius-lg);
  padding: 26px 22px;
  background:
    radial-gradient(120% 100% at 0% 0%, color-mix(in srgb, var(--brand-blue-bright) 25%, transparent), transparent 60%),
    linear-gradient(160deg, var(--bg-1), var(--bg-2));
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}
.hero__eyebrow {
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}
.hero__title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.8px;
  margin: 8px 0 4px;
}
.hero__meta {
  color: var(--fg-2);
  font-size: 14px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 18px;
}
.stat {
  background: color-mix(in srgb, var(--bg-0) 50%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 10px;
  text-align: center;
}
.stat__num {
  font-size: 22px; font-weight: 800;
  color: var(--fg-0);
}
.stat__label {
  font-size: 10.5px; letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--fg-2);
  margin-top: 2px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.8px;
  color: var(--fg-2);
  margin: 30px 0 12px;
  font-weight: 700;
}

.roster-list {
  display: flex; flex-direction: column;
  gap: 8px;
}
.roster-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  transition: transform var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}
.roster-row:hover {
  background: var(--bg-2);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.roster-row__name { font-weight: 600; color: var(--fg-0); }
.roster-row__meta { font-size: 12px; color: var(--fg-2); }
.roster-row__right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* ========== Avatars ========== */

.avatar {
  border-radius: 50%;
  background: var(--bg-3);
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid transparent;
  transition: border-color var(--t-fast);
}
.avatar img, .avatar svg { width: 100%; height: 100%; display: block; }

.avatar--sm { width: 40px; height: 40px; }
.avatar--md { width: 64px; height: 64px; }
.avatar--lg { width: min(300px, 78vw); aspect-ratio: 1 / 1; height: auto; }

.avatar-wrap { position: relative; display: inline-block; }
.avatar-wrap .avatar { display: block; }

.avatar__badge {
  position: absolute;
  bottom: 2px; right: 2px;
  background: var(--first-timer-glow);
  color: #1a1206;
  font-weight: 800;
  font-size: 9.5px;
  letter-spacing: 0.3px;
  padding: 3px 7px;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35), 0 0 0 2px var(--bg-1);
  text-transform: uppercase;
  pointer-events: none;
}
.avatar-wrap--md .avatar__badge { font-size: 10px; bottom: 4px; right: 4px; }
.avatar-wrap--lg .avatar__badge {
  font-size: 12px;
  padding: 5px 11px;
  bottom: 6px; right: 6px;
}

/* ========== Pop state — profound emotional release ========== */
:root {
  --pop-glow: #FF7A3D;
  --pop-glow-deep: #E04E2A;
}
.avatar-wrap.has-popped .avatar {
  border: 3px solid var(--pop-glow);
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--pop-glow) 30%, transparent),
    0 0 24px 4px color-mix(in srgb, var(--pop-glow) 45%, transparent),
    0 0 48px 8px color-mix(in srgb, var(--pop-glow-deep) 25%, transparent);
  animation: pop-pulse 2.6s ease-in-out infinite;
}
@keyframes pop-pulse {
  0%, 100% { box-shadow:
      0 0 0 2px color-mix(in srgb, var(--pop-glow) 30%, transparent),
      0 0 24px 4px color-mix(in srgb, var(--pop-glow) 45%, transparent),
      0 0 48px 8px color-mix(in srgb, var(--pop-glow-deep) 25%, transparent); }
  50% { box-shadow:
      0 0 0 2px color-mix(in srgb, var(--pop-glow) 45%, transparent),
      0 0 30px 6px color-mix(in srgb, var(--pop-glow) 60%, transparent),
      0 0 64px 12px color-mix(in srgb, var(--pop-glow-deep) 35%, transparent); }
}
/* (flame corner badge removed per Jonah feedback — orange halo alone) */

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 3px 8px;
  border-radius: 999px;
}
.badge--first    { background: color-mix(in srgb, var(--first-timer-glow) 22%, transparent); color: var(--first-timer-glow); }
.badge--lead     { background: color-mix(in srgb, var(--brand-blue-bright) 22%, transparent); color: var(--brand-blue-bright); }
.badge--asst     { background: color-mix(in srgb, var(--brand-blue) 22%, transparent);        color: var(--accent); }
.badge--retreats { background: var(--bg-2); color: var(--fg-1); }

/* ========== Members grid ========== */

.members-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.member-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 10px 12px;
  text-align: center;
  transition: transform var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}
.member-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  background: var(--bg-2);
}
.member-card .avatar { margin: 0 auto 10px; }
.member-card__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-0);
  line-height: 1.2;
}
.member-card__meta {
  font-size: 11px;
  color: var(--fg-2);
  margin-top: 2px;
}

/* ========== Groups ========== */

.group-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 18px;
  overflow: hidden;
}
.group-card__header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
}
.group-color-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 20%, transparent);
}
.group-card__title { font-weight: 800; font-size: 16px; }
.group-card__count { margin-left: auto; color: var(--fg-2); font-size: 12px; }

.group-leaders {
  padding: 12px 16px 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--fg-2);
}
.group-list {
  list-style: none; margin: 0; padding: 0 8px 12px;
  display: flex; flex-direction: column;
  gap: 4px;
}
.group-list .roster-row { background: transparent; border-color: transparent; }
.group-list .roster-row:hover { background: var(--bg-2); border-color: var(--border); }

/* ========== Profile detail ========== */

.profile {
  text-align: center;
}
.profile .avatar { margin: 8px auto 16px; }
.profile__name {
  font-family: var(--font-display);
  font-size: 28px; font-weight: 800; letter-spacing: -0.6px;
  margin-top: 6px;
}
.profile__line {
  margin-top: 8px;
  font-size: 13px;
  color: var(--fg-2);
  display: flex;
  gap: 6px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  line-height: 1.5;
}
.profile__line a {
  color: var(--fg-1);
  font-weight: 600;
}
.profile__line a:hover { color: var(--fg-0); text-decoration: none; }
.profile__line-sep { color: var(--fg-3); }
.profile__sublabel { color: var(--fg-3); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.8px; font-weight: 700; }
.profile__badges-inline { display: flex; gap: 6px; justify-content: center; margin-top: 8px; flex-wrap: wrap; }

.group-chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: color-mix(in srgb, var(--g, var(--accent)) 14%, var(--bg-1));
  border: 1px solid color-mix(in srgb, var(--g, var(--accent)) 50%, transparent);
  color: var(--fg-0);
  font-weight: 700;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 999px;
  text-decoration: none;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.group-chip:hover {
  background: color-mix(in srgb, var(--g, var(--accent)) 22%, var(--bg-1));
  text-decoration: none;
  transform: translateY(-1px);
}
.group-chip__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--g, var(--accent));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--g, var(--accent)) 25%, transparent);
}

/* (group leaders moved inline into .profile__line) */

.first-timer-star {
  color: var(--first-timer-glow);
  font-size: 13px;
  margin-right: 4px;
  text-shadow: 0 0 8px color-mix(in srgb, var(--first-timer-glow) 40%, transparent);
}
.profile__badges {
  margin-top: 12px;
  display: flex; gap: 6px; justify-content: center; flex-wrap: wrap;
}

.profile-actions {
  margin-top: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
}
.action-btn--icon {
  width: 44px;
  padding: 0;
  flex-shrink: 0;
}
.action-btn--icon svg { width: 18px; height: 18px; }
.action-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  min-height: 44px;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--fg-0);
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.action-btn:hover {
  background: var(--bg-2);
  border-color: var(--border-strong);
  transform: translateY(-1px);
  text-decoration: none;
}
.action-btn svg { width: 16px; height: 16px; }
.action-btn--primary {
  background: var(--accent);
  color: var(--accent-fg);
  border: 1px solid rgba(255,255,255,0.18);
}
.action-btn--primary:hover { background: var(--brand-blue-deep); color: #fff; }

.profile__notes-placeholder {
  margin-top: 24px;
  padding: 18px 18px;
  min-height: 140px;
  border-radius: var(--radius);
  border: 1px dashed var(--border-strong);
  color: var(--fg-2);
  font-size: 13px;
  text-align: left;
}

/* ========== Tracking pills (long-press to toggle) ========== */

.tracking {
  margin-top: 22px;
  text-align: left;
}
.tracking__legend {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--fg-2);
  margin: 0 0 8px;
  font-weight: 700;
}
.tracking-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}
.tracking-toggle {
  position: relative;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 8px;
  min-height: 44px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--fg-1);
  text-align: center;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), transform var(--t-fast);
  overflow: hidden;
}
.tracking-toggle__check {
  display: inline-block;
  width: 14px; height: 14px;
  border-radius: 4px;
  border: 1.5px solid var(--fg-3);
  margin-right: 6px;
  vertical-align: -2px;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.tracking-toggle[aria-pressed="true"] {
  background: color-mix(in srgb, var(--brand-blue-bright) 14%, var(--bg-1));
  border-color: color-mix(in srgb, var(--brand-blue-bright) 60%, transparent);
  color: var(--fg-0);
}
.tracking-toggle[aria-pressed="true"] .tracking-toggle__check {
  background: var(--brand-blue-bright);
  border-color: var(--brand-blue-bright);
  box-shadow: inset 0 0 0 2px var(--bg-1);
}
.tracking-toggle[data-row="depth"][aria-pressed="true"] {
  background: color-mix(in srgb, var(--first-timer-glow) 16%, var(--bg-1));
  border-color: color-mix(in srgb, var(--first-timer-glow) 60%, transparent);
}
.tracking-toggle[data-row="depth"][aria-pressed="true"] .tracking-toggle__check {
  background: var(--first-timer-glow);
  border-color: var(--first-timer-glow);
}
.tracking-toggle.is-arming {
  transform: scale(0.97);
  background: var(--bg-2);
}
.tracking-toggle.is-arming::after {
  content: '';
  position: absolute;
  left: 0; bottom: 0;
  height: 3px;
  width: 100%;
  background: var(--accent);
  transform-origin: left;
  animation: arm-fill 500ms linear forwards;
}
@keyframes arm-fill {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

/* ========== Prev / Next profile nav ========== */

.prev-next {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 30px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.prev-next a {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  color: var(--fg-1);
  font-size: 13px;
  font-weight: 600;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
  min-height: 44px;
  text-align: left;
}
.prev-next a:hover {
  background: var(--bg-2);
  border-color: var(--border-strong);
  color: var(--fg-0);
  text-decoration: none;
}
.prev-next .pn-arrow { font-size: 18px; color: var(--accent); flex-shrink: 0; }
.prev-next .pn-name  { color: var(--fg-0); font-size: 13.5px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1 1 auto; }
.prev-next__next { justify-content: flex-end; text-align: right; }
.prev-next__next .pn-name { text-align: right; }

.back-link {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600;
  color: var(--fg-2);
  margin-bottom: 12px;
  width: max-content;
}
.profile .back-link { text-align: left; }
.back-link:hover { color: var(--fg-0); text-decoration: none; }

/* ========== Responsive ========== */

@media (min-width: 540px) {
  .members-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 720px) {
  .stats { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 380px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .members-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Loader */
.loading {
  text-align: center;
  color: var(--fg-2);
  padding: 40px 0;
}

/* ========== Bottom sheet (action confirm) ========== */

.sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  opacity: 0;
  transition: opacity 180ms ease;
  z-index: 100;
}
.sheet-backdrop[data-open="true"] { opacity: 1; }

.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--bg-1);
  border-top: 1px solid var(--border-strong);
  border-radius: 22px 22px 0 0;
  padding: 22px 18px calc(24px + env(safe-area-inset-bottom, 0));
  z-index: 101;
  transform: translateY(100%);
  transition: transform 220ms cubic-bezier(.2,.7,.2,1);
  box-shadow: 0 -10px 40px rgba(0,0,0,0.45);
  max-width: 540px; margin: 0 auto;
}
.sheet[data-open="true"] { transform: translateY(0); }
.sheet__grab {
  width: 40px; height: 4px;
  background: var(--fg-3);
  border-radius: 2px;
  margin: -8px auto 14px;
  opacity: 0.6;
}
.sheet__title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--fg-0);
  text-align: center;
  margin-bottom: 4px;
}
.sheet__subtitle {
  font-size: 13px;
  color: var(--fg-2);
  text-align: center;
  margin-bottom: 18px;
  word-break: break-all;
}
.sheet__actions {
  display: flex; flex-direction: column; gap: 8px;
}
.sheet__btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  font-weight: 700;
  font-size: 15px;
  color: var(--fg-0);
  transition: background var(--t-fast);
  min-height: 52px;
}
.sheet__btn:hover { background: var(--bg-3); text-decoration: none; }
.sheet__btn--primary {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: transparent;
}
.sheet__btn--primary:hover { background: var(--brand-blue-deep); color: #fff; }
.sheet__btn--cancel {
  margin-top: 4px;
  background: transparent;
  color: var(--fg-2);
  border-color: transparent;
}
.sheet__btn--cancel:hover { background: var(--bg-2); }

/* ========== Pop-flare animation (live update from another leader) ========== */
.avatar-wrap.just-popped .avatar {
  animation: pop-flare 1.6s cubic-bezier(.2,.7,.2,1) 1;
}
@keyframes pop-flare {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--pop-glow) 80%, transparent),
                     0 0 0 0 color-mix(in srgb, var(--pop-glow-deep) 60%, transparent); }
  35%  { box-shadow: 0 0 0 8px color-mix(in srgb, var(--pop-glow) 35%, transparent),
                     0 0 60px 20px color-mix(in srgb, var(--pop-glow) 75%, transparent),
                     0 0 120px 40px color-mix(in srgb, var(--pop-glow-deep) 50%, transparent); }
  100% { box-shadow: 0 0 0 2px color-mix(in srgb, var(--pop-glow) 30%, transparent),
                     0 0 24px 4px color-mix(in srgb, var(--pop-glow) 45%, transparent),
                     0 0 48px 8px color-mix(in srgb, var(--pop-glow-deep) 25%, transparent); }
}

/* ========== Members sub-nav (pop/not/all radio) ========== */
.section-subnav {
  display: flex; align-items: center; gap: 10px;
  margin: 8px 0 18px;
}
.section-subnav__count {
  margin-left: auto;
  color: var(--fg-3);
  font-size: 12px;
  font-weight: 600;
}
.radio-group {
  display: inline-flex;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
}
.radio-pill {
  background: transparent;
  border: none;
  color: var(--fg-2);
  font-weight: 600;
  font-size: 13px;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.radio-pill.on {
  background: var(--accent);
  color: var(--accent-fg);
}
.radio-pill:not(.on):hover { color: var(--fg-0); }

.empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--fg-3);
  padding: 32px 0;
  font-size: 13px;
}

/* ========== Notes card on profile (two stacked rows) ========== */
.notes-card {
  margin-top: 22px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.notes-card__row {
  display: grid;
  grid-template-columns: 24px 1fr auto 12px;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  color: var(--fg-0);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: background var(--t-fast);
}
.notes-card__row:last-child { border-bottom: none; }
.notes-card__row:hover { background: var(--bg-2); text-decoration: none; }

.notes-card__icon {
  display: grid; place-items: center;
  width: 24px; height: 24px;
  color: var(--fg-2);
}
.notes-card__icon svg { width: 18px; height: 18px; }
.notes-card__row--mine .notes-card__icon { color: var(--brand-blue-bright); }
.notes-card__row--shared .notes-card__icon { color: var(--fg-2); }

.notes-card__title {
  font-weight: 700;
  font-size: 14px;
  color: var(--fg-0);
  letter-spacing: 0.2px;
}
.notes-card__meta {
  font-size: 12px;
  color: var(--fg-2);
  text-align: right;
  line-height: 1.3;
}
.notes-card__meta--empty { color: var(--fg-3); font-style: italic; font-weight: 500; }
.notes-card__author { color: var(--fg-1); font-weight: 600; text-transform: capitalize; }
.notes-card__time   { color: var(--fg-1); font-weight: 600; }

.notes-card__dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--bg-3);
  box-shadow: inset 0 0 0 1px var(--border-strong);
  transition: background var(--t-fast), box-shadow var(--t-fast);
}
.notes-card__row.has .notes-card__dot {
  background: #4BD37B;
  box-shadow: 0 0 8px rgba(75, 211, 123, 0.55);
}

/* Notes grid (4th nav) — small status dots in top corners */
.member-card { position: relative; }
.member-card__dots {
  position: absolute;
  top: 8px; left: 8px; right: 8px;
  display: flex; justify-content: space-between;
  pointer-events: none;
}
.member-card__dot {
  display: grid; place-items: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--bg-3);
  color: var(--fg-3);
  opacity: 0.6;
  transition: color var(--t-fast), background var(--t-fast), opacity var(--t-fast);
}
.member-card__dot svg { width: 12px; height: 12px; }
.member-card__dot.on {
  background: color-mix(in srgb, #4BD37B 25%, var(--bg-3));
  color: #4BD37B;
  opacity: 1;
}
.member-card--with-notes { padding-top: 36px; }

.section-subnav__title {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--fg-1);
}

/* Notes flag chip on member-card meta line */
.note-flag { color: var(--fg-1); font-size: 11px; }

/* Secondary subnav row (for the Has-Notes chip on Members) */
.section-subnav--secondary { margin-top: -8px; margin-bottom: 14px; }
.chip-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--fg-2);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.chip-toggle.on {
  background: color-mix(in srgb, var(--accent) 16%, var(--bg-1));
  color: var(--fg-0);
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
}
.chip-toggle:hover { color: var(--fg-1); }

/* Mine vs Shared visual differentiation on note view tabs */
.note-tab--mine, .note-tab--shared {
  display: flex; align-items: center; justify-content: center; gap: 7px;
}
.note-tab--mine svg, .note-tab--shared svg { width: 15px; height: 15px; opacity: 0.8; }
.note-tab--mine.on {
  background: color-mix(in srgb, var(--brand-blue-bright) 14%, var(--bg-2));
}
.note-tab--mine.on svg { color: var(--brand-blue-bright); opacity: 1; }
.note-view--my #note-textarea {
  background: color-mix(in srgb, var(--brand-blue-bright) 4%, var(--bg-1));
  border-color: color-mix(in srgb, var(--brand-blue-bright) 25%, var(--border));
}

/* ========== Note view ========== */
.note-view {
  display: flex; flex-direction: column;
}
.note-header {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 12px;
}
.note-header__body { min-width: 0; }
.note-header__name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 16px;
  color: var(--fg-0);
  letter-spacing: -0.3px;
}
.note-header__meta {
  color: var(--fg-2);
  font-size: 12px;
  text-transform: capitalize;
}
.note-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 12px;
}
.note-tab {
  text-align: center;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 13px;
  color: var(--fg-2);
  text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast);
}
.note-tab:hover { color: var(--fg-1); text-decoration: none; }
.note-tab.on {
  background: var(--bg-2);
  color: var(--fg-0);
}
.note-body {
  display: flex; flex-direction: column;
}
#note-textarea {
  width: 100%;
  min-height: 340px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg-0);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  padding: 16px 18px;
  resize: vertical;
}
#note-textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}
.note-status {
  margin-top: 8px;
  color: var(--fg-3);
  font-size: 12px;
}

/* ========== Password sheet ========== */
.pw-sheet { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.pw-sheet__intro {
  color: var(--fg-1);
  font-size: 13px;
  line-height: 1.5;
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.pw-sheet__input {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg-0);
  font-family: var(--font-sans);
  font-size: 15px;
  padding: 12px 14px;
  min-height: 44px;
}
.pw-sheet__input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.pw-sheet__err {
  color: #E67373;
  font-size: 13px;
  margin-top: 2px;
}
