/* ===== リセット・ベース ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #e85d04;
  --primary-light: #ffddd2;
  --secondary: #023e7d;
  --bg: #f8f9fa;
  --surface: #ffffff;
  --border: #dee2e6;
  --text: #212529;
  --text-muted: #6c757d;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,.08);
  --shadow-hover: 0 4px 16px rgba(0,0,0,.14);
}

body {
  font-family: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

/* ===== ヘッダー ===== */
.site-header {
  background: var(--secondary);
  color: #fff;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.site-header h1 { font-size: 18px; font-weight: 700; letter-spacing: .02em; }
.site-header nav a {
  color: rgba(255,255,255,.85);
  text-decoration: none;
  margin-left: 20px;
  font-size: 13px;
  transition: color .2s;
}
.site-header nav a:hover { color: #fff; }

/* ===== メインレイアウト ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 24px 20px; }

/* ===== KPIカード ===== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.kpi-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border-top: 4px solid var(--primary);
}
.kpi-card .label { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.kpi-card .value { font-size: 28px; font-weight: 700; color: var(--secondary); }
.kpi-card .sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ===== フィルターバー ===== */
.filter-bar {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-group > label { font-size: 12px; color: var(--text-muted); font-weight: 600; }

/* 評価点チェックリスト */
.rating-checks { display: flex; gap: 6px; flex-wrap: wrap; padding: 4px 0; }
.rating-label {
  display: flex; align-items: center; gap: 3px;
  font-size: 13px; color: var(--text);
  cursor: pointer; white-space: nowrap;
}
.rating-label input[type="checkbox"] { accent-color: var(--primary); cursor: pointer; }

/* フィルター注記 */
.filter-note {
  align-self: flex-end;
  font-size: 11px;
  color: var(--text-muted);
  padding-bottom: 8px;
  white-space: nowrap;
}
.filter-group select {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  min-width: 160px;
}
.filter-group select:focus { outline: 2px solid var(--primary); border-color: transparent; }
.btn-reset {
  padding: 7px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  transition: all .2s;
  align-self: flex-end;
}
.btn-reset:hover { background: var(--bg); color: var(--text); }

/* ===== グリッドレイアウト ===== */
.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
.chart-grid.full { grid-template-columns: 1fr; }
.chart-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.chart-card h2 {
  font-size: 14px;
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 4px;
}
.chart-card .chart-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.chart-placeholder { min-height: 320px; }

/* ===== テーブル ===== */
.table-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.table-card h2 {
  font-size: 14px;
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 12px;
}
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left;
  padding: 8px 12px;
  background: var(--bg);
  border-bottom: 2px solid var(--border);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
}
.data-table th.sortable {
  cursor: pointer;
  user-select: none;
}
.data-table th.sortable:hover { background: var(--primary-light); color: var(--primary); }
.data-table th.sort-active { color: var(--primary); }
.sort-icon { font-size: 11px; opacity: .7; }
.data-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:hover td { background: var(--primary-light); }
.data-table tr:last-child td { border-bottom: none; }

/* クラスターバッジ */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-food-cheap  { background: #d4edda; color: #155724; }
.badge-food-prem   { background: #fff3cd; color: #856404; }
.badge-elec        { background: #cce5ff; color: #004085; }
.badge-large       { background: #f8d7da; color: #721c24; }
.badge-small       { background: #e2e3e5; color: #383d41; }

/* ===== フッター ===== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 20px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 40px;
}
.site-footer a { color: var(--primary); text-decoration: none; }

/* ===== ローディング ===== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 300px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ===== インサイトバナー ===== */
.insight-banner {
  background: linear-gradient(135deg, var(--secondary) 0%, #0353a4 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 24px;
}
.insight-banner h2 { font-size: 14px; opacity: .8; margin-bottom: 8px; }
.insights-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.insights-list li { font-size: 13px; display: flex; gap: 8px; align-items: flex-start; }
.insights-list li::before { content: "▶"; font-size: 10px; opacity: .7; flex-shrink: 0; margin-top: 3px; }

/* ===== レスポンシブ ===== */
@media (max-width: 768px) {
  .chart-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .site-header h1 { font-size: 15px; }
  .filter-bar { flex-direction: column; }
  .filter-group select { min-width: 100%; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi-card .value { font-size: 22px; }
}
