.friends-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.friends-header-actions {
  display: flex;
  gap: 0.6rem;
}

.friends-banner {
  margin: 0 auto 1rem;
  max-width: 78rem;
  padding: 0.75rem 0.95rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.05);
}

.friends-banner.warning {
  border-color: rgba(255, 193, 7, 0.45);
  color: #ffd24a;
  background: rgba(255, 193, 7, 0.12);
}

.friends-banner.danger {
  border-color: rgba(239, 68, 68, 0.5);
  color: #fecaca;
  background: rgba(239, 68, 68, 0.14);
}

.friends-layout {
  max-width: 78rem;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 380px);
  gap: 1.2rem;
  align-items: start;
}

.friends-map-panel {
  position: sticky;
  top: 1rem;
}

.friends-map-toolbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

.friends-map-toolbar h2 {
  margin: 0;
  font-size: 1.15rem;
}

.friends-map {
  height: min(56vh, 520px);
  border-radius: 0.85rem;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.friends-map .leaflet-marker-icon.friends-map-marker,
.friends-map .leaflet-div-icon.friends-map-marker {
  background: transparent !important;
  border: 0 !important;
}

.friends-map .leaflet-marker-icon.friends-map-canvas-marker {
  /* Keep baked retina PNGs crisp while Leaflet positions the marker. */
  image-rendering: auto;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* Route pane 450, markers 600 — plane always above the gold route. */
.friends-map .leaflet-friendsRoutePane {
  z-index: 450 !important;
}

.friends-map .leaflet-marker-pane {
  z-index: 600 !important;
}

.friends-map-route-svg {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  overflow: hidden;
  /* auto preserves browser anti-aliasing; crispEdges would stair-step. */
  shape-rendering: auto;
}

.friends-map-footnote {
  margin-top: 0.6rem;
  color: #94a3b8;
  font-size: 0.82rem;
}

.friends-side-panel {
  min-width: 0;
  min-height: 420px;
  overflow: visible;
  box-sizing: border-box;
}

.friends-tabs {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0.35rem;
  margin: 0.35rem 0 0.95rem;
  padding: 0.55rem 0.55rem 0 0;
  min-width: 0;
  overflow: visible;
}

.friends-tabs .tab {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  border-radius: 0.7rem;
  padding: 0.55rem 0.4rem;
  margin-right: 0;
  cursor: pointer;
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
  text-align: center;
  line-height: 1.25;
  overflow: visible;
}

.friends-tabs .tab[data-friends-tab="friends"],
.friends-tabs .tab[data-friends-tab="requests"] {
  flex: 0.85 1 0;
}

.friends-tabs .tab[data-friends-tab="crossings"] {
  flex: 1.45 1 0;
}

.friends-tabs .tab .tab-label {
  display: block;
  overflow: visible;
  text-overflow: clip;
}

.friends-tabs .tab.active {
  border-color: rgba(255, 193, 7, 0.45);
  color: #351c15;
  background: #ffc107;
}

/* Anchored to the tab corner, then shifted outside so it clears the label */
.friends-tabs .tab-badge {
  position: absolute !important;
  top: 0;
  right: 0;
  z-index: 3;
  display: inline-flex;
  min-width: 1.3rem;
  height: 1.3rem;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0 0.32rem;
  border-radius: 999px;
  border: 2px solid rgba(28, 18, 14, 0.95);
  background: #ffc107;
  color: #351c15;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  transform: translate(42%, -52%);
}

.friends-tabs .tab.active .tab-badge {
  border-color: #ffc107;
  background: #351c15;
  color: #ffd24a;
}

.friends-tabs .tab-badge[hidden] {
  display: none !important;
}

.friends-side-panel .tab-content,
.friends-side-panel .friends-list {
  max-width: 100%;
  overflow-x: hidden;
}

.friends-subheading {
  margin: 1rem 0 0.55rem;
  font-size: 0.9rem;
  color: #e2e8f0;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.friends-search-row {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
}

.friends-search-row label {
  color: #94a3b8;
  font-size: 0.83rem;
}

.friends-list {
  display: grid;
  gap: 0.55rem;
  min-width: 0;
  max-width: 100%;
}

.friend-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 0.8rem;
  padding: 0.62rem 0.68rem;
}

.friend-row.main-action {
  cursor: pointer;
}

.friend-row:hover {
  background: rgba(255, 255, 255, 0.06);
}

.friend-row-copy {
  min-width: 0;
  flex: 1;
}

.friend-row-name {
  color: #fff;
  font-weight: 600;
  font-size: 0.93rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.friend-row-meta {
  color: #94a3b8;
  font-size: 0.8rem;
}

.crossing-card {
  align-items: stretch;
  padding: 0.9rem 0.85rem;
  background:
    linear-gradient(180deg, rgba(255, 193, 7, 0.05), rgba(255, 255, 255, 0.02) 42%),
    rgba(255, 255, 255, 0.03);
}

.crossing-card-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.crossing-card .friend-row-name {
  flex: 1 1 auto;
  min-width: 0;
  padding-right: 0.25rem;
}

.crossing-dismiss {
  flex-shrink: 0;
  margin-left: auto;
  padding: 0.36rem 0.62rem !important;
  font-size: 0.72rem !important;
}

.crossing-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.75rem;
  margin-top: 0.55rem;
  min-width: 0;
}

.crossing-airport {
  flex-shrink: 0;
  padding: 0.18rem 0.5rem;
  border-radius: 0.4rem;
  border: 1px solid rgba(255, 193, 7, 0.35);
  background: rgba(255, 193, 7, 0.12);
  color: #ffd24a;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.crossing-meta-sep {
  color: #64748b;
  font-size: 0.8rem;
  line-height: 1;
  user-select: none;
}

.crossing-relative {
  color: #94a3b8;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.crossing-relative.is-now {
  padding: 0.14rem 0.48rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 193, 7, 0.45);
  background: rgba(255, 193, 7, 0.16);
  color: #ffd24a;
  letter-spacing: 0.05em;
}

.crossing-when {
  margin-top: 0.5rem;
  color: #e2e8f0;
  font-size: 0.84rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  line-height: 1.4;
}

.crossing-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.6rem;
  min-width: 0;
}

.crossing-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 0.18rem 0.48rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(148, 163, 184, 0.1);
  color: #cbd5e1;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
}

.crossing-chip-duration {
  border-color: rgba(255, 193, 7, 0.3);
  background: rgba(255, 193, 7, 0.1);
  color: #ffe08a;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
}

.friend-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}

.friend-row-actions .btn {
  padding: 0.42rem 0.58rem;
  font-size: 0.75rem;
}

.muted {
  color: #94a3b8;
}

.small {
  font-size: 0.8rem;
}

.privacy-toggle-wrap {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.privacy-toggle-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.avatar-fallback {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  background: rgba(255, 193, 7, 0.28);
  color: #351c15;
  border: 1px solid rgba(255, 193, 7, 0.45);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex: 0 0 auto;
  overflow: hidden;
}

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

.avatar-lg {
  width: 3.1rem;
  height: 3.1rem;
  font-size: 1rem;
}

.friend-profile-card {
  max-width: 78rem;
  margin: 0 auto 1rem;
}

.friend-profile-header {
  display: flex;
  gap: 0.8rem;
  align-items: center;
}

.friend-profile-copy h1 {
  margin: 0;
  font-size: 1.45rem;
}

.friend-profile-copy p {
  margin-top: 0.25rem;
}

.friend-actions {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.schedule-day {
  margin-top: 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 0.8rem;
  overflow: hidden;
}

.schedule-day-header {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  padding: 0.58rem 0.7rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.schedule-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 0.7rem;
  padding: 0.58rem 0.7rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.schedule-row-time {
  color: #fbbf24;
  font-size: 0.82rem;
  white-space: nowrap;
}

.schedule-row-title {
  color: #f8fafc;
  font-size: 0.9rem;
}

.schedule-row-sub {
  color: #94a3b8;
  font-size: 0.8rem;
}

@media (max-width: 1100px) {
  .friends-layout {
    grid-template-columns: 1fr;
  }

  .friends-map-panel {
    position: static;
  }

  .friends-side-panel {
    min-height: auto;
  }
}

@media (max-width: 768px) {
  .friends-map {
    height: 38vh;
    min-height: 240px;
  }
}
