:root {
  /* ラベンダーと水色の間 (ペリウィンクル) を基調にした配色 */
  --bg: #f6f7fc;
  --surface: #ffffff;
  --ink: #2e3044;
  --muted: #777b93;
  --line: #e2e5f1;
  --accent: #5f6fc4;
  --accent-ink: #ffffff;
  --accent-soft: #eaedfb;
  --few: #c47f22;
  --few-bg: #fcf3e4;
  --full: #9ea2b6;
  --full-ink: #5d6178;
  --full-bg: #e5e8f1;
  --blocked: #a05c7c;
  --blocked-bg: #f6e8ef;
  --faint: #c6c9d8;
  --dim: #f2f3f9;
  --danger: #b8405a;
  --danger-soft: #fbe9ee;
  --shadow: 32, 38, 82;
  --sun: #d0485e;
  --sat: #3a78c2;
  --radius: 12px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
/* ダブルタップ拡大の待ち時間をなくして、連続タップしても反応よく */
button, a, input, select, textarea, label, td.clickable, th.clickable { touch-action: manipulation; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
  font-size: 15px;
  line-height: 1.6;
}
a { color: var(--accent); }
h2 { font-size: 1.05rem; margin: 24px 0 8px; }

.wrap { max-width: 920px; margin: 0 auto; padding: 0 16px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row.tight { justify-content: flex-start; gap: 8px; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .85rem; margin: 0 0 10px; }

/* ---------- ヘッダー ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding-top: 18px;
  margin-bottom: 16px;
}
.site-header > .wrap:first-child { padding-bottom: 14px; }
.site-header h1 { margin: 0; font-size: 1.35rem; letter-spacing: .04em; }
.site-header .sub { margin: 2px 0 0; color: var(--muted); font-size: .85rem; }

.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs button {
  flex: none;
  border: 0;
  background: none;
  font: inherit;
  font-size: .9rem;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 3px solid transparent;
  cursor: pointer;
}
.tabs button.active { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }

/* ---------- 共通部品 ---------- */
.notice, .card, .contact {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 0 0 16px;
}
.notice { background: var(--accent-soft); border-color: transparent; }
.contact h2 { margin-top: 0; }

/* 料金表 */
.jump-links { margin: -6px 0 14px; font-size: .88rem; text-align: right; }
.menu {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px 10px;
  margin: 0 0 16px;
  scroll-margin-top: 12px;
}
.menu h2 { margin-top: 0; }
.menu-head { font-size: 1rem; margin: 18px 0 4px; padding-bottom: 4px; border-bottom: 2px solid var(--accent-soft); }
.menu h2 + .menu-head { margin-top: 4px; }
h4.menu-head { font-size: .9rem; color: var(--accent); border-bottom: 0; margin: 12px 0 0; padding: 0; }
.menu-row { display: flex; align-items: baseline; gap: 12px; padding: 6px 0; border-bottom: 1px dotted var(--line); }
.menu-row .menu-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.menu-row .menu-price { white-space: nowrap; font-weight: 600; font-variant-numeric: tabular-nums; }
.menu-row.group { border-bottom: 0; padding-bottom: 0; font-weight: 600; }
.menu-row.sub { padding-left: 1.2em; font-size: .92rem; }
.menu-row.gap, .menu-note.gap { margin-top: 10px; }
.menu-note { margin: 6px 0; font-size: .85rem; color: var(--muted); overflow-wrap: anywhere; }

/* ご予約の注意事項: 書かれた改行・空行をそのまま表示 */
.rules-link {
  display: block;
  margin: 0 0 14px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--ink);
  font-size: .88rem;
  text-decoration: none;
}
.rules {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 0 0 16px;
  scroll-margin-top: 12px;
}
.rules h2 { margin-top: 0; }
.rules-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .9rem; line-height: 1.8; }
.contact p { margin: 0; overflow-wrap: anywhere; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  padding: 9px 18px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .35; cursor: default; border-color: var(--line); }
.btn.small { padding: 5px 12px; font-size: .85rem; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: var(--danger-soft); }
.btn.block { width: 100%; }

.seg { display: inline-flex; background: var(--line); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button {
  border: 0;
  background: transparent;
  padding: 6px 16px;
  border-radius: 999px;
  font: inherit;
  font-size: .9rem;
  color: var(--muted);
  cursor: pointer;
}
.seg button.active { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }

.toolbar { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 12px; }
.nav { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.nav > span { flex: 1; text-align: center; font-weight: 600; }

.view { transition: opacity .15s; }
.view.loading { opacity: .5; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line); }

/* ---------- 週の表 ---------- */
.grid-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
table.grid { border-collapse: separate; border-spacing: 0; width: 100%; table-layout: fixed; font-size: .9rem; }
.grid th, .grid td {
  border-bottom: 1px solid var(--line);
  border-left: 1px solid var(--line);
  text-align: center;
  padding: 0 2px;
}
.grid tr > :first-child { border-left: 0; }
.grid tbody tr:last-child > * { border-bottom: 0; }
.grid thead th { background: var(--surface); font-weight: 600; line-height: 1.25; padding: 8px 2px; }
.grid th.time, .grid th.corner {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
  width: 54px;
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: .82rem;
  box-shadow: 1px 0 0 var(--line);
}
.grid .md { display: block; }
.grid .wd { display: block; font-size: .75rem; color: var(--muted); font-weight: 400; }
.grid .sun .md, .grid .sun .wd { color: var(--sun); }
.grid .sat .md, .grid .sat .wd { color: var(--sat); }
.grid th.today { background: var(--accent-soft); }
.grid .note { display: block; font-size: .65rem; color: var(--accent); font-weight: 400; margin-top: 2px; overflow-wrap: anywhere; }
.grid th.clickable { cursor: pointer; }
.grid th.clickable:hover { background: var(--accent-soft); }

td.slot { height: 40px; font-size: 1.1rem; }
td.slot.open { color: var(--accent); font-weight: 700; }
td.slot.few { color: var(--few); font-weight: 700; }
td.slot.full { color: var(--full); }
td.slot.past, td.none { color: var(--faint); background: var(--dim); }
td.whole { background: var(--dim); color: var(--muted); vertical-align: middle; }
.vert { writing-mode: vertical-rl; letter-spacing: .3em; font-size: .85rem; }
td.clickable { cursor: pointer; user-select: none; }
td.clickable:hover, td.clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* 管理画面の枠 */
.admin td.slot { font-size: .85rem; font-weight: 600; }
.admin td.slot.open { color: var(--accent); background: var(--surface); }
.admin td.slot.few { color: var(--few); background: var(--few-bg); }
.admin td.slot.full { color: var(--full-ink); background: var(--full-bg); }
.admin td.slot.blocked { color: var(--blocked); background: var(--blocked-bg); }
.admin td.slot.closed { color: var(--faint); background: var(--dim); font-weight: 500; }
.admin td.slot.past { opacity: .45; }

/* ---------- 月カレンダー ---------- */
.month {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
}
.mh { text-align: center; font-size: .8rem; color: var(--muted); padding: 4px 0; }
.mh.sun { color: var(--sun); }
.mh.sat { color: var(--sat); }
.mc {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 60px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 4px 0;
}
button.mc { cursor: pointer; }
button.mc:hover { background: var(--accent-soft); }
.mc .dn { font-size: .85rem; }
.mc.sun .dn { color: var(--sun); }
.mc.sat .dn { color: var(--sat); }
.mc .sym { font-size: 1.2rem; font-weight: 700; line-height: 1; }
.mc.open .sym { color: var(--accent); }
.mc.few .sym { color: var(--few); }
.mc.full .sym { color: var(--full); }
.mc.closed { background: var(--dim); }
.mc.closed .sym { color: var(--muted); font-size: .8rem; font-weight: 600; }
.mc.past, .mc.na { opacity: .4; }
.mc.today { box-shadow: inset 0 0 0 2px var(--accent); }
.admin .mc .sym { font-size: .8rem; }

/* 休みの日カレンダー */
.month.hol .mc { opacity: 1; }
.month.hol .mc.past { opacity: .35; }
.month.hol .sym { font-size: .72rem; font-weight: 600; }
.mc.workday .sym { color: var(--faint); }
.mc.changed .sym { color: var(--accent); }
.mc.regular-off { background: var(--dim); }
.mc.regular-off .sym { color: var(--muted); }
.mc.holiday, button.mc.holiday:hover { background: var(--accent); }
.mc.holiday .dn, .mc.holiday .sym { color: var(--accent-ink) !important; }
.tag.holiday { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tag.regular-off { background: var(--dim); color: var(--muted); }
.tag.changed { color: var(--accent); background: var(--surface); }

/* ---------- 凡例 ---------- */
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 0; margin: 12px 0 4px; font-size: .85rem; color: var(--muted); }
.legend b { margin-right: 4px; }
.c-open { color: var(--accent); }
.c-few { color: var(--few); }
.c-full { color: var(--full); }
.c-past { color: var(--faint); }
.tag { display: inline-block; font-size: .75rem; padding: 1px 6px; border-radius: 4px; border: 1px solid var(--line); }
.tag.open { color: var(--accent); background: var(--surface); }
.tag.closed { color: var(--faint); background: var(--dim); }
.tag.few { color: var(--few); background: var(--few-bg); }
.tag.full { color: var(--full-ink); background: var(--full-bg); }
.tag.blocked { color: var(--blocked); background: var(--blocked-bg); }
.updated { font-size: .8rem; color: var(--muted); margin: 0 0 16px; }

/* ---------- フォーム ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; }
input, select, textarea {
  font: inherit;
  font-size: 16px; /* 16px 未満だと iPhone で入力時に画面が拡大される */
  color: inherit;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  max-width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { resize: vertical; }
.form .btn.primary { align-self: flex-start; }
.form label.check, label.check { flex-direction: row; align-items: center; gap: 6px; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 18px; height: 18px; }
.radio-row { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.radio-row label { flex-direction: row; align-items: center; gap: 6px; }
.special-hours { align-items: flex-end; }
.tilde { color: var(--muted); padding-bottom: 8px; }

.hours-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.hours-row:last-child { border-bottom: 0; margin-bottom: 12px; }
.hours-row .wdname { width: 2.5em; font-weight: 600; }
.hours-row.sun .wdname { color: var(--sun); }
.hours-row.sat .wdname { color: var(--sat); }
.hours-row .times { display: flex; align-items: center; gap: 6px; }
.hours-row .times .tilde { padding: 0; }
.hours-row.off .times { opacity: .35; pointer-events: none; }

.list { list-style: none; padding: 4px 16px; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }

/* ---------- ダイアログ ---------- */
dialog {
  border: 0;
  border-radius: 16px;
  padding: 20px;
  width: min(92vw, 380px);
  color: var(--ink);
  box-shadow: 0 10px 40px rgba(var(--shadow), .25);
}
dialog::backdrop { background: rgba(32, 38, 82, .35); } /* ::backdrop は古いブラウザで変数を継承しない */
dialog h3 { margin: 0 0 8px; }
dialog .lbl { margin: 8px 0 6px; font-size: .9rem; color: var(--muted); }
.count-buttons { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.count-buttons button {
  font: inherit;
  padding: 8px 12px;
  min-width: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}
.count-buttons button.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.stack { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: .9rem;
  z-index: 100;
  max-width: calc(100vw - 32px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .2);
}
.toast.error { background: var(--danger); }

/* ---------- ログイン ---------- */
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login-box { width: min(100%, 360px); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px 24px; }
.login-box h1 { margin: 0; font-size: 1.3rem; text-align: center; }
.login-box .sub { margin: 0 0 20px; text-align: center; color: var(--muted); font-size: .85rem; }
.login-box .error { background: var(--danger-soft); color: var(--danger); padding: 8px 12px; border-radius: 8px; font-size: .88rem; }
.login-box .back { text-align: center; font-size: .85rem; margin: 16px 0 0; }
.login-box .hint { margin-bottom: 16px; }
.linklike { border: 0; background: none; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }

/* ---------- スマホ ---------- */
@media (max-width: 600px) {
  body { font-size: 14px; }
  .wrap { padding: 0 12px; }
  .site-header { padding-top: 14px; margin-bottom: 12px; }
  .site-header > .wrap:first-child { padding-bottom: 10px; }
  .site-header h1 { font-size: 1.15rem; }
  .seg button { padding: 7px 14px; }
  .nav > span { font-size: .88rem; }
  .btn.small { padding: 7px 10px; }

  /* 1週間分が横スクロールなしで収まるように */
  .grid th.time, .grid th.corner { width: 42px; font-size: .72rem; padding: 0 2px; }
  .grid thead th { padding: 6px 0; font-size: .82rem; }
  .grid .wd { font-size: .68rem; }
  td.slot { height: 48px; font-size: 1.05rem; }
  .admin td.slot { font-size: .78rem; }
  .vert { font-size: .75rem; letter-spacing: .2em; }

  .month { gap: 2px; padding: 6px 4px; }
  .mc { min-height: 54px; }

  .card, .notice, .contact { padding: 12px 14px; }
  .form .btn.primary, #hours-form .btn.primary { align-self: stretch; width: 100%; padding: 12px; }
  .tabs { gap: 0; justify-content: space-between; }
  .tabs button { padding: 10px 6px; font-size: .85rem; }
  .hours-row { gap: 6px 10px; }
  .hours-row .times { width: 100%; }
  .hours-row .times input { flex: 1; min-width: 0; }
  .special-hours label { flex: 1; min-width: 0; }

  /* ダイアログは画面下からのシート風に */
  dialog { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 16px 16px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); }
  .stack .btn { padding: 12px; }
  .actions .btn { flex: 1; padding: 12px; }
  .count-buttons button { flex: 1 0 auto; padding: 10px; }
}
