/* ═══════════════════════════════════════
   STORIED FLAVOURS — Family
   ═══════════════════════════════════════ */

/* Family archive background */
.ic-page--family {
  position: relative;
}

.ic-page--family::before {
  content: '';
  position: fixed;
  top: var(--topbar-height);
  left: var(--sidebar-width);
  right: 0;
  bottom: 0;
  background: url('../assets/family-bg.png') center / cover no-repeat;
  opacity: 0.18;
  z-index: 0;
  pointer-events: none;
}

.ic-page--family > * {
  position: relative;
  z-index: 1;
}

/* Circle archive background */
.ic-page--circle {
  position: relative;
}

.ic-page--circle::before {
  content: '';
  position: fixed;
  top: var(--topbar-height);
  left: var(--sidebar-width);
  right: 0;
  bottom: 0;
  background: url('../assets/circle-bg.png') center / cover no-repeat;
  opacity: 0.18;
  z-index: 0;
  pointer-events: none;
}

.ic-page--circle > * {
  position: relative;
  z-index: 1;
}

/* Family overview */
.family-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-6);
  margin-bottom: var(--space-8);
  flex-wrap: wrap;
}

.family-header-info h1 {
  font-size: var(--font-size-3xl);
  margin-bottom: var(--space-1);
}

.family-header-info p {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

/* ── Archive avatar with edit overlay ── */
.family-avatar-wrapper {
  position: relative;
  flex-shrink: 0;
}

.avatar-edit-btn {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--surface-page, #fff);
  background: var(--color-terracotta);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--duration-fast);
  line-height: 1;
}

.avatar-edit-btn:hover {
  background: var(--color-brown-700);
}

/* ── Archive edit bar ── */
.archive-edit-bar {
  display: flex;
  align-items: flex-end;
  gap: var(--space-4);
  background: var(--surface-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}

.archive-edit-fields {
  display: flex;
  gap: var(--space-4);
  flex: 1;
  min-width: 200px;
}

.archive-edit-actions {
  display: flex;
  gap: var(--space-2);
  flex-shrink: 0;
}

.family-actions {
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}

/* Compact button sizing scoped to this row — global .btn is unchanged */
.family-actions .btn {
  padding: 8px 16px;
  font-size: var(--font-size-sm);
}

.members-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-5);
}

/* ── Member Tile (compact, no outer card) ── */
.member-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  text-decoration: none;
  color: inherit;
  padding: var(--space-3) var(--space-2);
  border-radius: var(--radius-lg);
  transition: background var(--duration-fast);
  cursor: pointer;
}

.member-tile:hover {
  background: rgba(141, 110, 99, 0.05);
}

.member-tile-avatar {
  margin-bottom: var(--space-3);
}

.member-tile-name {
  font-weight: 600;
  font-size: var(--font-size-sm);
  line-height: 1.3;
  margin-bottom: 2px;
}

.member-tile-relation {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}

.member-tile-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1;
}

.member-tile-stats span {
  white-space: nowrap;
}

.member-tile-since {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: var(--space-1);
}

/* Family tree */
.family-tree-container {
  overflow-x: auto;
  padding: var(--space-8) var(--space-4);
}

.family-tree {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  min-width: fit-content;
}

/* Family unit: a parent (or couple) with their children below */
.tree-family-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Couple side-by-side */
.tree-couple {
  display: flex;
  align-items: center;
  gap: 0;
}

/* ── Couple connector — vine arc ── */
.tree-couple-connector {
  width: 40px;
  height: 8px;
  position: relative;
  border-bottom: 3.5px solid var(--color-amber);
  border-radius: 0 0 50% 50%;
  background: transparent;
  box-shadow: 0 2px 4px rgba(245, 158, 11, 0.15);
}

.tree-couple-connector::after {
  content: '💛';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.12));
}

/* Node wrapper — positions the edit button */
.tree-node-wrapper {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
}

.tree-node-edit-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--surface-card, #fff);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--duration-fast), background var(--duration-fast);
  z-index: 2;
  line-height: 1;
  padding: 0;
}

.tree-node-wrapper:hover .tree-node-edit-btn {
  opacity: 1;
}

.tree-node-edit-btn:hover {
  background: var(--color-terracotta-light, #f5e0d0);
}

/* Node card — compact, no border */
.tree-node-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  text-align: center;
  min-width: 110px;
  cursor: pointer;
  transition: background var(--duration-fast);
  text-decoration: none;
  color: inherit;
}

.tree-node-card:hover {
  background: rgba(141, 110, 99, 0.05);
}

.tree-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--color-brown-700);
  margin-bottom: var(--space-2);
  overflow: hidden;
  border: 2.5px solid transparent;
  background-image: linear-gradient(var(--surface-card), var(--surface-card)),
    linear-gradient(135deg, var(--color-brown-200), var(--color-amber));
  background-origin: border-box;
  background-clip: padding-box, border-box;
}

.tree-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.tree-node-name {
  font-weight: 600;
  font-size: var(--font-size-xs);
  line-height: 1.3;
}

.tree-node-relation {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 1px;
}

.tree-node-stats {
  display: flex;
  gap: var(--space-2);
  font-size: 10px;
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

/* ═══════════════════════════════════════
   SVG Bezier Branch Connectors
   ═══════════════════════════════════════ */

/* Container that holds the SVG — sits between parent and children in flex flow */
.tree-branches-container {
  width: 100%;
  height: 80px;
  position: relative;
  align-self: stretch;
}

/* The SVG element fills its container */
.tree-svg-branches {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

/* Stroke draw-in animation */
@keyframes drawBranch {
  to {
    stroke-dashoffset: 0;
  }
}

/* Fade-in for knots and buds */
@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

/* ── Children row ── */
.tree-children {
  display: flex;
  justify-content: center;
  gap: var(--space-8);
}

.tree-child-branch {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Not Yet Placed section */
.tree-unlinked-section {
  margin-top: var(--space-10);
  padding-top: var(--space-8);
  border-top: 1px dashed var(--border-light);
}

.tree-unlinked-section h2 {
  font-size: var(--font-size-xl);
  margin-bottom: var(--space-2);
  color: var(--text-muted);
}

.tree-unlinked-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-5);
}

.tree-unlinked-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}

.tree-unlinked-card .tree-node-card {
  border-style: dashed;
}

.tree-place-btn {
  font-size: var(--font-size-xs) !important;
}

/* Member profile */
.member-profile {
  max-width: 800px;
  margin: 0 auto;
}

.member-hero {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  margin-bottom: var(--space-8);
  flex-wrap: wrap;
}

.member-info h1 {
  font-size: var(--font-size-3xl);
  margin-bottom: var(--space-1);
}

.member-relation {
  color: var(--color-terracotta);
  font-weight: 600;
  font-size: var(--font-size-sm);
  margin-bottom: var(--space-3);
}

.member-bio {
  color: var(--text-secondary);
  line-height: 1.7;
  font-size: var(--font-size-base);
}

.member-section {
  margin-bottom: var(--space-8);
}

.member-section h2 {
  font-size: var(--font-size-xl);
  margin-bottom: var(--space-5);
}

.member-contributions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-4);
}

/* ── Family Tree Page ── */
.family-tree-page {
  position: relative;
}

.family-tree-page--family::before {
  content: '';
  position: fixed;
  top: var(--topbar-height);
  left: var(--sidebar-width);
  right: 0;
  bottom: 0;
  background: url('../assets/family-tree-bg.png') center / cover no-repeat;
  opacity: 0.18;
  pointer-events: none;
  z-index: 0;
}

.family-tree-page--family > * {
  position: relative;
  z-index: 1;
}

/* ── Member Profile Page ── */
.member-profile {
  position: relative;
}

.member-profile--family::before {
  content: '';
  position: fixed;
  top: var(--topbar-height);
  left: var(--sidebar-width);
  right: 0;
  bottom: 0;
  background: url('../assets/members-family-bg.png') center / cover no-repeat;
  opacity: 0.18;
  pointer-events: none;
  z-index: 0;
}

.member-profile--family > *,
.member-profile--circle > * {
  position: relative;
  z-index: 1;
}

.member-profile--circle::before {
  content: '';
  position: fixed;
  top: var(--topbar-height);
  left: var(--sidebar-width);
  right: 0;
  bottom: 0;
  background: url('../assets/members-circle-bg.png') center / cover no-repeat;
  opacity: 0.18;
  pointer-events: none;
  z-index: 0;
}

/* ── Members Management Page ── */
.members-page {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-5);
  position: relative;
}

.members-page--family::before {
  content: '';
  position: fixed;
  top: var(--topbar-height);
  left: var(--sidebar-width);
  right: 0;
  bottom: 0;
  background: url('../assets/members-family-bg.png') center / cover no-repeat;
  opacity: 0.18;
  pointer-events: none;
  z-index: 0;
}

.members-page--family > *,
.members-page--circle > * {
  position: relative;
  z-index: 1;
}

.members-page--circle::before {
  content: '';
  position: fixed;
  top: var(--topbar-height);
  left: var(--sidebar-width);
  right: 0;
  bottom: 0;
  background: url('../assets/members-circle-bg.png') center / cover no-repeat;
  opacity: 0.18;
  pointer-events: none;
  z-index: 0;
}

.members-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
  flex-wrap: wrap;
}

.members-header h1 {
  margin-bottom: var(--space-1);
}

.members-header-actions {
  display: flex;
  gap: var(--space-3);
  align-items: center;
}

.member-list {
  display: flex;
  flex-direction: column;
}

.member-list-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-light);
  transition: background var(--duration-fast);
}

.member-list-item:hover {
  background: rgba(141, 110, 99, 0.03);
}

.member-list-item:last-child {
  border-bottom: none;
}

.member-list-item-info {
  flex: 1;
  min-width: 0;
}

.member-list-item-name {
  font-weight: 600;
  font-size: var(--font-size-sm);
}

.member-list-item-role {
  margin-top: 2px;
}

.members-empty-hint {
  padding: var(--space-6) var(--space-4);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

.members-empty-hint .btn {
  margin-top: var(--space-3);
}

/* Member action bottom sheet */
.member-action-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.member-action-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: none;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: inherit;
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  width: 100%;
  text-align: left;
  transition: background var(--duration-fast);
}

.member-action-option:hover {
  background: var(--surface-card);
}

.member-action-danger {
  color: var(--color-red);
}

.member-action-btn {
  font-size: var(--font-size-lg);
  color: var(--text-muted);
  cursor: pointer;
}

/* Role selector in modal */
.role-selector {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* ── Pending Invites ── */
.invite-list {
  display: flex;
  flex-direction: column;
}

.invite-list-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-light);
}

.invite-list-item:last-child {
  border-bottom: none;
}

.invite-list-item-info {
  flex: 1;
  min-width: 0;
}

.invite-list-item-contact {
  font-weight: 600;
  font-size: var(--font-size-sm);
}

.invite-list-item-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: 2px;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.invite-list-item-actions {
  display: flex;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* ── Invite Flow Page ── */
.invite-page {
  max-width: 600px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-5);
  position: relative;
}

.invite-page::before {
  content: '';
  position: fixed;
  top: var(--topbar-height);
  left: var(--sidebar-width);
  right: 0;
  bottom: 0;
  background: url('../assets/invite-bg.png') center / cover no-repeat;
  opacity: 0.18;
  pointer-events: none;
  z-index: 0;
}

.invite-page > * {
  position: relative;
  z-index: 1;
}

.invite-contact-tabs {
  display: flex;
  gap: var(--space-2);
  border-bottom: 1px solid var(--border-light);
  padding-bottom: var(--space-2);
}

.invite-tab {
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: color var(--duration-fast), border-color var(--duration-fast);
}

.invite-tab:hover {
  color: var(--text-primary);
}

.invite-tab.active {
  color: var(--color-amber-dark);
  border-bottom-color: var(--color-amber);
}

.invite-tab.disabled,
.invite-tab:disabled {
  color: var(--text-muted);
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.invite-tab.disabled:hover,
.invite-tab:disabled:hover {
  color: var(--text-muted);
}

.invite-tab.disabled.active,
.invite-tab:disabled.active {
  color: var(--text-muted);
  border-bottom-color: transparent;
}

/* ── Invite Success ── */
.invite-success {
  text-align: center;
  padding: var(--space-16) var(--space-6);
  max-width: 500px;
  margin: 0 auto;
}

.invite-success h2 {
  margin-bottom: var(--space-3);
}

/* ── Phone Input Group ── */
.phone-input-group {
  display: flex;
  gap: var(--space-2);
  align-items: stretch;
}

.phone-input-group .form-input {
  flex: 1;
  min-width: 0;
}

/* ── Country Selector ── */
.phone-country-select {
  flex-shrink: 0;
  padding: var(--space-2) var(--space-8) var(--space-2) var(--space-3);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  background: var(--surface-card);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  font-family: inherit;
  cursor: pointer;
  height: 44px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238D6E63' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  transition: border-color var(--duration-fast);
}

.phone-country-select:focus {
  border-color: var(--color-amber);
  outline: none;
}

/* ── Privacy Note ── */
.invite-privacy-note {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-top: var(--space-3);
  line-height: 1.6;
}

/* ── Inline field error ── */
.invite-field-error {
  font-size: var(--font-size-xs);
  color: #E53E3E;
  margin-top: var(--space-2);
  min-height: 1em;
}

/* ── Status label in invite list ── */
.invite-status-label {
  color: var(--text-muted);
  font-size: var(--font-size-xs);
}

/* ── Cooldown disabled resend button ── */
.invite-cooldown-btn {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-family: inherit;
  color: var(--color-amber-dark);
  background: var(--color-amber-light, #FEF3C7);
  border: 1px solid rgba(245, 158, 11, 0.25);
  cursor: not-allowed;
  opacity: 0.9;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .members-header {
    flex-direction: column;
  }

  .members-header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .invite-list-item {
    flex-wrap: wrap;
  }

  .invite-list-item-actions {
    width: 100%;
    justify-content: flex-end;
    margin-top: var(--space-2);
    flex-wrap: wrap;
    gap: var(--space-1);
  }

  .phone-input-group {
    flex-direction: column;
  }

  .phone-country-select {
    width: 100%;
  }
}

/* ═══════════════════════════════════════
   INNER CIRCLE — Page background
   ═══════════════════════════════════════ */

.ic-page {
  min-height: 100vh;
  margin: calc(-1 * var(--space-8));
  padding: var(--space-8);
}

.ic-page--family {
  background: var(--surface-page);
}

.ic-page--circle {
  background: var(--surface-page);
}

.ic-page .ic-empty { color: rgba(255, 255, 255, 0.70); }

@media (max-width: 768px) {
  .ic-page {
    margin: calc(-1 * var(--space-5));
    padding: var(--space-5);
  }
}

/* ═══════════════════════════════════════
   INNER CIRCLE — Type-aware views
   ═══════════════════════════════════════ */

/* ── Archive name row with type chip ── */

.ic-archive-name-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.ic-archive-name-row h1 {
  margin-bottom: 0;
}

.ic-type-chip {
  display: inline-flex;
  align-items: center;
  font-size: var(--font-size-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  flex-shrink: 0;
}

.ic-type-chip--family {
  background: var(--color-terracotta-light);
  color: var(--color-terracotta);
}

.ic-type-chip--circle {
  background: var(--color-sage-light);
  color: var(--color-sage);
}

/* ── Shared group layout (Family + Circle) ── */

.ic-family-groups,
.ic-circle-roster {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

.ic-group,
.ic-roster-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.ic-group-header,
.ic-roster-group-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-light);
}

.ic-group-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.ic-group-label {
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ic-roster-group-label {
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ic-group-count {
  margin-left: auto;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  background: rgba(141, 110, 99, 0.08);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

/* ── Member row (shared by family + circle) ── */

.ic-group-members {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.ic-member-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: background var(--duration-fast);
}

.ic-member-row:hover {
  background: rgba(141, 110, 99, 0.06);
}

.ic-member-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: var(--font-size-sm);
  overflow: hidden;
  flex-shrink: 0;
}

.ic-member-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ic-member-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ic-member-name {
  font-weight: 600;
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ic-member-meta {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

/* ── Empty state ── */

.ic-empty {
  text-align: center;
  padding: var(--space-12) var(--space-8);
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}

.ic-empty-icon {
  font-size: 3rem;
}

/* ── Topbar archive type chip ── */

.topbar-archive-type-chip {
  display: inline-flex;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  line-height: 1.4;
  flex-shrink: 0;
}

.topbar-archive-type-chip--family {
  background: var(--color-terracotta-light);
  color: var(--color-terracotta);
}

.topbar-archive-type-chip--circle {
  background: var(--color-sage-light);
  color: var(--color-sage);
}

@media (max-width: 480px) {
  .ic-archive-name-row {
    gap: var(--space-2);
  }
  .ic-type-chip {
    font-size: 9px;
  }
}

/* ═══════════════════════════════════════
   Inner Circle — Two-column layout
   ═══════════════════════════════════════ */

.ic-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--space-8);
  align-items: start;
}

.ic-main-col {
  min-width: 0;
}

.ic-preview-col {
  min-width: 0;
  /* Push panel top to align with the action buttons row in the left column.
     avatar-2xl (120px) + family-header margin-bottom (--space-8 = 32px) = 152px */
  margin-top: calc(120px + var(--space-8));
  /* Sticky so the panel stays visible while scrolling the member list */
  position: sticky;
  top: calc(var(--topbar-height, 64px) + var(--space-6));
}

@media (max-width: 960px) {
  .ic-layout {
    grid-template-columns: 1fr;
  }
  .ic-preview-col {
    position: static;
    margin-top: 0; /* No offset when stacked — panel follows members naturally */
    order: 2; /* Members remain primary on mobile */
  }
}

/* ═══════════════════════════════════════
   Conversation Preview Panel
   ═══════════════════════════════════════ */

.conv-preview-panel {
  background: var(--surface-card);
  border: 1px solid var(--color-brown-100);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.conv-preview-header {
  border-bottom: 1px solid var(--color-brown-100);
  padding-bottom: var(--space-3);
}

.conv-preview-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 var(--space-1);
}

.conv-preview-sub {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin: 0;
  line-height: 1.6;
}

/* Thread preview rows */
.conv-preview-threads {
  display: flex;
  flex-direction: column;
}

.conv-preview-thread-item {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-2);
  border-bottom: 1px solid var(--color-brown-100);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: background 0.15s;
}

.conv-preview-thread-item:hover {
  background: var(--color-brown-50, #faf7f4);
}

.conv-preview-thread-item:last-child {
  border-bottom: none;
  padding-bottom: var(--space-2);
}

.conv-preview-thread-avatar {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  background: var(--color-terracotta-light);
  color: var(--color-terracotta);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xs);
  font-weight: 700;
  flex-shrink: 0;
}

.conv-preview-thread-name {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.conv-preview-thread-preview {
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  margin: 0 0 2px;
  line-height: 1.5;
}

.conv-preview-thread-meta {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

/* Resurfaced conversation card — a clickable doorway back into the original thread */
.conv-resurface-card {
  display: block;
  background: var(--color-amber-light);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s, background 0.15s;
  cursor: pointer;
}

.conv-resurface-card:hover {
  background: var(--color-amber-light);
  box-shadow: 0 0 0 2px var(--color-amber-dark);
}

/* Temporal label — sentence case, softer than uppercase to feel like a memory cue */
.conv-resurface-label {
  display: block;
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-amber-dark);
  letter-spacing: 0.02em;
  margin-bottom: var(--space-2);
}

/* Memory intro — "You were talking about…" */
.conv-resurface-intro {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  font-weight: 500;
  margin: 0 0 var(--space-2);
  line-height: 1.5;
}

/* Pull-quote excerpt from the opening message */
.conv-resurface-excerpt {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  font-style: italic;
  margin: 0 0 var(--space-3);
  line-height: 1.55;
}

/* Action affordance */
.conv-resurface-cta {
  display: inline-block;
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-amber-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Actions */
.conv-preview-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  align-items: flex-start;
}

.conv-open-link {
  font-size: var(--font-size-sm);
  color: var(--color-amber-dark);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s;
}

.conv-open-link:hover {
  color: var(--color-brown-700);
  text-decoration: underline;
}

/* ── Broken / expired invite error panel ──────────────────────────────────── */

.invite-error-panel {
  padding: var(--space-5) var(--space-5);
  background: rgba(200, 90, 31, 0.05);
  border: 1px solid rgba(200, 90, 31, 0.18);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.invite-error-heading {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.invite-error-body {
  font-size: var(--font-size-sm);
  color: var(--text-secondary, var(--text-muted));
  margin: 0;
}

.invite-error-next-step {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin: 0;
}

.invite-error-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-top: var(--space-2);
}

.invite-error-cam-btn {
  background: var(--color-amber-dark, #C85A1F);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  padding: var(--space-2) var(--space-5);
  font-size: var(--font-size-xs);
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s;
}

.invite-error-cam-btn:hover {
  opacity: 0.88;
}

.invite-error-help-link {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s;
}

.invite-error-help-link:hover {
  color: var(--color-amber-dark, #C85A1F);
}
