/* 予約帳（外部CDNなし・システムフォント・落ち着いた青）。お客のページは winter-schedule と同じ色 */
:root {
  --navy: #1f4e79;
  --blue: #2f6fb0;
  --blue-d: #245a92;
  --sky: #eaf2fa;
  --sky-2: #f5f9fd;
  --line: #c6d6e7;
  --text: #1d2733;
  --muted: #5a6876;
  --off-bg: #e9ebee;
  --off-text: #7a828b;
  --ok: #1b7a4a;
  --ok-bg: #e6f4ec;
  --warn: #a34f00;
  --warn-bg: #fff3e3;
  --err: #b42318;
  --err-bg: #fdecea;
  --radius: 10px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--sky-2);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Hiragino Sans",
    "Yu Gothic UI", "Meiryo", "Noto Sans JP", sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

a { color: var(--blue-d); }

[hidden] { display: none !important; }

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 12px 12px 40px;
}

/* 上の固定バー */
.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 6px;
  min-height: 48px;
  padding: 8px 12px;
  background: var(--navy);
  color: #fff;
  font-size: 16px;
  line-height: 1.3;
}
.bar b { font-size: 20px; }
.bar-sep { opacity: .7; }
.bar-mark { min-width: 1.5em; font-size: 15px; }
.bar.ok { background: var(--ok); }
.bar.warn { background: #8a4a00; }

.preview-bar {
  padding: 8px 12px;
  background: #fffbe6;
  border-bottom: 1px solid #e8d9a8;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}

.toast {
  position: sticky;
  top: 48px;
  z-index: 19;
  margin: 0;
  padding: 10px 14px;
  background: #fffbe6;
  border-bottom: 1px solid #e8d9a8;
  color: var(--text);
  font-size: 15px;
  text-align: center;
}

/* 見出し */
.head { padding: 8px 4px 4px; }
.school { margin: 0; color: var(--muted); font-size: 14px; }
h1 { margin: 2px 0 8px; color: var(--navy); font-size: 22px; line-height: 1.35; overflow-wrap: anywhere; }
.lead { margin: 0 0 10px; }
.period {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  margin: 0 0 6px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 15px;
}
.period dt { color: var(--navy); font-weight: 700; }
.period dd { margin: 0; }

/* カード */
.card {
  margin: 12px 0;
  padding: 14px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.card h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  color: var(--navy);
  font-size: 18px;
}
.card h3 { margin: 14px 0 6px; color: var(--navy); font-size: 16px; }
.num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-size: 15px;
  flex: none;
}

.hint { margin: 0 0 6px; color: var(--muted); font-size: 14px; }
.note {
  margin: 12px 0;
  padding: 10px 12px;
  background: var(--sky);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.note.warn { background: var(--warn-bg); border-color: #f0c99a; }
.note.ok { background: var(--ok-bg); border-color: #a9d8bd; }
.notice {
  margin: 10px 0 0;
  padding: 8px 10px;
  background: #fffbe6;
  border: 1px solid #e8d9a8;
  border-radius: 8px;
  font-size: 15px;
}

/* 入力 */
.field { margin: 0 0 14px; }
.field:last-child { margin-bottom: 0; }
.lab { display: block; margin: 0 0 4px; font-weight: 700; }
.lab em {
  margin-left: 8px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--sky);
  color: var(--navy);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  vertical-align: 2px;
}
input[type="text"], input[type="number"], input[type="email"], input[type="tel"], input[type="date"],
select, textarea {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid #9fb6cd;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 16px; /* iOS のズームを防ぐ */
}
textarea { min-height: 64px; resize: vertical; }
input[type="date"] { min-width: 0; max-width: 100%; -webkit-appearance: none; appearance: none; }
input:focus, select:focus, textarea:focus, button:focus-visible, .seg-item input:focus-visible + span {
  outline: 3px solid #8fb8e3;
  outline-offset: 1px;
}
.count-wrap { display: flex; align-items: center; gap: 8px; }
.count-wrap input { width: 110px; }

/* コースの切り替え */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg.cols-1 { grid-template-columns: 1fr; }
.seg.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.seg.cols-3 .seg-item span { padding: 6px 4px; font-size: 15px; }
.seg-item { position: relative; display: block; }
.seg-item input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg-item span {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  height: 100%;
  padding: 6px 8px;
  border: 2px solid var(--blue);
  border-radius: 8px;
  background: #fff;
  color: var(--blue-d);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.seg-item input:checked + span { background: var(--blue); color: #fff; }

/* 日付ごとの行 */
.days { border-top: 1px solid var(--line); }
.day {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  border-bottom: 1px solid #e3ebf3;
}
.day.wk { border-top: 2px solid var(--line); }
.dl { font-weight: 700; font-size: 15px; white-space: nowrap; letter-spacing: -.02em; }
.dl small { margin-left: 1px; font-size: 13px; font-weight: 400; }
.day.sun .dl small { color: #b42318; }
.day.sat .dl small { color: var(--blue-d); }
.day.closed { background: var(--off-bg); color: var(--off-text); }
.day.closed .dl { padding-left: 4px; }
.day.closed .dl small { color: inherit; }
.days.weekly .day { padding: 8px 0; }   /* 週間の通塾予定表（月〜日の7行） */
.off { padding: 10px 4px 10px 8px; font-size: 15px; }
.cellwrap { min-width: 0; }
.cells { display: grid; gap: 5px; }
.cells.cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.cells.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cells.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cells.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cells .none { grid-column: 1 / -1; padding: 10px 4px; color: var(--off-text); font-size: 14px; }
.ph {
  min-height: 44px;
  border-radius: 8px;
  background: repeating-linear-gradient(45deg, #f1f3f5, #f1f3f5 6px, #e8ebee 6px, #e8ebee 12px);
}
.slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 44px;
  padding: 4px 2px;
  border: 2px solid var(--blue);
  border-radius: 8px;
  background: #fff;
  color: var(--blue-d);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.02em;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.slot .rem { font-size: 11px; font-weight: 400; }
.slot.on { background: var(--blue); color: #fff; }
.slot.on .t::before { content: "✓"; margin-right: 1px; font-size: 13px; }
.slot:disabled { border-color: #b8c2cc; color: #9aa4ae; cursor: not-allowed; }
.slot.full { background: #f1f3f5; }

/* ハニーポット（画面に出さない） */
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* 送信 */
.err {
  margin: 12px 0;
  padding: 10px 12px;
  background: var(--err-bg);
  border: 1px solid #f1b8b3;
  border-radius: var(--radius);
  color: var(--err);
  font-weight: 700;
}
.err ul { margin: 4px 0 0; padding-left: 1.2em; }
.send {
  display: block;
  width: 100%;
  min-height: 56px;
  margin: 16px 0 8px;
  border: 0;
  border-radius: var(--radius);
  background: var(--navy);
  color: #fff;
  font: inherit;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}
.send:disabled { background: #9aa9b8; cursor: not-allowed; }
.sub {
  display: block;
  width: 100%;
  min-height: 48px;
  margin: 10px 0 0;
  border: 2px solid var(--blue);
  border-radius: var(--radius);
  background: #fff;
  color: var(--blue-d);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.tel { margin: 8px 0 0; font-size: 15px; text-align: center; }
.tel a, .tel-big a { font-weight: 700; white-space: nowrap; }
.tel-big { margin: 8px 0 0; font-size: 22px; text-align: center; }
.closed-box { background: var(--warn-bg); border-color: #f0c99a; }
.closed-box p { margin: 0; }

/* 完了画面 */
.done h2 { color: var(--ok); }
.done:focus { outline: none; }
.done-list { margin: 0; padding: 0; list-style: none; }
.done-list li { padding: 6px 2px; border-bottom: 1px solid #e3ebf3; font-weight: 700; }
.editbox {
  margin: 16px 0 0;
  padding: 12px;
  background: var(--sky);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.editbox h3 { margin-top: 0; }
.editbox p { margin: 0 0 6px; }
.link { word-break: break-all; font-size: 14px; }

.foot { margin: 20px 0 0; color: var(--muted); font-size: 13px; text-align: center; }

/* ------------------------------------------------------------------ 教室の画面 */
.t-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 6px 12px;
  background: var(--navy);
  color: #fff;
}
.t-brand { color: #fff; font-weight: 700; text-decoration: none; white-space: nowrap; }
.t-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; opacity: .9; }
.t-top form { margin: 0 0 0 auto; }
.t-logout {
  min-height: 44px;
  padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, .6);
  border-radius: 8px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.crumb { margin: 4px 0 0; font-size: 14px; }
.crumb a { display: inline-block; min-height: 44px; padding: 11px 0; }

.btn, .btn-sub, .btn-warn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 8px 16px;
  border: 2px solid var(--navy);
  border-radius: var(--radius);
  background: var(--navy);
  color: #fff;
  font: inherit;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.btn-sub { background: #fff; color: var(--blue-d); border-color: var(--blue); }
.btn-warn { background: #fff; color: var(--err); border-color: #e3a29c; }
.btn.small, .btn-sub.small, .btn-warn.small { min-height: 44px; padding: 6px 12px; font-size: 14px; }
.btn.wide, .btn-sub.wide { display: flex; width: 100%; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }
.btns form { margin: 0; }
.btn[disabled] { opacity: .6; cursor: wait; }

.terms { margin: 0; padding: 0; list-style: none; }
.term-item { padding: 12px 0; border-bottom: 1px solid #e3ebf3; }
.term-item:last-child { border-bottom: 0; }
.term-item h3 { margin: 0 0 2px; font-size: 17px; overflow-wrap: anywhere; }
.term-item h3 a { text-decoration: none; }
.term-meta { margin: 0; color: var(--muted); font-size: 14px; }
.badge {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 8px;
  border-radius: 99px;
  background: var(--sky);
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
  vertical-align: 2px;
}
.badge.open { background: var(--ok-bg); color: var(--ok); }
.badge.draft { background: #fffbe6; color: #7a5a00; }
.badge.closed { background: var(--off-bg); color: var(--off-text); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: 15px; }
.kv dt { color: var(--navy); font-weight: 700; }
.kv dd { margin: 0; overflow-wrap: anywhere; }

.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 700; cursor: pointer; }
.check input { width: 22px; height: 22px; flex: none; }

/* 「次に欲しいもの」投票（教室のホームの1枚） */
.wish-lead { margin: 0 0 4px; }
.wish-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; margin: 12px 0 14px; }
.wish-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 700;
  line-height: 1.35;
  cursor: pointer;
}
.wish-item input { width: 22px; height: 22px; margin: 0; flex: none; }
.wish-item span { min-width: 0; overflow-wrap: anywhere; }
.wish-item small { display: block; color: var(--muted); font-size: 13px; font-weight: 400; }
.wish-item:has(input:checked) { background: var(--sky); border-color: var(--blue); }
.wish-other textarea { min-height: 88px; }
.wish-done { margin: 0 0 4px; padding: 0; list-style: none; }
.wish-done li { padding: 6px 2px; border-bottom: 1px solid #e3ebf3; font-weight: 700; overflow-wrap: anywhere; }
.wish-text { display: block; font-weight: 400; white-space: pre-line; }
.wish-keep { margin: 0; font-size: 14px; text-align: center; }
.wish-keep a { display: inline-block; min-height: 44px; padding: 11px 8px; }

/* 期の管理 */
.copybox { margin: 0 0 12px; }
.copybox textarea, .copybox input { font-size: 14px; }
.copybox .url { display: block; padding: 10px 12px; background: var(--sky); border-radius: 8px; word-break: break-all; font-size: 14px; }
.qr-img { display: block; width: 180px; max-width: 60%; height: auto; margin: 6px 0; border: 1px solid var(--line); background: #fff; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 8px; padding: 0; list-style: none; }
.stats li { padding: 8px 4px; background: var(--sky); border-radius: 8px; text-align: center; }
.stats li.warn { background: var(--warn-bg); }
.stats li.ok { background: var(--ok-bg); }
.stats b { display: block; color: var(--navy); font-size: 24px; line-height: 1.2; }
.stats span { font-size: 12px; }
.students { margin: 0; padding: 0; list-style: none; }
.student { padding: 10px 0; border-bottom: 1px solid #e3ebf3; }
.student.warn { background: var(--warn-bg); padding-left: 8px; padding-right: 8px; }
.student p { margin: 0 0 2px; overflow-wrap: anywhere; }
.st-count { font-weight: 700; }
.st-count .bad { color: var(--err); }
.st-slots, .st-note { font-size: 14px; }
.st-foot { color: var(--muted); font-size: 13px; }
.st-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 0; }
.st-actions form { margin: 0; }
.g-day { padding: 8px 0; border-bottom: 1px solid #e3ebf3; }
.g-day.closed { background: var(--off-bg); color: var(--off-text); padding-left: 6px; }
.g-day .off { padding: 0; }
.g-date { margin: 0 0 4px; font-weight: 700; }
.g-slots { margin: 0; padding: 0; list-style: none; }
.g-slot { display: grid; grid-template-columns: 76px 1fr; gap: 0 8px; padding: 3px 0; font-size: 14px; }
.g-slot.empty { color: var(--off-text); }
.g-slot.full .g-num { color: var(--err); font-weight: 700; }
.g-time { font-weight: 700; }
.g-num small { color: var(--muted); }
.g-names { grid-column: 2; color: var(--text); overflow-wrap: anywhere; }
details.hist summary { min-height: 44px; padding: 10px 0; color: var(--navy); font-weight: 700; cursor: pointer; }
.hist-list { margin: 0; padding: 0; list-style: none; font-size: 14px; }
.hist-list li { padding: 4px 0; border-bottom: 1px solid #eef2f6; }

/* 期の設定画面 */
.ed-sec h2 { font-size: 17px; }
.ed-row { display: grid; gap: 8px; margin: 0 0 10px; }
.ed-row > * { min-width: 0; }
.ed-row.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.ed-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ed-row label { display: block; font-size: 14px; font-weight: 700; color: var(--navy); }
.ed-row input, .ed-row select { min-height: 44px; padding: 8px 10px; }
.ed-row input[type="date"] { padding: 8px 6px; }
.ed-box { margin: 0 0 10px; padding: 10px; background: var(--sky-2); border: 1px solid var(--line); border-radius: 8px; }
.ed-box-head { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-weight: 700; color: var(--navy); }
.ed-box-head span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ed-del {
  min-height: 44px;
  min-width: 44px;
  padding: 4px 10px;
  border: 1px solid #e3a29c;
  border-radius: 8px;
  background: #fff;
  color: var(--err);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.ed-add {
  min-height: 44px;
  padding: 6px 12px;
  border: 2px dashed var(--blue);
  border-radius: 8px;
  background: #fff;
  color: var(--blue-d);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.ed-wd { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin: 0 0 14px; }
.ed-sec summary { min-height: 44px; padding: 10px 0; color: var(--navy); font-weight: 700; cursor: pointer; }
.ed-wd label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 700;
  cursor: pointer;
}
.ed-wd input { width: 20px; height: 20px; margin: 2px 0 0; }
.ed-wdp { display: grid; grid-template-columns: 2.2em 1fr; gap: 4px 8px; align-items: center; }
.ed-wdp select { min-height: 44px; }
/* 週間の通塾予定表：いまの1週間（月〜日の時刻） */
.ed-week { margin: 0 0 12px; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.ed-week li { display: grid; grid-template-columns: 2.2em minmax(0, 1fr); gap: 8px; padding: 6px 4px; border-bottom: 1px solid #e3ebf3; font-size: 14px; overflow-wrap: anywhere; }
.ed-week li.off { background: var(--off-bg); color: var(--off-text); }
.ed-err { color: var(--err); font-size: 14px; font-weight: 700; margin: 4px 0 0; }
.ed-help { margin: 0 0 6px; color: var(--muted); font-size: 13px; }
.ed-status { display: grid; gap: 6px; }
.ed-status label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}
.ed-status input { width: 22px; height: 22px; margin: 2px 0 0; flex: none; }
.ed-status small { display: block; color: var(--muted); font-weight: 400; }
.ed-foot {
  position: sticky;
  bottom: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 8px;
  margin: 12px -12px 0;
  padding: 10px 12px;
  background: rgba(245, 249, 253, .97);
  border-top: 1px solid var(--line);
}

/* 日付ごとの型のカレンダー */
.cal-month { margin: 8px 0 12px; }
.cal-title { margin: 0 0 4px; font-weight: 700; color: var(--navy); }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.cal .wd { font-size: 12px; text-align: center; color: var(--muted); }
.cal button, .cal .blank {
  min-height: 44px;
  min-width: 0;
  padding: 2px 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  line-height: 1.1;
  cursor: pointer;
}
.cal .blank { border: 0; background: transparent; cursor: default; }
.cal button b { display: block; font-size: 12px; color: var(--blue-d); }
.cal button.set { background: var(--sky); border-color: var(--blue); }
.cal button.set b { color: var(--navy); }
.cal button.off { background: var(--off-bg); color: var(--off-text); }
.cal button.off b { color: var(--off-text); }

@media (min-width: 560px) {
  .day { grid-template-columns: 72px minmax(0, 1fr); }
  .slot { font-size: 16px; }
  .wish-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 380px) {
  .ed-row.three { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
