/* EC家計簿 共通ヘッダー */
#header {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  z-index: 50 !important;
  color: #fff !important;
  font-family: "LINESeedJP", sans-serif;
}

#header,
#header * {
  box-sizing: border-box;
}

#header > div:first-child {
  position: absolute !important;
  inset: 0 !important;
  z-index: 0 !important;
  opacity: 0.92 !important;
  background-size: cover !important;
  background-position: center !important;
  box-shadow: 0 2px 8px rgba(0, 77, 37, 0.16) !important;
}

#header > div:nth-child(2) {
  position: relative !important;
  z-index: 1 !important;
  width: 100% !important;
  max-width: none !important;
  height: 72px !important;
  margin: 0 auto !important;
  padding: 0 32px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 24px !important;
}

#header > div:nth-child(2) > a:first-child {
  display: flex !important;
  align-items: center !important;
  flex: 0 0 auto !important;
  line-height: 1 !important;
}

#header > div:nth-child(2) > a:first-child img {
  display: block !important;
  width: auto !important;
  height: 56px !important;
  max-width: none !important;
  object-fit: contain !important;
}

#header > div:nth-child(2) > nav {
  display: none !important;
  align-items: center !important;
  gap: 20px !important;
  flex: 0 1 auto !important;
  min-width: 0 !important;
  white-space: nowrap !important;
}

#header > div:nth-child(2) > nav a {
  display: block !important;
  color: #fff !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  line-height: 1.4 !important;
  letter-spacing: 0.02em !important;
  text-decoration: none !important;
  white-space: nowrap !important;
}

#header > div:nth-child(2) > nav a:hover {
  opacity: 0.8 !important;
}

#header > div:nth-child(2) > nav + div {
  display: none !important;
  align-items: center !important;
  gap: 8px !important;
  flex: 0 0 auto !important;
}

#header > div:nth-child(2) > nav + div > a {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 132px !important;
  min-width: 132px !important;
  height: 48px !important;
  padding: 0 14px !important;
  border-radius: 4px !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  text-decoration: none !important;
  white-space: nowrap !important;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12) !important;
}

#header > div:nth-child(2) > nav + div > a:nth-child(1) {
  color: #fff !important;
  background: #f7931e !important;
  border: 1px solid #f7931e !important;
}

#header > div:nth-child(2) > nav + div > a:nth-child(2) {
  color: #00703c !important;
  background: #fff !important;
  border: 1px solid #fff !important;
}

#header > div:nth-child(2) > nav + div > a:nth-child(3) {
  color: #fff !important;
  background: #004d25 !important;
  border: 1px solid #004d25 !important;
}

#header #menu-btn {
  position: relative !important;
  z-index: 50 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
  padding: 8px !important;
  border: 0 !important;
  background: transparent !important;
  cursor: pointer !important;
}

#header #menu-btn span {
  display: block !important;
  width: 24px !important;
  height: 2px !important;
  background: #fff !important;
}

#header #mobile-menu {
  position: fixed !important;
  top: 0 !important;
  right: 0 !important;
  z-index: 60 !important;
  display: flex !important;
  width: 272px !important;
  height: 100vh !important;
  padding: 28px 24px !important;
  flex-direction: column !important;
  gap: 16px !important;
  overflow-y: auto !important;
  color: #1f2937 !important;
  background: #fff !important;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.14) !important;
  transition: transform 0.3s ease !important;
}

#header #mobile-menu.translate-x-full {
  transform: translateX(100%) !important;
}

#header #mobile-menu:not(.translate-x-full) {
  transform: translateX(0) !important;
}

#header #mobile-menu #menu-close {
  align-self: flex-end !important;
  padding: 8px !important;
  border: 0 !important;
  color: #6b7280 !important;
  background: transparent !important;
  cursor: pointer !important;
}

#header #mobile-menu > div {
  display: flex !important;
  flex-direction: column !important;
  gap: 0 !important;
  font-weight: 700 !important;
}

#header #mobile-menu .mobile-link {
  display: block !important;
  padding: 13px 0 !important;
  border-bottom: 1px solid #f0f1f2 !important;
  color: #1f2937 !important;
  font-size: 14px !important;
  line-height: 1.5 !important;
  text-decoration: none !important;
}

#header #mobile-menu > div > div {
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  margin-top: 20px !important;
}

#header #mobile-menu > div > div > a {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 46px !important;
  padding: 10px 14px !important;
  border-radius: 4px !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  text-decoration: none !important;
}

#header #mobile-menu > div > div > a:nth-child(1) {
  color: #fff !important;
  background: #f7931e !important;
  border: 1px solid #f7931e !important;
}

#header #mobile-menu > div > div > a:nth-child(2) {
  color: #00703c !important;
  background: #fff !important;
  border: 1px solid #00703c !important;
}

#header #mobile-menu > div > div > a:nth-child(3) {
  color: #fff !important;
  background: #004d25 !important;
  border: 1px solid #004d25 !important;
}

@media (min-width: 960px) {
  #header > div:nth-child(2) > nav,
  #header > div:nth-child(2) > nav + div {
    display: flex !important;
  }

  #header #menu-btn,
  #header #mobile-menu {
    display: none !important;
  }
}

/* デスクトップでは、左右の要素に影響されずナビだけを画面中央に配置 */
@media (min-width: 1150px) {
  #header > div:nth-child(2) > nav {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
  }
}

/* 標準的なデスクトップ幅ではナビだけを少し詰める */
@media (min-width: 1280px) and (max-width: 1599px) {
  #header > div:nth-child(2) > nav {
    gap: 8px !important;
  }

  #header > div:nth-child(2) > nav a {
    font-size: 11px !important;
  }
}

@media (min-width: 960px) and (max-width: 1359px) {
  #header > div:nth-child(2) {
    height: 64px !important;
    padding: 0 16px !important;
    gap: 10px !important;
  }

  #header > div:nth-child(2) > a:first-child img {
    height: 44px !important;
  }

  #header > div:nth-child(2) > nav {
    gap: 8px !important;
  }

  #header > div:nth-child(2) > nav a {
    font-size: 11px !important;
  }

  #header > div:nth-child(2) > nav + div {
    gap: 6px !important;
  }

  #header > div:nth-child(2) > nav + div > a {
    width: 104px !important;
    min-width: 104px !important;
    height: 42px !important;
    padding: 0 6px !important;
    font-size: 11px !important;
  }
}

@media (max-width: 959px) {
  #header > div:nth-child(2) {
    height: 64px !important;
    padding: 0 20px !important;
  }

  #header > div:nth-child(2) > a:first-child img {
    height: 50px !important;
  }
}
