:root {
  --pat-global-nav-height: 58px;
  --pat-global-nav-bg: #10283f;
  --pat-global-nav-ink: #dce6ef;
  --pat-global-nav-muted: #aebdcc;
  --pat-global-nav-active: #ffe58a;
}

.pat-global-header,
.pat-global-header * {
  box-sizing: border-box;
}

.pat-global-header {
  position: sticky;
  z-index: 75;
  top: 0;
  display: block;
  width: 100%;
  height: var(--pat-global-nav-height);
  min-height: var(--pat-global-nav-height);
  border-bottom: 1px solid rgba(255, 255, 255, .11);
  background: rgba(16, 40, 63, .985);
  box-shadow: 0 4px 18px rgba(8, 24, 40, .14);
  color: var(--pat-global-nav-ink);
  font-family: "Segoe UI", "Malgun Gothic", Arial, sans-serif;
}

.pat-global-header__inner {
  display: flex;
  width: min(100%, 1600px);
  height: 100%;
  align-items: center;
  gap: clamp(.8rem, 1.7vw, 1.7rem);
  margin: 0 auto;
  padding: 0 clamp(.9rem, 2.2vw, 2.2rem);
}

.pat-global-brand {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: baseline;
  color: #fff;
  font: 800 1.28rem/1 Georgia, "Times New Roman", serif;
  letter-spacing: -.035em;
  text-decoration: none;
}

.pat-global-brand strong {
  color: var(--pat-global-nav-active);
  font: inherit;
}

.pat-global-nav {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  align-items: center;
  gap: .12rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-color: rgba(255, 255, 255, .25) transparent;
  scrollbar-width: thin;
}

.pat-global-nav__link {
  display: inline-flex;
  min-height: 34px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: .46rem .61rem;
  color: var(--pat-global-nav-muted);
  font-size: .69rem;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.pat-global-nav__link.pat-global-nav__group-start {
  margin-left: .34rem;
  border-left-color: rgba(255, 255, 255, .18);
  border-radius: 0 7px 7px 0;
}

.pat-global-nav__link:hover {
  border-color: rgba(255, 255, 255, .15);
  background: rgba(255, 255, 255, .08);
  color: #fff;
}

.pat-global-nav__link[aria-current="page"] {
  border-color: var(--pat-global-nav-active);
  background: var(--pat-global-nav-active);
  color: #10243a;
}

.pat-global-auth {
  display: flex;
  min-width: 0;
  flex: 0 0 auto;
  align-items: center;
  gap: .38rem;
  border-left: 1px solid rgba(255, 255, 255, .16);
  padding-left: .75rem;
  color: var(--pat-global-nav-muted);
  white-space: nowrap;
}

.pat-global-auth__dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #92a2b0;
  box-shadow: 0 0 0 3px rgba(174, 189, 204, .1);
}

.pat-global-auth[data-state="authenticated"] .pat-global-auth__dot {
  background: #65d49a;
  box-shadow: 0 0 0 3px rgba(101, 212, 154, .12);
}

.pat-global-auth[data-state="pending"] .pat-global-auth__dot {
  background: #ffe58a;
  animation: pat-global-auth-pulse 1.1s ease-in-out infinite;
}

.pat-global-auth[data-state="failed"] .pat-global-auth__dot {
  background: #ff8c84;
}

.pat-global-auth__account {
  max-width: 150px;
  overflow: hidden;
  font-size: .65rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pat-global-auth button {
  min-height: 28px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 6px;
  padding: .36rem .5rem;
  background: rgba(255, 255, 255, .07);
  color: #e6eef5;
  font: 800 .61rem/1 "Segoe UI", "Malgun Gothic", Arial, sans-serif;
  cursor: pointer;
}

.pat-global-auth button:hover:not(:disabled) {
  border-color: rgba(255, 229, 138, .65);
  background: rgba(255, 255, 255, .14);
  color: #fff;
}

.pat-global-auth button:disabled {
  cursor: default;
  opacity: .48;
}

.pat-global-auth [hidden] {
  display: none !important;
}

.pat-global-auth[data-locked="true"] {
  opacity: .72;
}

@keyframes pat-global-auth-pulse {
  50% { opacity: .35; }
}

.pat-global-brand:focus-visible,
.pat-global-nav__link:focus-visible,
.pat-global-auth button:focus-visible {
  outline: 3px solid rgba(255, 229, 138, .5);
  outline-offset: 2px;
}

/* 이전 페이지별 메뉴는 공통 메뉴가 대체합니다. */
header.site-header,
body > header.platform-header,
.pat-platform-header {
  display: none !important;
}

/* 작업공간 전용 버튼은 두 번째 도구막대에 그대로 남깁니다. */
.teampro-header .teampro-brand,
.teampro-header .teampro-nav,
.ps-header .ps-brand,
.ps-header .ps-nav,
.active-header .active-brand,
.active-header .active-nav a {
  display: none !important;
}

body.page-teampro .teampro-shell {
  height: calc(100% - var(--pat-global-nav-height));
}

.ps-shell {
  min-height: calc(100vh - var(--pat-global-nav-height));
  height: calc(100vh - var(--pat-global-nav-height));
}

body.page-active #active-root {
  height: calc(100% - var(--pat-global-nav-height));
}

#root .app-shell {
  min-height: calc(100vh - var(--pat-global-nav-height));
}

#root .topbar {
  top: var(--pat-global-nav-height);
}

html {
  scroll-padding-top: calc(var(--pat-global-nav-height) + .75rem);
}

@media (max-width: 1180px) {
  .pat-global-header__inner { padding-inline: .85rem; }
  .pat-global-nav__link { padding-inline: .52rem; font-size: .66rem; }
  .pat-global-auth__account { display: none; }
  .pat-global-auth { padding-left: .55rem; }
}

@media (max-width: 680px) {
  :root { --pat-global-nav-height: 54px; }
  .pat-global-header__inner { gap: .58rem; padding-inline: .7rem; }
  .pat-global-brand { font-size: 1.08rem; }
  .pat-global-nav__link { min-height: 32px; padding: .42rem .48rem; font-size: .64rem; }
  .pat-global-nav__link.pat-global-nav__group-start { margin-left: .18rem; }
  .pat-global-auth { gap: .28rem; padding-left: .4rem; }
  .pat-global-auth__dot { display: none; }
  .pat-global-auth button { min-height: 26px; padding-inline: .38rem; font-size: .57rem; }
}

@media (prefers-reduced-motion: reduce) {
  .pat-global-header *,
  .pat-global-header *::before,
  .pat-global-header *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
