.hidden { display: none; }
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Helvetica Neue', Arial, 'Hiragino Sans', sans-serif;
  background: #f5f7fa;
  color: #333;
}

/* ヘッダー */
header {
  background: linear-gradient(135deg, #1a3a5c, #2e6da4);
  color: white;
  padding: 20px 32px;
}
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
header h1 { font-size: 1.6rem; margin-bottom: 4px; }
header p { font-size: 0.8rem; opacity: 0.8; }

#btn-csv {
  background: white;
  color: #1a3a5c;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
  font-size: 0.9rem;
}
#btn-csv:hover { background: #e8f0fe; }

/* フィルター */
#filters {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  background: white;
  padding: 14px 16px;
  margin: 16px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
#search {
  flex: 1;
  min-width: 200px;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.9rem;
}
select {
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.85rem;
  background: white;
}
#result-count {
  font-size: 0.85rem;
  color: #666;
  margin-left: auto;
  white-space: nowrap;
}

/* テーブル */
#table-section {
  margin: 0 16px 16px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
thead th {
  background: #1a3a5c;
  color: white;
  padding: 11px 14px;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
thead th:hover { background: #2e6da4; }
thead th.sort-asc::after { content: ' ▲'; }
thead th.sort-desc::after { content: ' ▼'; }

tbody tr {
  border-bottom: 1px solid #eee;
  cursor: pointer;
  transition: background 0.15s;
}
tbody tr:hover { background: #f0f6ff; }
tbody td { padding: 9px 14px; white-space: nowrap; }
tbody td.num { text-align: right; }

.growth-up { color: #e53935; font-weight: bold; }
.growth-down { color: #1e88e5; font-weight: bold; }
.growth-none { color: #999; }

/* モーダル */
.hidden { display: none; }
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}
#modal {
  background: white;
  border-radius: 12px;
  padding: 28px;
  width: 90%;
  max-width: 820px;
  max-height: 88vh;
  overflow-y: auto;
  position: relative;
}
#modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: #666;
}
#modal-title {
  font-size: 1.4rem;
  margin-bottom: 10px;
  color: #1a3a5c;
}
#modal-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: bold;
}
.badge-type { background: #e3f2fd; color: #1565c0; }
.badge-region { background: #f3e5f5; color: #6a1b9a; }
.badge-growth-up { background: #ffebee; color: #c62828; }
.badge-growth-down { background: #e3f2fd; color: #1565c0; }

#modal-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.chart-wrap {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 12px;
}
.chart-wrap h3 {
  font-size: 0.85rem;
  color: #555;
  margin-bottom: 8px;
}

#modal-growth h3 {
  font-size: 1rem;
  margin-bottom: 10px;
  color: #1a3a5c;
}
#growth-table {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.growth-card {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 12px;
}
.growth-card .period {
  font-size: 0.75rem;
  color: #888;
  margin-bottom: 6px;
}
.growth-card .metric {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 4px;
}
.growth-card .val-up { color: #e53935; font-weight: bold; }
.growth-card .val-down { color: #1e88e5; font-weight: bold; }
.growth-card .val-none { color: #bbb; }

/* 比較フローティングバー */
#compare-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #1a3a5c;
  color: white;
  padding: 12px 20px;
  border-radius: 50px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  z-index: 50;
  white-space: nowrap;
}
#compare-count { font-weight: bold; font-size: 0.9rem; }
#compare-names { font-size: 0.8rem; opacity: 0.8; }
#btn-compare {
  background: #f0a500;
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-weight: bold;
  font-size: 0.85rem;
}
#btn-compare-clear {
  background: rgba(255,255,255,0.2);
  color: white;
  border: none;
  padding: 6px 10px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
}

/* 比較モーダル */
#compare-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}
#compare-modal {
  background: white;
  border-radius: 12px;
  padding: 28px;
  width: 92%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}
#compare-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: #666;
}
#compare-radar-wrap {
  max-width: 500px;
  margin: 0 auto 24px;
}
#compare-table-wrap {
  overflow-x: auto;
}
#compare-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
#compare-table-wrap th {
  background: #1a3a5c;
  color: white;
  padding: 10px 14px;
  text-align: left;
}
#compare-table-wrap td {
  padding: 9px 14px;
  border-bottom: 1px solid #eee;
  text-align: right;
}
#compare-table-wrap td:first-child { text-align: left; }
#compare-table-wrap tr:hover { background: #f0f6ff; }

/* チェックボックス列 */
.col-check { width: 40px; text-align: center !important; }
input[type="checkbox"] { cursor: pointer; width: 16px; height: 16px; }

/* ナビゲーション */
.header-brand { flex: 1; }

.main-nav {
  display: flex;
  gap: 4px;
  padding: 0 32px 10px;
}

.nav-link {
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.88rem;
  transition: all 0.15s;
}

.nav-link:hover {
  background: rgba(255,255,255,0.15);
  color: white;
}

.nav-link.active {
  background: rgba(255,255,255,0.25);
  color: white;
  font-weight: bold;
}

/* ===== 共通ヘッダー・ナビ（全ページ共通） ===== */
.site-header {
  background: linear-gradient(135deg, #1a3a5c, #2e6da4);
  color: white;
  padding: 16px 32px 0;
}
.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo-icon { font-size: 28px; }
.site-title { font-size: 1.4rem; font-weight: 800; }
.site-subtitle { font-size: 0.78rem; opacity: 0.8; margin-top: 2px; }
.csv-btn {
  background: white;
  color: #1a3a5c;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
  font-size: 0.9rem;
  white-space: nowrap;
}
.csv-btn:hover { background: #e8f0fe; }
.main-nav {
  display: flex;
  gap: 4px;
  padding: 0 8px;
  background: linear-gradient(135deg, #1a3a5c, #2e6da4);
}
.nav-link {
  color: rgba(255,255,255,0.85) !important;
  text-decoration: none;
  padding: 8px 18px;
  border-radius: 8px 8px 0 0;
  font-size: 0.88rem;
  font-weight: 600;
  transition: all 0.15s;
  border-bottom: 3px solid transparent;
  display: inline-block;
}
.nav-link:hover {
  background: rgba(255,255,255,0.18);
  color: white !important;
}
.nav-link.active {
  background: rgba(255,255,255,0.22);
  color: white !important;
  border-bottom: 3px solid #60a5fa;
}
.main-content {
  max-width: 1400px;
  margin: 24px auto;
  padding: 0 24px;
}
