/* ─────────────────────────────────────────────
   BASE
───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', sans-serif;
  font-size: 14px;
  color: #333;
  background: #f0f4f8;
  min-height: 100vh;
}

/* ─────────────────────────────────────────────
   STATUS COLORS
   ○ = 青(濃), △ = 青(淡), ※ = オレンジ, × = グレー
───────────────────────────────────────────── */
.s-maru     { color: #1565c0; }
.s-sankaku  { color: #42a5f5; }
.s-kome     { color: #f57c00; }
.s-batsu    { color: #9e9e9e; }

/* ─────────────────────────────────────────────
   HEADER
───────────────────────────────────────────── */
.header {
  background: #2c5f8a;
  color: #fff;
  padding: 14px 16px;
  text-align: center;
}
.header h1 { font-size: 18px; font-weight: 700; letter-spacing: .04em; }

/* ─────────────────────────────────────────────
   TABS
───────────────────────────────────────────── */
.tabs {
  display: flex;
  background: #fff;
  border-bottom: 2px solid #2c5f8a;
  position: sticky;
  top: 0;
  z-index: 20;
}
.tab-btn {
  flex: 1;
  padding: 13px 8px;
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: #888;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color .2s, border-color .2s;
}
.tab-btn.active { color: #2c5f8a; border-bottom-color: #2c5f8a; background: #eef3f9; }

/* ─────────────────────────────────────────────
   INFO BAR (凡例 + 館内設備)
───────────────────────────────────────────── */
.info-bar {
  background: #fff;
  border-bottom: 1px solid #ddd;
  padding: 10px 14px;
}

.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  font-size: 13px;
  margin-bottom: 8px;
}
.leg-item { display: flex; align-items: center; gap: 4px; }
.leg-item span:first-child { font-size: 16px; font-weight: 700; }

.facility-details { font-size: 13px; }
.facility-summary {
  cursor: pointer;
  color: #2c5f8a;
  font-weight: 600;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 0;
}
.facility-summary::-webkit-details-marker { display: none; }

.facility-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.ftag {
  background: #eef3f9;
  color: #2c5f8a;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid #c5d8ed;
}

.facility-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}
@media (min-width: 480px) { .facility-grid { grid-template-columns: repeat(3, 1fr); } }
.fac-item {
  background: #f7fafd;
  border: 1px solid #dde8f2;
  border-radius: 6px;
  padding: 8px 10px;
}
.fac-name { font-weight: 700; font-size: 12px; margin-bottom: 2px; }
.fac-desc { font-size: 11px; color: #555; line-height: 1.4; }

/* ─────────────────────────────────────────────
   TAB CONTENT
───────────────────────────────────────────── */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ─────────────────────────────────────────────
   ROOM NAV BAR
───────────────────────────────────────────── */
.room-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  background: #fff;
  border-bottom: 1px solid #ddd;
}

.nav-btn {
  border: 1px solid #2c5f8a;
  background: #fff;
  color: #2c5f8a;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.nav-btn:active { background: #eef3f9; }
.nav-14 { font-size: 12px; padding: 0 8px; }
.nav-1  { font-size: 16px; padding: 0 10px; }
.nav-btn[style*="visibility: hidden"] { pointer-events: none; }

.date-range-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  padding: 8px 4px;
  border-radius: 6px;
  border: 1px dashed #aac4dd;
  background: #f7fafd;
  min-height: 44px;
  user-select: none;
}
.date-range-wrap:active { background: #eef3f9; }
.date-range-text {
  font-weight: 700;
  font-size: 13px;
  color: #2c5f8a;
  text-align: center;
  line-height: 1.3;
}
.cal-icon { font-size: 16px; flex-shrink: 0; }

/* ─────────────────────────────────────────────
   DATE PICKER
───────────────────────────────────────────── */
.dp-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 40;
}
.dp-backdrop.open { display: block; }

.date-picker {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 41;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 6px 28px rgba(0,0,0,.3);
  width: min(340px, 92vw);
  overflow: hidden;
}
.date-picker.open { display: block; }

.dp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #2c5f8a;
  color: #fff;
  padding: 10px 14px;
}
.dp-title-text { font-weight: 700; font-size: 15px; }
.dp-nav {
  background: none;
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  min-width: 36px;
  min-height: 36px;
}
.dp-dow-row {
  display: grid;
  grid-template-columns: repeat(7,1fr);
  background: #eef3f9;
  border-bottom: 1px solid #ddd;
}
.dp-dow {
  text-align: center;
  padding: 6px 2px;
  font-size: 12px;
  font-weight: 700;
  color: #555;
}
.dp-dow.sun { color: #c62828; }
.dp-dow.sat { color: #1565c0; }

.dp-body {
  display: grid;
  grid-template-columns: repeat(7,1fr);
  padding: 4px;
  gap: 2px;
}
.dp-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  border-radius: 50%;
  cursor: default;
  color: #ccc;
}
.dp-cell.selectable {
  cursor: pointer;
  color: #333;
}
.dp-cell.selectable:hover { background: #eef3f9; }
.dp-cell.selected { background: #2c5f8a !important; color: #fff !important; }
.dp-cell.dp-sat { color: #1565c0; }
.dp-cell.dp-sun { color: #c62828; }
.dp-cell.selectable.dp-sat { color: #1565c0; }
.dp-cell.selectable.dp-sun { color: #c62828; }

.dp-footer {
  display: flex;
  justify-content: space-between;
  padding: 10px 14px;
  border-top: 1px solid #eee;
  gap: 8px;
}
.dp-today-btn {
  padding: 8px 20px;
  border: 1px solid #2c5f8a;
  background: #fff;
  color: #2c5f8a;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  min-height: 40px;
}
.dp-close-btn {
  padding: 8px 20px;
  border: none;
  background: #2c5f8a;
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  min-height: 40px;
}

/* ─────────────────────────────────────────────
   ROOM TABLE
───────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
  user-select: none;
  background: #fff;
}
.table-wrap.dragging { cursor: grabbing; }

.room-table {
  border-collapse: collapse;
  white-space: nowrap;
  width: max-content;
  background: #fff;
}
.room-table th,
.room-table td {
  border: 1px solid #ddd;
  text-align: center;
  vertical-align: middle;
}

/* 固定列 */
.sticky-col {
  position: sticky;
  left: 0;
  z-index: 3;
  background: #fff;
  width: 160px;
  min-width: 160px;
  max-width: 160px;
}
.sticky-col.th-label {
  background: #e0eaf4;
  z-index: 4;
  font-weight: 700;
  font-size: 13px;
  padding: 8px 6px;
}

/* 日付ヘッダー */
.date-col {
  min-width: 52px;
  padding: 5px 3px;
  font-size: 11px;
  background: #f0f4f8;
  vertical-align: middle;
}
.date-col .dn { display: block; font-size: 16px; font-weight: 700; line-height: 1.2; }
.date-col .dw { display: block; font-size: 11px; line-height: 1; }
.col-sat .dn, .col-sat .dw { color: #1565c0; }
.col-sun .dn, .col-sun .dw { color: #c62828; }
.col-hol .dn, .col-hol .dw { color: #c62828; }

/* ステータスセル */
.status-cell {
  height: 180px;
  min-width: 52px;
  font-size: 22px;
  font-weight: 700;
  vertical-align: middle;
}
.status-cell.clickable { cursor: pointer; transition: filter .15s; }
.status-cell.clickable:active { filter: brightness(.88); }
.status-cell.x-cell { cursor: default; }
.status-cell.s-batsu { background: #f5f5f5; }

/* 部屋ラベルセル */
.room-label-cell {
  position: sticky;
  left: 0;
  z-index: 3;
  background: #fff;
  width: 160px;
  min-width: 160px;
  max-width: 160px;
  vertical-align: top;
  padding: 0;
}
.room-photo {
  width: 100%;
  height: 90px;
  object-fit: cover;
  display: block;
  background: #dce8f0;
}
.room-photo-placeholder {
  width: 100%;
  height: 90px;
  background: linear-gradient(135deg, #dce8f0 0%, #b8d0e4 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #668eaa;
  font-size: 12px;
  font-weight: 600;
}
.room-name {
  font-weight: 700;
  font-size: 14px;
  padding: 6px 8px 2px;
  color: #1a3a56;
}
.room-info {
  padding: 0 8px 8px;
  font-size: 11px;
  color: #555;
  line-height: 1.6;
  white-space: normal;
}
.room-info .info-line { display: block; }
.room-info .facilities {
  color: #2c5f8a;
  margin-top: 3px;
  font-size: 10px;
  line-height: 1.4;
}

/* ─────────────────────────────────────────────
   VACANCY CALENDAR
───────────────────────────────────────────── */
.cal-section { padding: 12px 12px 24px; }

.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 8px;
}
.cal-nav-label { font-weight: 700; font-size: 13px; color: #2c5f8a; text-align: center; flex: 1; }
.cal-nav-btn {
  height: 44px;
  padding: 0 12px;
  border: 1px solid #2c5f8a;
  background: #fff;
  color: #2c5f8a;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}
.cal-nav-btn:active { background: #eef3f9; }

.months-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 767px) {
  .months-grid { grid-template-columns: 1fr; }
}

.month-card {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #ddd;
}
.month-title {
  background: #2c5f8a;
  color: #fff;
  text-align: center;
  padding: 9px;
  font-weight: 700;
  font-size: 15px;
}
.cal-dow-row {
  display: grid;
  grid-template-columns: repeat(7,1fr);
}
.cal-dow {
  text-align: center;
  padding: 5px 2px;
  font-size: 11px;
  font-weight: 700;
  background: #eef3f9;
  border-bottom: 1px solid #ddd;
  color: #555;
}
.cal-dow.sat { color: #1565c0; }
.cal-dow.sun { color: #c62828; }
.cal-body {
  display: grid;
  grid-template-columns: repeat(7,1fr);
  background: #fff;
}
.cal-cell {
  min-height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid #f0f0f0;
  gap: 1px;
  background: #fff;
}
.cal-cell.empty { background: #fafafa; }
.cal-cell.clickable { cursor: pointer; }
.cal-cell.clickable:active { filter: brightness(.92); }
.cal-cell .cdate { font-size: 12px; font-weight: 700; line-height: 1; }
.cal-cell .cstatus { font-size: 16px; font-weight: 700; line-height: 1; }
.cal-cell.is-sat { background: #eef3fc; }
.cal-cell.is-sat .cdate { color: #1565c0; }
.cal-cell.is-sun, .cal-cell.is-hol { background: #fde8e8; }
.cal-cell.is-sun .cdate, .cal-cell.is-hol .cdate { color: #c62828; }
.cal-cell.is-x { background: #f5f5f5; }

/* ─────────────────────────────────────────────
   MODAL
───────────────────────────────────────────── */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 100;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.modal-backdrop.open {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 16px 0 48px;
}
.modal {
  background: #fff;
  width: 100%;
  max-width: 560px;
  border-radius: 12px;
  margin: 0 12px;
  overflow: hidden;
  animation: slideUp .22s ease;
}
@keyframes slideUp {
  from { transform: translateY(28px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.modal-header {
  background: #2c5f8a;
  color: #fff;
  padding: 13px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1;
}
.modal-header h2 { font-size: 16px; font-weight: 700; }
.modal-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 26px;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.modal-body { padding: 14px; }

/* ─────────────────────────────────────────────
   FORM SECTIONS
───────────────────────────────────────────── */
.fsec {
  border: 1px solid #ddd;
  border-radius: 8px;
  margin-bottom: 14px;
  overflow: hidden;
}
.fsec-title {
  background: #eef3f9;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 13px;
  color: #2c5f8a;
  border-bottom: 1px solid #ddd;
}
.fsec-body { padding: 12px; }
.frow { margin-bottom: 12px; }
.frow:last-child { margin-bottom: 0; }

.flabel { display: block; font-size: 13px; font-weight: 700; margin-bottom: 4px; color: #444; }
.req { color: #c62828; font-size: 11px; margin-left: 4px; }

input[type=date],
input[type=number],
input[type=text],
input[type=email],
input[type=tel],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 16px;
  color: #333;
  background: #fff;
  -webkit-appearance: none;
  appearance: none;
}
input.err, select.err, textarea.err { border-color: #c62828; }
textarea { height: 80px; resize: vertical; }

.errmsg { color: #c62828; font-size: 12px; margin-top: 4px; display: none; }
.errmsg.show { display: block; }

.range-warning {
  display: none;
  background: #fff3cd;
  border: 1px solid #f0c040;
  border-radius: 6px;
  padding: 10px 12px;
  color: #7a5c00;
  font-size: 13px;
  font-weight: 600;
  margin-top: 8px;
}
.range-warning.show { display: block; }

.kome-note {
  display: none;
  background: #fff3e0;
  border: 1px solid #ffcc80;
  border-radius: 6px;
  padding: 8px 12px;
  color: #e65100;
  font-size: 12px;
  font-weight: 600;
  margin-top: 8px;
}
.kome-note.show { display: block; }

/* 部屋タイプ + 食事 ラジオ */
.radio-grp { display: flex; flex-direction: column; gap: 6px; }
@media (min-width: 480px) {
  .radio-grp { flex-direction: row; flex-wrap: wrap; }
}
.radio-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  min-height: 46px;
  transition: border-color .15s, background .15s;
}
.radio-opt:has(input:checked) { border-color: #2c5f8a; background: #eef3f9; }
.radio-opt input[type=radio] { width: 18px; height: 18px; min-width: 18px; accent-color: #2c5f8a; cursor: pointer; }
.radio-opt span { font-size: 14px; }
.radio-opt.disabled-opt { opacity: .4; cursor: not-allowed; }
.radio-opt.disabled-opt input { cursor: not-allowed; }

/* 内訳 */
.breakdown-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bd-item label { display: block; font-size: 12px; font-weight: 600; color: #555; margin-bottom: 3px; }
.bd-item input { font-size: 15px; }

/* 注意事項 */
.notice-box {
  background: #fff8e6;
  border: 1px solid #f0c040;
  border-radius: 6px;
  padding: 12px;
  font-size: 13px;
  line-height: 1.7;
  margin-bottom: 12px;
  white-space: pre-line;
}
.chk-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  min-height: 48px;
}
.chk-row input[type=checkbox] {
  width: 22px;
  height: 22px;
  min-width: 22px;
  accent-color: #2c5f8a;
  cursor: pointer;
}
.chk-row span { font-size: 14px; font-weight: 700; }

/* 送信ボタン */
.submit-btn {
  display: block;
  width: 100%;
  padding: 15px;
  background: #2c5f8a;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  min-height: 52px;
  margin-top: 16px;
}
.submit-btn:active { background: #1e4a6e; }

/* 完了画面 */
.success-view { display: none; text-align: center; padding: 36px 20px; }
.success-view.show { display: block; }
.success-icon { font-size: 52px; margin-bottom: 16px; }
.success-msg {
  font-size: 15px;
  line-height: 1.9;
  white-space: pre-line;
  color: #333;
  margin-bottom: 28px;
}
.close-btn {
  padding: 13px 36px;
  background: #2c5f8a;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  min-height: 50px;
}
