:root {
  --bg: #f6f7f9; --surface: #ffffff; --text: #16181d; --muted: #6a707c; --line: #e3e6eb;
  --accent: #2f6fed; --accent-text: #ffffff; --danger: #c53030;
  --first: #e8f1ff; --first-line: #2f6fed;
  --regular: #eaf7ee; --regular-line: #2f9e57;
  --absence: #fff4e5; --absence-line: #d9822b;
  --milestone: #f6ecff; --milestone-line: #8a4fd8;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a; --surface: #1d2026; --text: #eceef2; --muted: #9aa1ad; --line: #2c3038;
    --accent: #5b8cff; --accent-text: #0b0d10; --danger: #ff6b6b;
    --first: #1b2a45; --first-line: #5b8cff;
    --regular: #183223; --regular-line: #4cc27a;
    --absence: #3a2a14; --absence-line: #f0a24b;
    --milestone: #2c1f40; --milestone-line: #b48af0;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif; }
body { min-height: 100vh; display: flex; flex-direction: column; }
.hidden { display: none !important; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; }
.spacer { flex: 1; }
.status { font-size: 14px; color: var(--muted); }
.status.live::before { content: "●"; color: #e53e3e; margin-right: 4px; }
main { flex: 1; width: 100%; max-width: 960px; margin: 0 auto; padding: 16px; }
h1 { font-size: 22px; margin: 0 0 12px; }
h2 { font-size: 18px; margin: 20px 0 10px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card.narrow { max-width: 360px; margin: 40px auto; display: flex; flex-direction: column; gap: 12px; }
.card.row { display: flex; flex-wrap: wrap; gap: 8px; }
.card.row input { flex: 1 1 180px; }
.notice { margin-top: 12px; border-color: var(--accent); }
label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
input, select { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
button { font: inherit; font-weight: 600; border: 0; border-radius: 8px; padding: 10px 16px; background: var(--accent); color: var(--accent-text); cursor: pointer; }
button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
button.small { padding: 6px 10px; font-size: 14px; }
.error { color: var(--danger); min-height: 1.5em; margin: 0; }
.muted { color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; display: flex; flex-direction: column; }
.stat .label { font-size: 13px; color: var(--muted); }
.stat .value { font-size: 26px; font-weight: 700; }
.arrivals { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.arrival { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); border-left-width: 6px; }
.arrival.first { background: var(--first); border-left-color: var(--first-line); }
.arrival.regular { background: var(--regular); border-left-color: var(--regular-line); }
.arrival.long_absence { background: var(--absence); border-left-color: var(--absence-line); }
.arrival.known_before { border-left-color: var(--regular-line); }
.arrival.milestone { background: var(--milestone); border-left-color: var(--milestone-line); }
.arrival .who { flex: 1; min-width: 0; }
.arrival .name { font-weight: 700; font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arrival .meta { font-size: 14px; color: var(--muted); }
.arrival .memo { font-size: 14px; margin-top: 2px; }
.tag { font-size: 13px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--bg); white-space: nowrap; }
.arrival time { font-size: 13px; color: var(--muted); white-space: nowrap; }
.table { width: 100%; margin-top: 12px; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 15px; }
.table th { color: var(--muted); font-weight: 600; font-size: 13px; }
.footer { text-align: center; font-size: 12px; color: var(--muted); padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
@media (max-width: 560px) {
  .stats { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stat .value { font-size: 20px; }
  .table th:nth-child(2), .table td:nth-child(2) { display: none; }
}
