/* Portal header: role badge/avatar + anti-FOUC (hide until session boot). */

#portal-user-header.portal-header-pending {
  visibility: hidden;
}

#portal-user-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

#user-header-account {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  align-self: center;
  min-height: 2.5rem;
  padding-top: 0;
  padding-bottom: 0;
  line-height: 1;
}

#user-header-account .uspa-role-avatar {
  align-self: center;
}

.uspa-role-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  height: 2rem;
  min-height: 2rem;
  padding: 0 0.75rem;
  border-radius: 999px;
  white-space: nowrap;
  border: 1px solid transparent;
  box-sizing: border-box;
  align-self: center;
}
.uspa-role-badge i {
  font-size: 0.7rem;
  line-height: 1;
  width: 0.875rem;
  height: 0.875rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.uspa-role-badge > span {
  line-height: 1;
  display: block;
}
@media (max-width: 639px) {
  .uspa-role-badge.is-header {
    display: none !important;
  }
}
.uspa-role-badge.tone-director {
  background: #0f172a;
  color: #fff;
  border-color: #0f172a;
}
.uspa-role-badge.tone-admin {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}
.uspa-role-badge.tone-owner {
  background: #fffbeb;
  color: #92400e;
  border-color: #fcd34d;
}
.uspa-role-badge.tone-manager {
  background: #f0f9ff;
  color: #075985;
  border-color: #7dd3fc;
}
.uspa-role-badge.tone-captain,
.uspa-role-badge.tone-captain-manager {
  background: #f5f3ff;
  color: #5b21b6;
  border-color: #c4b5fd;
}
.uspa-role-badge.tone-player {
  background: #f3f4f6;
  color: #374151;
  border-color: #e5e7eb;
}

.uspa-role-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.875rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  color: #fff;
  border: 2px solid rgba(15, 23, 42, 0.12);
  background: #1f2937;
  box-sizing: border-box;
}
.uspa-role-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.uspa-role-avatar.tone-director {
  background: #0f172a;
  border-color: rgba(15, 23, 42, 0.25);
}
.uspa-role-avatar.tone-admin {
  background: #047857;
  border-color: rgba(4, 120, 87, 0.3);
}
.uspa-role-avatar.tone-owner {
  background: #b45309;
  border-color: rgba(180, 83, 9, 0.35);
}
.uspa-role-avatar.tone-manager {
  background: #0369a1;
  border-color: rgba(3, 105, 161, 0.3);
}
.uspa-role-avatar.tone-captain,
.uspa-role-avatar.tone-captain-manager {
  background: #6d28d9;
  border-color: rgba(109, 40, 217, 0.3);
}
.uspa-role-avatar.tone-player {
  background: #1f2937;
  border-color: rgba(31, 41, 55, 0.25);
}

/* Phone / tablet / desktop portal layout (also in responsive.css). */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html,
body {
  overflow-x: clip;
  max-width: 100%;
}

img,
svg,
video,
canvas {
  max-width: 100%;
}

#portal-shell > header {
  padding-left: max(1rem, env(safe-area-inset-left, 0px));
  padding-right: max(1rem, env(safe-area-inset-right, 0px));
}

#page-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#portal-shell > main {
  min-width: 0;
}

#sidebar {
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

button,
a,
select,
summary {
  touch-action: manipulation;
}

@media (max-width: 1279px) {
  #portal-shell > header {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    gap: 0.75rem;
  }

  #portal-shell > header .flex.items-center.gap-4 {
    min-width: 0;
    gap: 0.5rem;
  }

  #page-title {
    font-size: 1.05rem;
  }

  #portal-shell > main {
    padding: 1rem;
  }

  #sidebar-toggle {
    width: 2.75rem;
    height: 2.75rem;
  }
}

@media (max-width: 767px) {
  #portal-shell > main {
    padding: 0.75rem;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }
}

#portal-shell > main .flex.items-center.justify-between,
#portal-shell > main .flex.items-end.justify-between,
#portal-shell > main .flex.items-center.gap-3,
#portal-shell > main .flex.items-center.gap-2 {
  flex-wrap: wrap;
}

#portal-shell table {
  max-width: 100%;
}

#portal-shell .overflow-x-auto {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

@media (max-width: 767px) {
  .fixed.inset-0 [role="dialog"] {
    max-width: min(100vw - 1rem, 42rem);
    max-height: min(92dvh, 56rem);
    overflow: auto;
  }
}

@media (max-width: 639px) {
  .fixed.inset-0 .relative.min-h-full {
    align-items: flex-end;
    padding: 0;
  }

  .fixed.inset-0 [role="dialog"] {
    max-width: 100%;
    max-height: 92dvh;
    border-radius: 1rem 1rem 0 0;
    margin-bottom: 0;
  }
}

@media (min-width: 768px) and (max-width: 1279px) {
  #portal-shell > main {
    padding: 1.25rem;
  }
}

@media (max-width: 767px) {
  #portal-shell select {
    max-width: 100%;
    min-width: 0;
  }

  [data-panel-content="invites"] .flex.flex-wrap.items-end > div {
    width: 100%;
  }
}
