:root {
  --ink: #1F2A44;
  --shu: #B8441F;
  --shu-soft: #F8E6DE;
  --shu-deep: #6E2A13;
  --paper: #F7F4EE;
  --rule: #E4DFD5;
  --muted: #5B5F6B;
  --ok: #2F6B4F;
  --ok-soft: #E3F0E8;
  --sat: #2D5DA8;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); }
body {
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
main { max-width: 480px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
button, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.loading, .empty { padding: 48px 16px; text-align: center; color: var(--muted); }

header.top { background: #fff; border-bottom: 1px solid var(--rule); padding: 16px 16px 0; }
header.top .store { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
header.top .store button { background: none; border: none; color: var(--shu); font-size: 12px; padding: 8px 0; text-decoration: underline; }
header.top h1 { margin: 2px 0 8px; font-size: 20px; }

.tabs { display: grid; grid-template-columns: 1fr 1fr; }
.tabs button { background: none; border: none; border-bottom: 3px solid transparent; min-height: 44px; font-weight: 700; color: var(--muted); }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--shu); }

.body { padding: 14px 16px 120px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.card { background: #fff; border: 1px solid var(--rule); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.card h2 { margin: 0; font-size: 15px; }
.muted { color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.between { justify-content: space-between; }
.chip { font-size: 12px; font-weight: 700; color: var(--shu); background: var(--shu-soft); padding: 3px 8px; border-radius: 8px; white-space: nowrap; }
.chip.ok { color: var(--ok); background: var(--ok-soft); }

.btn { min-height: 44px; border-radius: 10px; border: 1px solid var(--ink); background: #fff; font-weight: 700; padding: 0 12px; }
.btn.primary { background: var(--shu); border-color: var(--shu); color: #fff; min-height: 52px; font-size: 16px; }
.btn.small { min-height: 36px; font-size: 12px; font-weight: 500; border-color: var(--rule); }
.btn:disabled { opacity: .5; cursor: default; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

.names { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.names button { min-height: 52px; border-radius: 10px; border: 1px solid var(--rule); background: #fff; font-size: 16px; font-weight: 700; }

select.month { min-height: 44px; border-radius: 10px; border: 1px solid var(--rule); background: #fff; padding: 0 10px; font-weight: 700; }

.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted); }
.legend b { color: var(--ink); }
.week, .cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.week span { text-align: center; font-size: 11px; color: var(--muted); }
.week span:first-child { color: var(--shu); }
.week span:last-child { color: var(--sat); }
.cal button {
  height: 54px; border-radius: 8px; border: 1px solid var(--rule); background: #fff; padding: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
}
.cal button .d { font-size: 11px; line-height: 1; }
.cal button .m { font-size: 15px; font-weight: 700; line-height: 1.1; min-height: 16px; }
.cal button .tm { font-size: 8px; line-height: 1; }
.cal button.sun .d { color: var(--shu); }
.cal button.sat .d { color: var(--sat); }
.cal button.o { background: var(--ink); border-color: var(--ink); color: #fff; }
.cal button.o .d { color: #fff; }
.cal button.t { background: var(--shu-soft); border-color: #F2C4B2; color: var(--shu-deep); }
.cal button.x { background: #E9E5DC; border-color: #E9E5DC; color: #4A4D57; }

.range { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.range select { min-height: 40px; border: 1px solid var(--rule); border-radius: 8px; background: #fff; padding: 0 6px; }
textarea { width: 100%; min-height: 64px; border: 1px solid var(--rule); border-radius: 10px; padding: 8px 10px; resize: vertical; }
label.field { font-size: 13px; font-weight: 700; }

.footer { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--rule); padding: 10px 16px calc(14px + env(safe-area-inset-bottom)); }
.footer > * { max-width: 448px; margin: 0 auto; width: 100%; display: flex; }
.footer .btn { width: 100%; }
.footer .done { flex: 1; }
.done { background: var(--ok-soft); color: var(--ok); border-radius: 12px; min-height: 52px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; text-align: center; padding: 8px; }

.next { background: var(--ink); color: #fff; border-radius: 12px; padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; }
.next small { color: #D6DAE4; font-size: 11px; display: block; }
.next strong { font-size: 18px; }
.next .pos { background: #3A4563; padding: 4px 10px; border-radius: 10px; font-size: 12px; }

.list { background: #fff; border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; }
.list .item { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 12px; border-bottom: 1px solid #EEE9DF; font-size: 14px; min-height: 48px; }
.list .item:last-child { border-bottom: none; }
.list .item .date { width: 76px; font-weight: 700; flex: none; }
.list .item .time { flex: 1; }
.list .item .time small { display: block; color: var(--muted); font-size: 11px; }
.sub { border-color: #F2C4B2; }
.sub h2 { color: var(--shu); }

#toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; max-width: 90vw; }
#toast.error { background: var(--shu); }
