/* モットバ！部屋予約：共通スタイル
   配色は運営事業者サイト（agewelljapan.co.jp）に合わせる：
     メイン #ea5539（朱色）／白／文字 #333〜#222／灰 #f5f5f5・#e3e3e3／差し色の緑 #45d386／丸いボタン。
   白文字を載せる塗りは、文字のコントラスト4.5:1を満たすよう少し濃い朱色（#cf4526）を使う。
   方針：本文18px相当（rem基準で文字拡大に追従）、主要ボタンは高さ56px以上、状態は色だけでなく文字でも示す。 */
:root {
  --bg: #f5f6f7;
  --surface: #ffffff;
  --text: #222222;
  --sub: #555555;
  --line: #e3e3e3;
  --line-strong: #bcbcbc;
  --brand: #ea5539;
  --primary: #cf4526;
  --primary-dark: #b0391d;
  --primary-soft: #fdece7;
  --free: #45d386;
  --free-bg: #e6f9ef;
  --free-text: #0b6238;
  --none-bg: #efefef;
  --none-text: #555555;
  --mine-bg: #fdece7;
  --mine-text: #9c3216;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --warn-bg: #fff6e0;
  --warn-text: #6b4200;
  --focus: #1456c8;
  --radius: 1rem;
  /* 文字を大きくしても余白が画面を食いつぶさないよう、画面幅でも上限を設ける */
  --pad: min(0.85rem, 4vw);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 112.5%; /* 既定16pxのとき18px。利用者の文字サイズ設定に追従する */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Noto Sans JP', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic UI', 'Yu Gothic', Meiryo, system-ui,
    sans-serif;
  line-height: 1.55;
  overflow-wrap: anywhere;
  line-break: strict;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 1.33rem;
  line-height: 1.35;
}

h2 {
  font-size: 1.11rem;
  line-height: 1.35;
}

h3 {
  font-size: 1rem;
  line-height: 1.35;
}

h1:focus {
  outline: none;
}

a {
  color: var(--primary-dark);
  text-underline-offset: 0.2em;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.nowrap {
  white-space: nowrap;
}

.sub {
  color: var(--sub);
}

.small {
  font-size: 0.89rem;
}

/* ---- 枠組み ---- */
.demo-bar {
  background: var(--warn-bg);
  color: var(--warn-text);
  text-align: center;
  font-size: 0.78rem;
  padding: 0.15rem 0.5rem;
}

.site-header {
  background: var(--surface);
  border-bottom: 3px solid var(--brand);
}

.site-header .inner {
  max-width: 40rem;
  margin: 0 auto;
  padding: 0 var(--pad);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 1rem;
}

.brand {
  font-weight: 700;
  font-size: 1.06rem;
  color: var(--text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.brand b {
  color: var(--primary);
}

.who {
  font-size: 0.83rem;
  color: var(--sub);
}

main {
  max-width: 40rem;
  margin: 0 auto;
  padding: 0.6rem var(--pad) 3rem;
}

.stack > * + * {
  margin-top: 0.65rem;
}

.stack-lg > * + * {
  margin-top: 1rem;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 0.75rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  min-width: 44px;
  font-weight: 600;
  font-size: 0.94rem;
}

/* ---- ボタン（運営サイトに合わせた丸い形）---- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 56px;
  padding: 0.55rem var(--pad);
  border: 2px solid var(--primary);
  border-radius: 100vmax;
  background: var(--surface);
  color: var(--primary-dark);
  font: inherit;
  font-weight: 700;
  font-size: 1.06rem;
  line-height: 1.35;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.btn:hover {
  background: var(--primary-soft);
}

.btn.primary {
  background: var(--primary);
  color: #fff;
}

.btn.primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn.danger-outline {
  border-color: var(--danger);
  color: var(--danger);
}

.btn.danger-outline:hover {
  background: var(--danger-soft);
}

.btn.quiet {
  border-color: var(--line-strong);
  color: var(--text);
  font-weight: 600;
}

.btn.quiet:hover {
  background: #f5f5f5;
}

.btn.compact {
  min-height: 48px;
  font-size: 0.94rem;
  padding: 0.3rem 0.6rem;
}

.btn.inline {
  width: auto;
}

.btn[aria-busy='true'],
.btn:disabled {
  opacity: 0.75;
  cursor: progress;
}

.btn-col {
  display: grid;
  gap: 0.6rem;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.link-btn {
  background: none;
  border: none;
  padding: 0.5rem 0.25rem;
  min-height: 44px;
  font: inherit;
  color: var(--primary-dark);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

/* ---- カード・お知らせ ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--pad);
}

.notice {
  border-radius: 0.6rem;
  padding: 0.55rem var(--pad);
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 6px solid var(--line-strong);
}

.notice.ok {
  background: var(--free-bg);
  border-color: #9be3bd;
  border-left-color: var(--free);
}

.notice.info {
  border-left-color: var(--brand);
}

.notice.warn {
  background: var(--warn-bg);
  border-color: #ecd9a6;
  border-left-color: #d9a520;
}

.notice.error {
  background: var(--danger-soft);
  border-color: #eaa49c;
  border-left-color: var(--danger);
}

.notice .title {
  font-weight: 700;
  font-size: 1.11rem;
}

.chip {
  display: inline-block;
  padding: 0 0.6rem;
  border-radius: 100vmax;
  font-size: 0.83rem;
  font-weight: 700;
  white-space: nowrap;
  border: 1.5px solid transparent;
}

.chip.free {
  background: var(--free-bg);
  color: var(--free-text);
  border-color: var(--free);
}

.chip.mine {
  background: var(--mine-bg);
  color: var(--mine-text);
  border-color: var(--brand);
}

.chip.cancelled,
.chip.done {
  background: var(--none-bg);
  color: var(--none-text);
  border-color: var(--line-strong);
}

.chip.prov {
  background: var(--warn-bg);
  color: var(--warn-text);
  border-color: #d9a520;
}

/* ---- 予約1件の表示（日付・曜日・時間・部屋をひとまとめに）---- */
.resv .when {
  font-weight: 700;
}

.resv .main-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.7rem;
  font-weight: 700;
  font-size: 1.28rem;
  line-height: 1.35;
}

.resv .room {
  font-size: 1.11rem;
}

.resv.cancelled .when,
.resv.cancelled .main-line {
  color: var(--sub);
  font-weight: 600;
}

.resv-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.resv-list > li + li {
  border-top: 1px solid var(--line);
  margin-top: 0.45rem;
  padding-top: 0.45rem;
}

.resv-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.3rem 0.75rem;
}

.resv-row .resv {
  flex: 1 1 11rem;
  min-width: 0;
}

.resv-row .cancel-error {
  flex-basis: 100%;
}

.resv-row .cancel-error:empty {
  display: none;
}

ul.resv-list.card {
  padding: var(--pad);
}

/* ---- 日付の選択（1行）---- */
.date-now {
  font-size: 1.33rem;
  font-weight: 700;
  line-height: 1.3;
}

.date-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 5.2rem), 1fr));
  gap: 0.4rem;
}

.date-nav > * {
  min-width: 0;
}

.date-pick {
  position: relative;
}

.date-pick input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  opacity: 0;
  cursor: pointer;
}

.date-pick:focus-within .btn {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.field label,
.field .label {
  display: block;
  font-weight: 700;
}

input[type='date'],
input[type='time'],
input[type='text'],
input[type='number'],
select {
  width: 100%;
  min-height: 52px;
  padding: 0.35rem 0.7rem;
  border: 2px solid #8a8a8a;
  border-radius: 0.6rem;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 1.17rem;
  min-width: 0;
  max-width: 100%;
}

.field,
.time-grid > *,
.len-row > * {
  min-width: 0;
}

input[type='checkbox'],
input[type='radio'] {
  width: 1.4rem;
  height: 1.4rem;
  accent-color: var(--primary);
  flex: none;
}

.check {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 48px;
}

/* ---- 空いている時間（部屋を横に並べる）---- */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.9rem;
  font-size: 0.83rem;
  color: var(--sub);
}

.legend i {
  display: inline-block;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 4px;
  vertical-align: -0.1rem;
  margin-right: 0.3rem;
  border: 1.5px solid;
}

.legend .f {
  background: var(--free-bg);
  border-color: var(--free);
}

.legend .m {
  background: var(--mine-bg);
  border-color: var(--brand);
}

.room-grid {
  display: grid;
  gap: 0.4rem;
  align-items: start;
}

.room-grid.cols-3 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 5.4rem), 1fr));
}

.room-grid.cols-2 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr));
}

.room-col {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  padding: 0.35rem;
  min-width: 0;
}

.room-col h3 {
  text-align: center;
  font-size: 0.94rem;
  padding-bottom: 0.2rem;
}

.slot-list {
  display: grid;
  gap: 0.3rem;
}

.slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 0.15rem 0.2rem;
  border-radius: 0.5rem;
  border: 2px solid;
  font: inherit;
  line-height: 1.25;
  text-align: center;
}

.slot .t {
  font-weight: 700;
  font-size: 0.94rem;
}

.slot .s {
  font-size: 0.78rem;
  font-weight: 700;
}

.slot.free {
  background: var(--free-bg);
  border-color: var(--free);
  color: var(--free-text);
}

button.slot.free {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button.slot.free:hover {
  background: #cdf3df;
}

button.slot.free[aria-pressed='true'] {
  background: #0b6238;
  border-color: #0b6238;
  color: #fff;
}

.slot.mine {
  background: var(--mine-bg);
  border-color: var(--brand);
  color: var(--mine-text);
}

.slot.none {
  background: var(--none-bg);
  border-color: var(--none-bg);
  color: var(--none-text);
  font-size: 0.83rem;
  font-weight: 600;
}

/* ---- 予約の入力 ---- */
.book-form {
  border: 3px solid var(--primary);
}

.time-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 7rem), 1fr));
  gap: 0.5rem;
}

.len-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 3.8rem), 1fr));
  gap: 0.4rem;
}

.summary {
  background: #f5f5f5;
  border-radius: 0.6rem;
  padding: 0.4rem 0.7rem;
  font-size: 0.94rem;
}

.summary .line {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0 1rem;
}

/* ---- 確認ダイアログ ---- */
dialog {
  width: min(32rem, calc(100vw - 1.5rem));
  max-height: calc(100dvh - 1.5rem);
  overflow: auto;
  border: none;
  border-radius: var(--radius);
  padding: 1rem;
  color: var(--text);
}

dialog::backdrop {
  background: rgba(20, 20, 20, 0.6);
}

/* ---- 体験版の切替 ---- */
.demo-box {
  border: 2px dashed #d9a520;
  border-radius: var(--radius);
  padding: 0 var(--pad);
  background: #fffdf5;
}

.demo-box[open] {
  padding-bottom: var(--pad);
}

.demo-box .btn {
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  text-align: left;
  font-weight: 600;
  font-size: 0.94rem;
  min-height: 48px;
  border-radius: 0.7rem;
}

details > summary {
  cursor: pointer;
  min-height: 48px;
  display: flex;
  align-items: center;
  font-weight: 700;
  color: var(--primary-dark);
}

.spinner {
  text-align: center;
  color: var(--sub);
  padding: 1.5rem 0;
}

.kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.15rem 1rem;
  margin: 0;
}

.kv dt {
  color: var(--sub);
}

.kv dd {
  margin: 0;
  font-weight: 700;
}

.code-big {
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1.3;
}

.qr svg {
  width: 10rem;
  height: 10rem;
  max-width: 100%;
  display: block;
}

.grid-2 {
  display: grid;
  gap: 0.9rem;
}

@media (min-width: 52rem) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

/* ==== スタッフ画面（PC前提・業務向け）==== */
body.staff {
  font-size: 0.89rem; /* 16px */
  background: #f5f6f7;
}

.staff-shell {
  display: grid;
  grid-template-columns: 13.5rem minmax(0, 1fr);
  min-height: 100vh;
}

.side {
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 0.9rem 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  position: sticky;
  top: 0;
  height: 100vh;
}

.side .brand {
  font-size: 1rem;
  min-height: 0;
  padding: 0 0.5rem;
}

.side .brand-sub {
  padding: 0 0.5rem 0.6rem;
  font-size: 0.72rem;
  color: var(--sub);
  border-bottom: 3px solid var(--brand);
  margin-bottom: 0.5rem;
}

.side nav {
  display: grid;
  gap: 0.15rem;
}

.side nav button {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  min-height: 44px;
  padding: 0.3rem 0.7rem;
  border: none;
  border-radius: 0.5rem;
  background: none;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.side nav button:hover {
  background: #f5f5f5;
}

.side nav button[aria-current='page'] {
  background: var(--primary-soft);
  color: var(--primary-dark);
  box-shadow: inset 4px 0 0 var(--brand);
}

.side .foot {
  margin-top: auto;
  font-size: 0.78rem;
  color: var(--sub);
  display: grid;
  gap: 0.1rem;
  padding: 0 0.5rem;
}

.side .foot .link-btn,
.side .foot a {
  min-height: 32px;
  padding: 0;
  text-align: left;
  display: inline-flex;
  align-items: center;
}

body.staff main {
  max-width: none;
  margin: 0;
  padding: 1rem 1.5rem 3rem;
}

body.staff h1 {
  font-size: 1.28rem;
}

body.staff .btn {
  min-height: 44px;
  font-size: 0.89rem;
  border-radius: 0.5rem;
  padding: 0.3rem 0.9rem;
}

body.staff input,
body.staff select {
  min-height: 44px;
  font-size: 0.94rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.toolbar .title {
  font-size: 1.22rem;
  font-weight: 700;
  margin: 0 0.5rem;
}

.toolbar .btn {
  width: auto;
}

.toolbar input[type='date'] {
  width: auto;
}

.toolbar .spacer {
  flex: 1;
}

/* 日別・部屋横断のカレンダー */
.cal {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  overflow: auto;
}

.cal-head,
.cal-body {
  display: grid;
  grid-template-columns: 3.6rem repeat(5, minmax(7.5rem, 1fr));
  min-width: 44rem;
}

.cal-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
  border-bottom: 1px solid var(--line-strong);
}

.cal-head > div {
  padding: 0.45rem 0.5rem;
  font-weight: 700;
  border-left: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.3rem;
}

.cal-head > div:first-child {
  border-left: none;
}

.cal-head .count {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--sub);
}

.cal-axis {
  position: relative;
}

.cal-axis span {
  position: absolute;
  right: 0.4rem;
  transform: translateY(-50%);
  font-size: 0.72rem;
  color: var(--sub);
}

.cal-col {
  position: relative;
  border-left: 1px solid var(--line);
  background-image: linear-gradient(to bottom, var(--line) 1px, transparent 1px),
    linear-gradient(to bottom, #f3f3f3 1px, transparent 1px);
}

.cal-event {
  position: absolute;
  left: 3px;
  right: 6px;
  overflow: hidden;
  border: 1px solid var(--brand);
  border-left: 5px solid var(--brand);
  border-radius: 0.35rem;
  background: var(--primary-soft);
  color: #5a1d0d;
  font: inherit;
  font-size: 0.78rem;
  line-height: 1.3;
  text-align: left;
  padding: 0.1rem 0.35rem;
  cursor: pointer;
}

.cal-event:hover {
  background: #fbd9cf;
}

.cal-event b {
  display: block;
  font-size: 0.83rem;
}

.cal-now {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 2px solid #1456c8;
  z-index: 1;
  pointer-events: none;
}

.table-wrap {
  overflow-x: auto;
}

table.list {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  font-size: 0.83rem;
}

table.list th,
table.list td {
  text-align: left;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

table.list th {
  background: #f5f5f5;
  white-space: nowrap;
}

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  padding: 1rem;
}

.form-narrow {
  max-width: 34rem;
}

@media (max-width: 52rem) {
  /* PC前提だが、狭い画面でも使えるようにメニューを上へ移す */
  .staff-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .side {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .side nav {
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  }

  .side .foot {
    margin-top: 0.5rem;
    grid-auto-flow: column;
    justify-content: start;
    gap: 1rem;
  }

  body.staff main {
    padding: 0.75rem;
  }
}
