:root {
  --bg: #efebe3;
  --paper: #fffcf7;
  --ink: #1c1915;
  --muted: #5c564c;
  --line: #ddd6c8;
  --accent: #154e5b;
  --accent-soft: #e3eef0;
  --good: #1b6b3a;
  --warn: #9a4d12;
  --warn-bg: #f8ead8;
  --chip: #ece6da;
  --radius: 14px;
  --pad: 16px;
  --tap: 44px;
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP",
    "Yu Gothic", YuGothic, Meiryo, system-ui, sans-serif;
  --max: 28rem;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: #d9d2c5;
  font-size: 16px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}
button, select, input { font: inherit; }
button { color: inherit; }

.app {
  max-width: var(--max);
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--bg);
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}

.chrome {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 92%, white);
  backdrop-filter: blur(12px);
}
.top {
  padding: calc(10px + env(safe-area-inset-top)) var(--pad) 10px;
}
.brand {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.12em;
  font-weight: 700;
  color: var(--accent);
}
.group-field span {
  display: block;
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
  margin-bottom: 4px;
}
.group-field select {
  width: 100%;
  height: 48px;
  border-radius: 12px;
  border: 1px solid #c9c0b0;
  background: var(--paper);
  padding: 0 12px;
  font-weight: 700;
  font-size: 16px;
}

.seg {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.seg button {
  flex: 1;
  min-height: var(--tap);
  border-radius: 999px;
  border: 1px solid #c9c0b0;
  background: var(--paper);
  cursor: pointer;
  font-weight: 650;
}
.seg button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.summary {
  margin-top: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.summary .big {
  font-size: 1.55rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--accent);
  line-height: 1.1;
}
.summary .sub { font-size: 13px; color: var(--muted); }

.tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  padding: 0 6px;
}
.tabs button {
  flex: 1;
  min-height: 48px;
  border: 0;
  background: none;
  cursor: pointer;
  font-weight: 700;
  color: var(--muted);
  border-bottom: 3px solid transparent;
  padding: 0 4px;
}
.tabs button[aria-selected="true"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

main { padding: 12px var(--pad) 8px; }

.search-field { display: block; margin-bottom: 10px; }
.search-field input {
  width: 100%;
  height: 44px;
  border-radius: 12px;
  border: 1px solid #c9c0b0;
  background: var(--paper);
  padding: 0 12px;
  font-size: 16px;
}
.vh {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
}
.card-btn {
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 12px 14px;
  cursor: pointer;
  min-height: var(--tap);
}
.card-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.name { font-weight: 800; font-size: 16px; }
.rate {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  white-space: nowrap;
}
.rate.good { color: var(--good); }
.muted { color: var(--muted); font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--chip);
  color: #3f3a33;
}
.chip.PBS { background: #d7eee8; color: #0f4c40; }
.chip.BE  { background: #fde6d6; color: #8a3b12; }
.chip.CBE { background: #fde6d6; color: #8a3b12; box-shadow: inset 0 0 0 1px #c45c26; }
.chip.BT  { background: #dce7f5; color: #1b3a6b; }
.chip.CBT { background: #dce7f5; color: #1b3a6b; box-shadow: inset 0 0 0 1px #1b3a6b; }
.chip.BS  { background: #e7f0d4; color: #3b5420; }
.chip.CBS { background: #e7f0d4; color: #3b5420; box-shadow: inset 0 0 0 1px #3b5420; }
.chip.MT  { background: #eee4f5; color: #55306e; }
.chip.その他 { background: #ece8e1; color: #5c564c; }
.mark {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  border-radius: 6px;
  padding: 1px 6px;
  margin-left: 4px;
  background: var(--accent-soft);
  color: var(--accent);
}
.mark.kon { background: var(--warn-bg); color: var(--warn); }

.detail {
  display: none;
  border-top: 1px solid var(--line);
  padding: 4px 6px 10px;
  background: #faf7f1;
}
.card.open .detail { display: block; }
.detail-row {
  display: block;
  padding: 8px 8px;
  border-bottom: 1px solid #efe9de;
  font-size: 14px;
}
.detail-row:last-child { border-bottom: 0; }
.chev {
  color: var(--muted);
  font-size: 12px;
  margin-left: 6px;
}
.card.open .chev { transform: rotate(180deg); display: inline-block; }

.bar {
  height: 8px;
  background: #e8e2d6;
  border-radius: 99px;
  overflow: hidden;
  margin-top: 8px;
}
.bar > i {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
}

.type-head .full { font-size: 12px; color: var(--muted); font-weight: 500; }
.type-stats {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}
.sess-att {
  margin: 0 8px 8px;
  padding: 8px 8px 2px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.sess-att h3 {
  margin: 0 0 6px;
  font-size: 13px;
}
.person-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 2px;
  border-top: 1px solid #f0ebe3;
  font-size: 14px;
}
.empty { color: var(--muted); padding: 16px 8px; text-align: center; }
.meta { font-size: 13px; color: var(--muted); margin: 8px 0 16px; }
.future-box { margin-top: 12px; }
.future-box summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
  padding: 8px 0;
}

.callout {
  background: var(--warn-bg);
  border-radius: 12px;
  padding: 12px;
  font-size: 14px;
  margin-bottom: 12px;
  color: #5c3510;
}
.kpi-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.kpi {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
.kpi .k { font-size: 11px; color: var(--muted); letter-spacing: 0.06em; }
.kpi .v { font-size: 1.25rem; font-weight: 800; font-variant-numeric: tabular-nums; }

.rank-card { padding: 10px 12px; }
.rank-card .row { margin-bottom: 2px; }

.foot {
  padding: 8px var(--pad) 24px;
}
.foot details {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 4px 12px 8px;
}
.foot summary {
  cursor: pointer;
  min-height: var(--tap);
  display: flex;
  align-items: center;
  font-weight: 700;
  font-size: 14px;
}
.notes-body { font-size: 13px; color: #3f3a33; padding-bottom: 8px; }
.notes-body ul { margin: 8px 0; padding-left: 1.2rem; }
.notes-body li { margin: 4px 0; }
.map { font-size: 12px; }
.map div { padding: 3px 0; border-bottom: 1px solid #efe9de; }
.src { font-size: 12px; color: var(--muted); margin: 12px 0 0; }

.status-error {
  margin: 16px;
  padding: 14px;
  background: #fde8e8;
  border-radius: 12px;
}
