:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #efede8;
  --text: #1d1c1a;
  --muted: #6b6862;
  --line: #dedbd4;
  --accent: #b4232f;
  --accent-soft: #f6e3e4;
  --kisei-bg: #2a2a2a;
  --kisei-text: #ffffff;
  --q-hi: #2f7d4a;
  --q-mid: #8a7a1f;
  --q-lo: #a4502a;
  --hid-bg: #fbf1f1;
  --memo: #7a5a12;
  --radius: 8px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141413;
    --surface: #1d1c1b;
    --surface-2: #262523;
    --text: #ecebe7;
    --muted: #a19e97;
    --line: #34322f;
    --accent: #ef6b74;
    --accent-soft: #3a2224;
    --kisei-bg: #e6e6e6;
    --kisei-text: #111111;
    --q-hi: #6fcf8f;
    --q-mid: #d9c45a;
    --q-lo: #e48d63;
    --hid-bg: #2a1d1e;
    --memo: #d9b86a;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
  font-size: 15px;
  line-height: 1.55;
}
a { color: var(--accent); }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); font-weight: normal; }

.site-header { border-bottom: 1px solid var(--line); background: var(--surface); padding: 24px 0 18px; }
.title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.admin-badge { background: var(--accent); color: #fff; font-size: .78rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; }
.logout { margin-left: auto; font-size: .85rem; }
.site-header h1 { margin: 0; font-size: 1.6rem; letter-spacing: .02em; }
.intro { margin: 0 0 6px; }
.meta { margin: 0; color: var(--muted); font-size: .85rem; display: flex; gap: 14px; flex-wrap: wrap; }
.contacts { list-style: none; padding: 0; margin: 10px 0 0; display: flex; gap: 8px; flex-wrap: wrap; }
.contacts li { background: var(--surface-2); border-radius: 999px; padding: 3px 12px; font-size: .85rem; }
.contacts b { margin-right: 6px; }
.contacts:empty { display: none; }

.panels { display: grid; gap: 8px; margin: 16px 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel summary { cursor: pointer; padding: 10px 14px; font-weight: 600; }
.board { margin: 0; padding: 0 14px 12px 32px; }
.board li { margin: 4px 0; }
.legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 4px 24px; padding: 0 14px 14px; }
.legend h3 { font-size: .85rem; color: var(--muted); margin: 6px 0; }
.legend dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 0; }
.legend dd { margin: 0; }
.legend ul { margin: 0; padding-left: 18px; }

.toolbar {
  position: sticky; top: 0; z-index: 5;
  background: var(--bg);
  padding: 10px 0 6px;
  border-bottom: 1px solid var(--line);
}
.toolbar .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.toolbar .row.small { font-size: .88rem; gap: 6px 14px; }
.toolbar input, .toolbar select, .toolbar button {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px;
}
.toolbar .small input, .toolbar .small select, .toolbar .small button { padding: 3px 8px; }
#q { flex: 1 1 260px; min-width: 0; }
#tour { flex: 1 1 260px; min-width: 0; max-width: 100%; }
#yfrom, #yto { width: 5.2em; }
.toolbar label { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.toolbar button { cursor: pointer; }
.toolbar button:hover { border-color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  font-size: .82rem; padding: 3px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.count { margin: 0; font-size: .85rem; color: var(--muted); }

.tour { margin: 22px 0; }
.tour h2 {
  font-size: 1.02rem; margin: 0 0 6px; padding-left: 10px;
  border-left: 4px solid var(--accent);
  display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap;
}
.tour h2 .muted { font-size: .8rem; }

table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
@media (min-width: 761px) {
  table { table-layout: fixed; }
  .c-date { width: 96px; } .c-venue { width: 22%; } .c-type { width: 48px; } .c-q { width: 52px; }
  .c-fmt { width: 52px; } .c-len { width: 72px; } .c-size { width: 80px; } .c-sample { width: 48px; }
  .c-cond { width: 96px; }
  td { overflow-wrap: anywhere; }
}
th, td { padding: 6px 8px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
th { font-size: .78rem; color: var(--muted); font-weight: 600; background: var(--surface-2); white-space: nowrap; }
tr:last-child td { border-bottom: none; }
td.date, td.num { white-space: nowrap; font-variant-numeric: tabular-nums; }
td.num { text-align: right; }
td.notes { min-width: 220px; }
td.notes .detail { color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; }
tr.dim td { opacity: .5; }
tr.hid td { background: var(--hid-bg); }
.hid-badge { display: inline-block; font-size: .75rem; font-weight: 700; color: var(--accent); border: 1px solid var(--accent); border-radius: 4px; padding: 0 6px; margin-bottom: 2px; }
.memo { font-size: .82rem; color: var(--memo); overflow-wrap: anywhere; }

.badge {
  display: inline-block; min-width: 1.7em; text-align: center;
  font-size: .78rem; font-weight: 700; padding: 1px 6px; border-radius: 4px;
  background: var(--surface-2);
}
.q { font-weight: 700; font-variant-numeric: tabular-nums; }
.q.hi { color: var(--q-hi); }
.q.mid { color: var(--q-mid); }
.q.lo { color: var(--q-lo); }
.cond { font-size: .82rem; font-weight: 600; color: var(--accent); }
.cond.kisei { background: var(--kisei-bg); color: var(--kisei-text); padding: 1px 6px; border-radius: 4px; }
.sample { color: var(--q-hi); font-weight: 700; }
.lbl { display: none; }

.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.footer { color: var(--muted); font-size: .8rem; padding: 30px 16px 40px; }

/* スマホ：表をカード表示に */
@media (max-width: 760px) {
  .toolbar { position: static; }
  table, tbody { display: block; width: 100%; }
  td { display: block; }
  thead { display: none; }
  table { border: none; background: none; }
  tr {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    margin-bottom: 8px; padding: 8px 10px;
    display: flex; flex-wrap: wrap; gap: 2px 14px; align-items: baseline;
  }
  td { border: none; padding: 0; white-space: nowrap; }
  td.date { flex-basis: 100%; font-weight: 700; }
  td.venue { flex-basis: 100%; margin-bottom: 4px; white-space: normal; }
  td.num { text-align: left; }
  td.notes { flex-basis: 100%; min-width: 0; margin-top: 4px; white-space: normal; }
  td:empty { display: none; }
  tr.hid { background: var(--hid-bg); }
  tr.hid td { background: none; }
  .lbl { display: inline; color: var(--muted); font-size: .75rem; margin-right: 4px; }
}
