/* ===== 전 페이지 공통 셸: 다크 상단바 · 좌측 사이드바 · 본문 컨테이너 ===== */

/* 페이지 이동 시 사이드바/상단바는 그대로 두고 본문만 바뀌는 것처럼 보이게 한다 */
@view-transition {
  navigation: auto;
}

.sidebar {
  view-transition-name: shell-sidebar;
}

.topbar {
  view-transition-name: shell-topbar;
}

::view-transition-old(shell-sidebar),
::view-transition-new(shell-sidebar),
::view-transition-old(shell-topbar),
::view-transition-new(shell-topbar) {
  animation: none;
  mix-blend-mode: normal;
  height: 100%;
  overflow: clip;
}

::view-transition-group(shell-sidebar),
::view-transition-group(shell-topbar) {
  animation-duration: 0s;
}

/* ===== 상단 바 ===== */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: var(--topbar-h);
  padding: 0 20px;
  background: #111111;
  color: #f8fbff;
  border-bottom: 1px solid #1a1a1a;
}

.topbar__menu {
  display: none;
  width: 32px; height: 32px;
  align-items: center; justify-content: center;
  border-radius: 10px;
  color: #d5d8de;
}
.topbar__menu:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.topbar__menu svg { width: 20px; height: 20px; stroke-width: 2; }

.topbar__dot {
  display: grid;
  place-items: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
}
.topbar__dot svg { width: 16px; height: 16px; stroke-width: 2; }

.topbar__title { font-size: 15px; font-weight: 800; letter-spacing: -.3px; color: #f4f5f7; }
.topbar__home {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #f4f5f7;
  font-size: 15px;
  font-weight: 800;
  text-decoration: none;
}
.topbar__spacer { flex: 1; }

.topbar__auth {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.topbar__user {
  max-width: 88px;
  overflow: hidden;
  color: #c8ccd3;
  font-size: 12.5px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.topbar__btn--ghost {
  border: 1px solid #5a5f68;
  color: #f4f5f7;
  background: transparent;
}
.topbar__btn--ghost:hover {
  background: rgba(255, 255, 255, .08);
  border-color: #8b9098;
  color: #fff;
}

.topbar__btn--primary {
  background: var(--primary);
  color: #fff;
}
.topbar__btn--primary:hover { background: var(--primary-dark); }

.topbar__icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 10px;
  color: #d5d8de;
}
.topbar__icon:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.topbar__icon svg { width: 19px; height: 19px; }

.topbar__badge {
  position: absolute;
  top: 3px; right: 3px;
  min-width: 15px;
  padding: 0 4px;
  border-radius: 9px;
  background: #ff4d4f;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
}
.topbar__badge[hidden] { display: none !important; }

.notice-pop {
  position: fixed;
  z-index: 60;
  width: min(360px, calc(100vw - 24px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-lg);
  color: var(--text);
}
.notice-pop[hidden] { display: none !important; }
.notice-pop__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--line);
}
.notice-pop__head strong {
  font-size: 13.5px;
  font-weight: 800;
}
.notice-pop__all {
  border: 0;
  background: none;
  color: var(--primary);
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.notice-pop__list {
  max-height: min(420px, 70vh);
  overflow: auto;
}
.notice-pop__empty {
  padding: 28px 16px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}
.notice-pop__item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  text-align: left;
  cursor: pointer;
}
.notice-pop__item:last-child { border-bottom: 0; }
.notice-pop__item:hover { background: #f8fbff; }
.notice-pop__dot {
  width: 8px;
  height: 8px;
  flex: none;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--primary);
}
.notice-pop__dot.is-off { background: #d5dbe7; }
.notice-pop__copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 3px;
}
.notice-pop__title {
  overflow: hidden;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.35;
  word-break: keep-all;
}
.notice-pop__meta {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

/* ===== 레이아웃 ===== */
.layout {
  display: grid;
  width: 100%;
  height: calc(100% - var(--topbar-h));
  margin-top: var(--topbar-h);
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  align-items: stretch;
  overflow: hidden;
}

/* ===== 사이드바 ===== */
.sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-w);
  max-width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100%;
  padding: 12px 10px 10px;
  background: #f3f8ff;
  border-right: 1px solid var(--line);
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: flex-start;
  flex: none;
  gap: 8px;
  padding: 2px 8px 10px;
}
.brand__mark {
  display: grid;
  place-items: center;
  width: 26px; height: 26px;
  flex: none;
  margin-top: 1px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
}
.brand__mark svg { width: 17px; height: 17px; stroke-width: 1.9; }
.brand__copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.brand__text {
  color: var(--primary);
  font-size: 14.5px;
  font-weight: 800;
  letter-spacing: -.4px;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: anywhere;
}
.brand__text b { color: inherit; font-weight: 800; }
.brand__sub {
  min-height: 0;
  color: #1e293b;
  font-size: 11.5px;
  font-weight: 800;
  line-height: 1.5;
  letter-spacing: -.3px;
  overflow-wrap: anywhere;
}

.nav { flex: 1; min-height: 0; overflow: hidden; }
.nav__list { display: flex; flex-direction: column; gap: 2px; }

.nav__divider {
  height: 1px;
  margin: 5px 8px;
  border: 0;
  background: var(--line);
}

.nav__link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border-radius: 12px;
  color: #0f172a;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -.2px;
  text-align: left;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  box-shadow: none;
  transition: background .14s, color .14s;
}
.nav__link:hover:not(.is-active) { background: #dbeafe; color: var(--primary-dark); }
.nav__link.is-active,
.nav__link.is-active:hover,
.nav__link.is-active:active,
.nav__link.is-active:focus,
.nav__link.is-active:focus-visible {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 800;
}
.nav__link:focus,
.nav__link:focus-visible,
.nav__link:active {
  outline: none;
  box-shadow: none;
}
.nav__link span { flex: 1; min-width: 0; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav__link.is-locked {
  opacity: .48;
}
.nav__link.is-locked:hover:not(.is-active) { background: #f1f5f9; color: #64748b; }
.nav__icon { width: 18px; height: 18px; flex: none; color: #3b6fd4; stroke-width: 2; }
.nav__link:hover:not(.is-active) .nav__icon { color: var(--primary); }
.nav__link.is-active .nav__icon,
.nav__link.is-active:hover .nav__icon,
.nav__link.is-active:active .nav__icon {
  color: var(--primary);
}

.nav__link--quiet { color: #0f172a; font-size: 14.5px; font-weight: 700; }

.nav__guest-hint {
  margin: 0 10px 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.45;
}

.sidebar__foot {
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.scrim {
  position: fixed;
  inset: var(--topbar-h) 0 0;
  z-index: 29;
  background: rgba(23, 29, 43, .42);
}

/* ===== 본문 컨테이너 ===== */
.main {
  min-width: 0;
  height: 100%;
  padding: 22px 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: var(--bg);
  overflow-x: hidden;
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

@media (min-width: 861px) {
  :root { --sidebar-w: 268px; }
  .brand__text { font-size: 15px; line-height: 1.4; }
  .brand__sub { font-size: 12.5px; line-height: 1.45; }
  .nav__link { padding: 9px 12px; font-size: 15px; }
  .topbar__title,
  .topbar__home { font-size: 16px; }
  .topbar__user { max-width: 160px; font-size: 13.5px; }
  .main {
    padding: 24px 32px 24px;
    gap: 20px;
  }
}

/* ===== 사이드바 반응형 (모바일 드로어) ===== */
@media (max-width: 860px) {
  .topbar__menu { display: flex; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    z-index: 30;
    width: 264px;
    max-width: 264px;
    min-width: 264px;
    height: calc(100% - var(--topbar-h));
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.is-open { transform: translateX(0); }
  .main { padding: 14px 14px 18px; }
  .topbar__btn { padding: 0 10px; font-size: 12px; }
  .topbar__user { display: none; }
}

/* ===== 푸터 · 약관 다이얼로그 (홈·결제·약관 페이지 공통) ===== */
.footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 16px;
  row-gap: 2px;
  padding: 8px 0 4px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  flex: none;
}
.footer > p { margin: 0; }
.footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  justify-self: end;
}
.footer__links a,
.footer__links button {
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  text-decoration: none;
}
.footer__links a:hover,
.footer__links button:hover { color: var(--primary); text-decoration: underline; }
.footer__biz {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 2px;
  margin: 0;
  font-style: normal;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-muted);
}
.footer__biz-row {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
}
.footer__biz a { color: inherit; text-decoration: none; }
.footer__biz a:hover { color: var(--primary); text-decoration: underline; }

.legal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: rgba(16, 21, 31, .52);
}
.legal[hidden] { display: none !important; }
.legal__panel {
  display: flex;
  flex-direction: column;
  width: min(720px, 100%);
  max-height: min(86vh, 880px);
  overflow: hidden;
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow-lg);
}
.legal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--line);
}
.legal__title { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.legal__close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 22px;
  line-height: 1;
}
.legal__close:hover { background: #f3f6fb; color: var(--text); }
.legal__body {
  padding: 18px 22px 24px;
  overflow: auto;
  color: #243044;
  font-size: 14px;
  line-height: 1.7;
}
.legal__lead {
  margin: 0 0 18px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}
.legal__body h3,
.legal-doc h3 {
  margin: 22px 0 8px;
  font-size: 15px;
  font-weight: 800;
}
.legal__body h3:first-of-type,
.legal-doc h3:first-of-type { margin-top: 0; }
.legal__body p,
.legal-doc p { margin: 0 0 8px; }
.legal__body ul,
.legal-doc ul {
  margin: 0 0 10px;
  padding-left: 18px;
}
.legal__body li,
.legal-doc li { margin: 0 0 6px; }
.legal__date {
  margin: 22px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
}
.legal-doc {
  max-width: 760px;
  padding: 8px 4px 24px;
  color: #243044;
  font-size: 14px;
  line-height: 1.7;
}
body.is-legal-open { overflow: hidden; }

@media (max-width: 720px) {
  .footer { grid-template-columns: 1fr; }
  .footer__links { justify-self: start; }
}
