* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; overflow-x: hidden; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "ヒラギノ角ゴシック",
               "ＭＳ Ｐゴシック", "Yu Gothic", sans-serif;
  background: #f3f4f6;
  color: #1d1d1f;
  font-size: 15px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
  min-height: 100vh;
}

.app-header {
  background: linear-gradient(135deg, #305496 0%, #4470b8 100%);
  color: white;
  padding: 14px 16px calc(14px + env(safe-area-inset-top)) 16px;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  gap: 8px;
}
.app-header .back-btn {
  background: rgba(255,255,255,0.18);
  border: none;
  color: white;
  font-size: 14px;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}
.app-header .title-block { flex: 1; min-width: 0; }
.app-header h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-header .meta { font-size: 11px; opacity: 0.9; margin-top: 2px; }

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 12px 12px 80px;
}

/* スタッフ一覧カード */
.staff-card {
  background: white;
  border-radius: 14px;
  padding: 14px 14px 8px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  cursor: pointer;
  transition: transform 0.1s ease;
}
.staff-card:active { transform: scale(0.98); }
.staff-card .top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.staff-card .name-block { flex: 1; min-width: 0; }
.staff-card .name {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.staff-card .badge {
  display: inline-block;
  font-size: 10px;
  background: #e8eaed;
  color: #5f6368;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 6px;
  font-weight: 500;
  vertical-align: middle;
}
.staff-card .badge.shinsotsu { background: #e3f2fd; color: #1565c0; }
.staff-card .badge.chuto { background: #fff3e0; color: #e65100; }
.staff-card .sub {
  font-size: 11px;
  color: #888;
  margin-top: 2px;
}
.staff-card .avg-block { text-align: right; }
.staff-card .avg-score {
  font-size: 28px;
  font-weight: 700;
  color: #305496;
  line-height: 1;
}
.staff-card .avg-label {
  font-size: 9px;
  color: #999;
  letter-spacing: 0.05em;
  margin-top: 2px;
}
.staff-card .stats {
  font-size: 11px;
  color: #666;
  display: flex;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.staff-card .stats .pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #f5f5f7;
  padding: 2px 8px;
  border-radius: 10px;
}
.staff-card .stats .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.staff-card .sparkline-wrap {
  height: 44px;
  margin-top: 6px;
  position: relative;
}
.staff-card .single-tp-note {
  font-size: 10px;
  color: #aaa;
  text-align: center;
  padding: 14px 0 6px;
}

/* タブ */
.tabs {
  display: flex;
  background: white;
  border-radius: 10px;
  margin-bottom: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.tab {
  flex: 1;
  text-align: center;
  padding: 10px 4px;
  cursor: pointer;
  font-size: 13px;
  background: white;
  border: none;
  color: #555;
  font-weight: 500;
}
.tab.active {
  background: #305496;
  color: white;
  font-weight: 600;
}

/* 概要タブ */
.section {
  background: white;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.section h3 {
  margin: 0 0 10px;
  font-size: 13px;
  color: #305496;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.section .chart-wrap { position: relative; }
.section .radar-wrap { height: 280px; }
.section .trend-wrap { height: 180px; }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.summary-cell {
  border-radius: 8px;
  padding: 10px 4px;
  text-align: center;
}
.summary-cell .stars {
  font-size: 11px;
  margin-bottom: 4px;
  color: #555;
}
.summary-cell .count {
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}
.summary-3 { background: rgba(99,190,123,0.18); }
.summary-3 .count { color: #2d7c46; }
.summary-2 { background: rgba(182,224,149,0.25); }
.summary-2 .count { color: #4a7c2d; }
.summary-1 { background: rgba(255,210,127,0.25); }
.summary-1 .count { color: #b56a00; }
.summary-0 { background: rgba(248,105,107,0.18); }
.summary-0 .count { color: #b22e30; }

.coverage-bar {
  height: 8px;
  background: #f0f0f0;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 6px;
}
.coverage-bar > div {
  height: 100%;
  background: linear-gradient(90deg, #305496, #4470b8);
  transition: width 0.3s ease;
}
.coverage-text {
  font-size: 12px;
  color: #555;
  margin-top: 4px;
  display: flex;
  justify-content: space-between;
}

/* カテゴリタブ */
.cat-card {
  background: white;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.cat-card .header-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}
.cat-card .cat-name {
  font-size: 14px;
  font-weight: 600;
  color: #305496;
}
.cat-card .cat-score {
  font-size: 20px;
  font-weight: 700;
  color: #1d1d1f;
}
.cat-card .cat-coverage {
  font-size: 10px;
  color: #999;
  margin-bottom: 6px;
}
.cat-card .cat-trend-wrap { height: 70px; }

/* 40項目タブ */
.cat-section { margin-bottom: 16px; }
.cat-section .cat-title {
  font-size: 12px;
  font-weight: 600;
  color: #555;
  letter-spacing: 0.05em;
  margin: 0 4px 6px;
  padding: 4px 8px;
  background: #e8eaed;
  border-radius: 4px;
  display: inline-block;
}
.item-list {
  background: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.item-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  background: white;
}
.item-row:last-child { border-bottom: none; }
.item-row:active { background: #f7f7f7; }
.item-row.expanded { background: #f7f9fc; }
.item-row .item-name {
  font-size: 13px;
  font-weight: 500;
}
.item-row .sparkline-mini-wrap {
  width: 56px;
  height: 22px;
  position: relative;
}

.score-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 26px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.score-3 { background: #63BE7B; color: white; }
.score-2 { background: #B6E095; color: #2d4a2d; }
.score-1 { background: #FFD27F; color: #6b4a00; }
.score-0 { background: #F8696B; color: white; }
.score-null { background: #EFEFEF; color: #aaa; }

.expanded-comments {
  background: #f7f9fc;
  padding: 10px 14px 14px;
  font-size: 12px;
  border-bottom: 1px solid #f0f0f0;
  animation: expandIn 0.2s ease;
}
@keyframes expandIn {
  from { opacity: 0; max-height: 0; }
  to { opacity: 1; max-height: 600px; }
}
.expanded-comments .tp {
  margin-bottom: 8px;
  padding-left: 8px;
  border-left: 2px solid #d0d7e4;
}
.expanded-comments .tp:last-child { margin-bottom: 0; }
.expanded-comments .tp-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}
.expanded-comments .tp-label {
  font-weight: 600;
  color: #555;
  font-size: 10px;
}
.expanded-comments .tp-comment {
  color: #333;
  white-space: pre-wrap;
  word-break: break-word;
}
.expanded-comments .tp-empty {
  color: #aaa;
  font-style: italic;
}

/* プロファイル */
.profile-block { margin-top: 12px; }
.profile-block .profile-section {
  background: white;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.profile-block h3 {
  font-size: 13px;
  margin: 0 0 8px;
  color: #305496;
  font-weight: 600;
}
.profile-block .body {
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
  color: #333;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #999;
  font-size: 13px;
}

footer.app-footer {
  text-align: center;
  font-size: 10px;
  color: #999;
  padding: 16px 0 32px;
}
