/* 공통 셸 — 머리(기관 이름·역할), 아래 메뉴, 기관 바꾸기 시트, 코치 링. 마크업은 shell.js 가 만든다. */
body[data-chrome] {
  position: relative;
  min-height: 100vh;
}

body[data-chrome="staff"],
body[data-chrome="public"].signed-in {
  padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
}

body[data-chrome] > main.wrap {
  padding-top: 12px;
}

/* 머리 */
.app-top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  max-width: 720px;
  margin: 0 auto;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 16px 8px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
}

.org-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.org-btn .sq {
  display: grid;
  flex: none;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.8rem;
}

.org-btn #org-name-top {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.org-btn svg {
  flex: none;
  width: 12px;
  height: 12px;
}

.role-label {
  flex: none;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.app-top .pub-title {
  font-weight: 600;
}

.app-top .pub-title .mark {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-right: 8px;
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  font-family: var(--f-story);
  font-size: 0.8rem;
  vertical-align: middle;
}

.app-top #auth-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 600;
}

/* 아래 메뉴 */
.app-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  padding: 6px 6px calc(10px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.app-nav a {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-height: 52px;
  padding: 6px 0;
  color: var(--muted);
  font-size: 0.72rem;
  text-decoration: none;
}

.app-nav a svg {
  width: 22px;
  height: 22px;
}

.app-nav a[aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
}

.app-nav .badge {
  position: absolute;
  top: 2px;
  left: calc(50% + 6px);
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--seal);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 600;
}

/* 기관 바꾸기 시트 */
#org-list {
  display: grid;
  gap: 6px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

#org-list button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  margin: 0;
  text-align: left;
}

#org-list button[aria-current="true"] {
  border-color: var(--accent);
}

#org-list .hint {
  font-weight: 500;
}

#sheet-org .switch {
  margin: 4px 0 16px;
}

#sheet-org #auth-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 600;
}

/* 코치 링 (GYMotion.coach 가 body 기준 좌표로 옮긴다) */
.coach {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 45;
  border: 2px solid var(--seal);
  border-radius: 14px;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--seal) 18%, transparent);
  opacity: 0;
  pointer-events: none;
}

@media (min-width: 760px) {
  .app-nav {
    left: 50%;
    right: auto;
    width: 720px;
    transform: translateX(-50%);
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
    border-radius: 16px 16px 0 0;
  }
}
