:root {
  --page: #f5f7fb; --surface: #fff; --surface-soft: #f8fafc; --text: #172033; --muted: #5b6679;
  --line: #e3e8f0; --brand: #001e62; --brand-strong: #001641; --brand-soft: #e6ecfa; --on-brand: #fff;
  --yes: #08805d; --yes-soft: #e9f8f3; --no: #c93a3a; --no-soft: #fff0f0; --on-state: #fff;
  --warning: #7a4f00; --warning-soft: #fff7df;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #0b1220; --surface: #131d2e; --surface-soft: #101827; --text: #edf3fb; --muted: #a5b2c4;
    --line: #29374b; --brand: #91a9e8; --brand-strong: #c4d0f2; --brand-soft: #1d2b54; --on-brand: #0b1220;
    --yes: #35d09a; --yes-soft: #123c32; --no: #ff7474; --no-soft: #482329; --on-state: #0b1220;
    --warning: #ffd16b; --warning-soft: #3b3017;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--page); color: var(--text);
  font-family: system-ui, -apple-system, "Hiragino Sans", "Yu Gothic", sans-serif;
  font-size: 15px; line-height: 1.6; -webkit-text-size-adjust: 100%;
}
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: -2px; }
h1 { margin: 0; font-size: 24px; line-height: 1.3; }

.access { max-width: 400px; margin: 0 auto; padding: 20vh 24px 40px; text-align: center; }
.access-brand { margin: 0 0 6px; color: var(--muted); font-size: 14px; }
#access-message { margin: 14px 0 0; color: var(--muted); }
.login {
  display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 48px; margin-top: 28px;
  border: 1px solid #747775; border-radius: 24px; background: #fff; color: #1f1f1f;
  font-weight: 600; text-decoration: none;
}
.login svg { width: 20px; height: 20px; }
.plain-button {
  min-height: 44px; margin-top: 20px; padding: 0 18px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); font-size: 14px;
}

.app { width: min(100%, 760px); margin: 0 auto; padding: 16px 16px 130px; }
.hero { padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.brand-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; font-size: 13px; font-weight: 700; }
.brand-mark { width: 34px; height: 34px; padding: 2px; border-radius: 9px; background: #fff; object-fit: contain; }
.hero-lead { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.hero-lead strong { color: var(--text); }
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.summary-card { min-width: 0; padding: 12px 14px; border-radius: 12px; background: var(--brand-soft); }
.summary-label, .summary-note { color: var(--muted); font-size: 12px; }
.summary-value { font-size: 17px; font-weight: 700; }
.notice {
  margin: 12px 0 0; padding: 10px 14px; border-radius: 12px;
  background: var(--warning-soft); color: var(--warning); font-size: 13px;
}

.toolbar { display: flex; align-items: center; gap: 8px; margin: 20px 0 10px; }
.toolbar h2 { margin: 0; font-size: 18px; }
.spacer { flex: 1; }
.icon-button {
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-size: 20px;
}
.icon-button img { width: 24px; height: 24px; }

.calendar { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.row + .row { border-top: 1px solid var(--line); }
.row > * + * { border-left: 1px solid var(--line); }
.dow { padding: 7px 0; background: var(--surface-soft); color: var(--muted); font-size: 12px; text-align: center; }
.day {
  display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; height: 100%;
  min-height: 108px; padding: 8px 2px; border: 0; background: none; color: inherit;
  text-align: center; text-decoration: none;
}
.number { font-size: 15px; font-weight: 700; line-height: 1.2; }
.empty .number { color: var(--muted); font-weight: 400; }
.time { color: var(--muted); font-size: 11px; line-height: 1.25; }
.time span { display: inline-block; }
.name { max-width: 100%; font-size: 12px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
a .name { text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.mark {
  display: grid; place-items: center; width: 32px; height: 32px; margin-top: auto;
  border: 1px solid var(--line); border-radius: 50%; background: var(--surface); font-size: 17px; font-weight: 700; line-height: 1;
}
.label { margin-top: auto; color: var(--muted); font-size: 11px; line-height: 1.3; }
.settled, .waiting-day { background: var(--surface-soft); }
.vote.yes { background: var(--yes-soft); }
.vote.yes .mark { border-color: var(--yes); background: var(--yes); color: var(--on-state); }
.vote.no { background: var(--no-soft); }
.vote.no .mark { border-color: var(--no); background: var(--no); color: var(--on-state); }
.mine { background: var(--brand-soft); box-shadow: inset 0 3px 0 var(--brand); color: var(--brand-strong); }
.mine .time { color: inherit; }
.open-menu { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; color: inherit; text-decoration: none; }
.print {
  display: grid; place-items: center; width: 40px; height: 40px; margin-top: auto; padding: 0;
  border: 1px solid var(--brand); border-radius: 12px; background: var(--surface); color: var(--brand-strong);
}
.print:disabled { cursor: wait; }
.print svg { width: 20px; height: 20px; fill: currentColor; }
.print[aria-busy="true"] svg { display: none; }
.print[aria-busy="true"]::after {
  content: ""; width: 18px; height: 18px; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.camp { display: flex; flex-direction: column; height: 100%; text-align: center; }
.camp > .number { padding: 8px 0 4px; }
.session { display: flex; flex: 1; flex-direction: column; align-items: center; gap: 6px; padding: 6px 2px; background: var(--surface-soft); }
.session + .session { border-top: 1px solid var(--line); }
.session.mine { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.session-label { font-size: 11px; font-weight: 700; }
.empty-note { margin: 0; padding: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; text-align: center; }

.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 10px 2px 0; padding: 0; color: var(--muted); font-size: 12px; list-style: none; }
.legend li::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 5px; border-radius: 50%; background: var(--muted); }
.legend .yes::before { background: var(--yes); }
.legend .no::before { background: var(--no); }
.legend .mine { background: none; box-shadow: none; color: inherit; }
.legend .mine::before { background: var(--brand); }

.save-bar {
  position: fixed; inset: auto 0 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: var(--surface);
}
.save-inner { display: flex; align-items: center; gap: 12px; width: min(100%, 760px); margin: 0 auto; }
.status { flex: 1; min-width: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.status strong { display: block; color: var(--text); font-size: 14px; }
.submit {
  flex: none; min-height: 48px; padding: 0 20px; border: 0; border-radius: 12px;
  background: var(--brand); color: var(--on-brand); font-weight: 700;
}
.submit:disabled { opacity: .45; cursor: default; }

@media (max-width: 620px) {
  .app { padding: 8px 8px 120px; }
  .hero { padding: 18px 16px; }
  .time span { display: block; }
}
