:root {
  --base-color: #ffffff; /* 60% - 背景やカードの基本色 */
  --main-color: #00c711; /* 35% - ボタン、主要ステータスなど */
  --accent-color: #db0000; /* 5% - エラー、停止、警告など */
  --bg-color: #f0f0f0; /* セクション区切り、全体の背景 */

  --text-dark: #1a1a1a;
  --text-light: #666666;
  --border-color: #e5e5e5;
  --font-family: "Noto Sans JP", -apple-system, sans-serif;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  background-color: var(--base-color);
  color: var(--text-dark);
  overflow-y: scroll; /* スクロールバー幅による画面のカクつき・ズレを防止 */
}

a {
  text-decoration: none;
  color: var(--text-dark);
}

/* ボタン汎用 */
.btn-main {
  background: var(--main-color);
  color: white;
  padding: 10px 24px;
  border-radius: 6px;
  font-weight: 700;
  transition: opacity 0.2s;
  cursor: pointer;
  border: none;
}
.btn-main:hover {
  opacity: 0.8;
}

/* 上部メニュー込みのダッシュボードレイアウト */
.dashboard-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: var(--bg-color);
}

.dashboard-sidebar {
  width: 100%;
  height: 70px;
  box-sizing: border-box;
  flex-shrink: 0;
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-color);
  border-right: none;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.admin-sidebar {
  width: 100%;
  height: 70px;
  box-sizing: border-box;
  flex-shrink: 0;
  background-color: rgba(30, 41, 59, 0.95);
  backdrop-filter: blur(8px);
  color: white;
  border-bottom: none;
  border-right: none;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 1000;
}

/* 環境切り替えボタンの完全共通スタイル */
.env-switch-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: auto;
  height: 42px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: bold;
  font-size: 14px;
  transition: all 0.2s;
  box-sizing: border-box;
  margin: 0;
  padding: 0 20px;
}

/* 汎用ローディングアニメーション */
.loading-spinner {
  display: inline-block;
  width: 36px;
  height: 36px;
  border: 4px solid rgba(0, 199, 17, 0.1);
  border-top: 4px solid var(--main-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 15px;
  padding: 50px 20px;
  color: var(--text-light);
  font-weight: bold;
}

.dashboard-main {
  flex: 1;
  padding: 40px 20px;
  overflow-y: auto;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.sidebar-brand {
  padding: 15px 0;
  border-bottom: none;
  display: flex;
  align-items: center;
  gap: 15px;
  flex-shrink: 0; /* ロゴが潰れないようにする */
}

.sidebar-title {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0.05em;
  margin: 0;
}

.sidebar-subtitle {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 0;
  font-weight: 700;
  display: none; /* スマホでは非表示気味にするため一旦隠すか、トップバーでは不要 */
}

.sidebar-nav {
  padding: 0;
  list-style: none;
  margin: 0;
  display: flex;
  gap: 5px;
  align-items: center;
  overflow-x: auto;
  flex: 1; /* 残りのスペースを全て埋める */
  -webkit-overflow-scrolling: touch;
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}

/* スクロールバーを隠す (Chrome, Safari) */
.sidebar-nav::-webkit-scrollbar {
  display: none;
}

.sidebar-nav li {
  margin-bottom: 0;
  white-space: nowrap;
  flex-shrink: 0; /* メニュー項目が押し潰されないようにする */
}

.sidebar-nav a {
  display: flex;
  padding: 10px 10px;
  font-weight: 700;
  border-radius: 6px;
  font-size: 13px;
  transition: background 0.2s;
}

.sidebar-nav a:hover {
  background-color: rgba(0, 0, 0, 0.04);
}

.active-link {
  background-color: rgba(0, 199, 17, 0.1);
  color: var(--main-color) !important;
}

@media (max-width: 768px) {
  .dashboard-sidebar, .admin-sidebar {
    display: flex;
    flex-direction: column;
    height: auto;
    padding: 15px;
    gap: 15px;
    position: relative;
  }
  .responsive-nav-container {
    flex-direction: column !important;
    align-items: flex-start !important;
    padding: 0 !important;
    gap: 15px !important;
  }
  .header-left {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 15px !important;
    width: 100% !important;
  }
  .sidebar-brand {
    padding: 0 !important;
    margin: 0 !important;
    align-self: flex-start !important;
    text-align: left !important;
  }
  .sidebar-brand .logo-img {
    height: 28px !important;
  }
  .sidebar-brand .sidebar-title {
    font-size: 20px !important;
  }
  #top-right-actions {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px !important;
  }
  .env-switch-btn {
    width: auto !important;
    padding: 0 6px !important;
    height: 30px !important;
    font-size: 10px !important;
    gap: 4px !important;
    border-radius: 6px !important;
    white-space: nowrap !important;
  }
  .env-switch-btn svg {
    width: 14px !important;
    height: 14px !important;
    flex-shrink: 0;
  }
  .sidebar-nav {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 5px; /* スクロールバーのための余白 */
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
  }
  .sidebar-nav::-webkit-scrollbar {
    display: none;
  }
  .sidebar-nav li {
    flex-shrink: 0;
    white-space: nowrap;
  }
  .dashboard-main, .admin-content {
    padding: 20px 10px;
  }
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
  flex: 1; /* 右側のボタンエリアと干渉しないよう領域を確保 */
  overflow: hidden; /* 子要素（メニュー）のスクロールを可能にするため */
}

#top-right-actions {
  flex-shrink: 0; /* ボタンが潰れないように保護 */
  margin-left: 20px;
}

@media (max-width: 1100px) {
  .header-left {
    gap: 15px;
  }
  .sidebar-nav {
    gap: 5px;
  }
  .sidebar-nav a {
    padding: 10px 12px;
    font-size: 14px;
  }
  .sidebar-title {
    font-size: 24px;
  }
  .sidebar-brand .logo-img {
    height: 32px;
  }
  .env-switch-btn {
    width: auto;
    padding: 0 10px;
    font-size: 13px;
  }
}

@media (max-width: 900px) {
  .header-left {
    gap: 10px;
  }
  .sidebar-nav a {
    padding: 8px 8px;
    font-size: 13px;
  }
  .sidebar-title {
    font-size: 20px;
  }
  .sidebar-brand .logo-img {
    height: 28px;
  }
  .env-switch-btn {
    padding: 0 8px;
    font-size: 11px;
    height: 36px;
  }
}

/* LP用 (Landing Page) スタイル */
.lp-wrapper {
  overflow-x: hidden;
}

.navbar {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border-color);
  height: 70px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-wrapper {
  display: flex;
  align-items: center;
  gap: 0;
}

.logo-img {
  height: 40px;
  width: auto;
  object-fit: contain;
  margin-right: 6px;
}

.logo-text {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.5px;
}

.nav-links {
  display: flex;
  gap: 20px;
  align-items: center;
}

.login-link {
  font-weight: 600;
}
.login-link:hover {
  opacity: 0.7;
}

.hero-section {
  padding: 40px 20px 40px;
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 50px;
  align-items: center;
}

.hero-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.tagline {
  color: var(--main-color);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 1px;
}

.main-title {
  font-size: 56px;
  line-height: 1.25;
  font-weight: 900;
  margin: 0;
}

.highlight-text {
  color: transparent;
  background: linear-gradient(135deg, var(--main-color) 0%, #008f0c 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

.hero-subtitle {
  font-size: 22px;
  color: var(--text-light);
  line-height: 1.6;
}

.counter-box {
  background: #f5f5f5;
  padding: 40px 50px;
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,0.05);
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}

.counter-label {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-dark);
  margin-top: 15px;
}

.counter-value {
  font-size: 68px;
  font-weight: 900;
  line-height: 1;
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: var(--text-dark);
  margin-bottom: 5px;
}

.counter-unit {
  font-size: 24px;
  color: var(--text-light);
  font-weight: 700;
}

.counter-sub {
  font-size: 15px;
  color: var(--main-color);
  margin-top: 15px;
  font-weight: 700;
}

.cta-button {
  background: var(--main-color);
  color: white;
  font-size: 18px;
  font-weight: 700;
  padding: 16px 36px;
  border-radius: 50px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 20px -5px rgba(0, 199, 17, 0.3);
  transition: transform 0.2s, box-shadow 0.2s;
  width: max-content;
}
.cta-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 25px -5px rgba(0, 199, 17, 0.4);
}

.features-section {
  background: var(--bg-color);
  padding: 50px 20px 100px;
  margin-top: 25px;
}

.features-container {
  max-width: 1200px;
  margin: 0 auto;
}

.section-title {
  font-size: 40px;
  font-weight: 900;
  text-align: center;
  margin-bottom: 15px;
}

.section-subtitle {
  font-size: 18px;
  color: var(--text-light);
  text-align: center;
  margin-bottom: 60px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
}

.feature-card {
  background: var(--base-color);
  color: var(--text-dark);
  padding: 40px 30px;
  border-radius: 16px;
  border: 3px solid var(--main-color);
  box-shadow: 0 10px 30px rgba(0, 199, 17, 0.1);
  transition: transform 0.3s, box-shadow 0.3s;
}
.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 35px rgba(0, 199, 17, 0.3);
}

.feature-icon {
  font-size: 48px;
  margin-bottom: 25px;
}

.feature-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 15px;
}

.feature-desc {
  color: var(--text-dark);
  line-height: 1.7;
  font-size: 15px;
}

.bottom-cta {
  padding: 100px 20px;
  text-align: center;
}

.bottom-cta h2 {
  font-size: 36px;
  font-weight: 900;
  margin-bottom: 40px;
}

.btn-large {
  background: var(--text-dark);
  color: white;
  font-size: 20px;
  font-weight: 700;
  padding: 20px 50px;
  border-radius: 50px;
}

.footer {
  text-align: center;
  padding: 30px;
  color: var(--text-light);
  font-size: 14px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-color);
}

@media (max-width: 900px) {
  .hero-section {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 40px 20px;
  }
  .hero-content {
    align-items: center;
  }
  .feature-grid {
    grid-template-columns: 1fr;
    max-width: 500px;
    margin: 0 auto;
  }
}

@media (max-width: 600px) {
  .main-title {
    font-size: 40px;
    white-space: nowrap; /* 強制的なスマホ改行を防ぐ */
  }
  .hero-subtitle {
    font-size: 16px;
    text-align: left;
  }
  .counter-value {
    font-size: 50px;
  }
  .counter-box {
    padding: 30px 20px;
  }
  .nav-links {
    gap: 10px;
  }
  .btn-main {
    padding: 8px 12px !important;
    font-size: 14px;
  }
  .login-link {
    font-size: 14px;
  }
}

/* 認証関連・フォーム群 */
.auth-wrapper {
  background-color: var(--bg-color);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.auth-card {
  background: var(--base-color);
  width: 100%;
  max-width: 480px;
  padding: 50px 40px;
  border-radius: 24px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.03);
}

.auth-header {
  text-align: center;
  margin-bottom: 40px;
}

.auth-title {
  font-size: 28px;
  font-weight: 900;
  margin-top: 15px;
  margin-bottom: 5px;
}

.auth-subtitle {
  color: var(--text-light);
  font-size: 15px;
}

.form-group {
  margin-bottom: 25px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-dark);
}

.form-input {
  width: 100%;
  box-sizing: border-box;
  padding: 14px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
  transition: all 0.2s;
  background-color: white;
}

.form-input:focus {
  outline: none;
  border-color: var(--main-color);
  box-shadow: 0 0 0 3px rgba(0, 199, 17, 0.1);
}

.form-hint {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 6px;
}

.auth-footer {
  margin-top: 30px;
  text-align: center;
  font-size: 15px;
  color: var(--text-light);
}

.auth-footer a {
  color: var(--main-color);
  font-weight: 700;
}
.auth-footer a:hover {
  text-decoration: underline;
}

/* トップへ戻るボタン (左下部) */
.scroll-to-top-btn {
  position: fixed;
  bottom: 30px;
  right: 30px; /* 右下部に設定 */
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: var(--text-dark);
  color: white;
  border: none;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 9999;
}

.scroll-to-top-btn:hover {
  transform: translateY(-3px);
  background-color: var(--main-color);
  box-shadow: 0 6px 15px rgba(0, 199, 17, 0.4);
}

.scroll-to-top-btn.show {
  opacity: 1;
  visibility: visible;
}

@media (max-width: 768px) {
  .scroll-to-top-btn {
    bottom: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
  }
}

/* 共通レスポンシブユーティリティ */
.dashboard-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 40px;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 900px) {
  .dashboard-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .dashboard-stats-grid {
    grid-template-columns: 1fr;
  }
}

/* Modal Styles */
.custom-modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.4);
  z-index: 999999;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}
.custom-modal {
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  position: relative;
}
