/* 空席アプリ（MUJO）。下見 docs/iphone-ui-preview.html のスタイルから、シミュレーター用（iPhone の枠など）を除いて写したもの */
:root {
  --mujo-navy: #1B2F3C;
  --mujo-navy-deep: #12212B;
  --mujo-bg: #F4F5F6;
  --mujo-card: #FFFFFF;
  --mujo-beige: #DFC8BB;
  --mujo-amber: #B86B35;
  --mujo-red: #B83B2A;
  --mujo-muted: #7C878E;
  --mujo-line: #E2E6E9;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  color: var(--mujo-navy);
  font-family: "Noto Sans JP", -apple-system, BlinkMacSystemFont, sans-serif;
}
button { font-family: inherit; }
/* ダブルタップでの拡大を止める（座席やボタンを続けて押すため） */
body, button, select, input, .seat-node { touch-action: manipulation; }

/* ── 客向け画面（/seat）：ブラウザのアドレスバーがあってもスクロールなしで 1 画面（C-11） ── */
body.guest { background: #FFFFFF; }
.guest-card {
  position: relative;
  height: 100dvh;
  padding: 18px 18px 22px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  background: #FFFFFF;
}
.guest-card #floor { height: 100%; }
.guest-card .floor-svg { width: 100%; height: 100%; display: block; margin: 0 auto; }

/* ── スタッフ画面（/admin） ── */
body.admin {
  background: var(--mujo-bg);
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}
.app-header {
  background: var(--mujo-navy-deep);
  color: #FFFFFF;
  padding: calc(10px + env(safe-area-inset-top)) 20px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 8px; margin-left: -8px; }
.menu-btn {
  width: 32px; height: 32px;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
}
.menu-btn span { display: block; width: 18px; height: 2px; border-radius: 1px; background: #E2E6E9; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 50%; background: #FFFFFF; padding: 2px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}
.brand-mark.small { width: 26px; height: 26px; padding: 1px; }
.brand-title {
  font-family: "Noto Serif JP", serif; font-size: 14px; font-weight: 600; letter-spacing: .12em; color: #FFFFFF;
}

/* 状態表示（幅は状態で変えない） */
.status-pill {
  display: inline-flex; align-items: center; justify-content: center;
  width: 132px; white-space: nowrap; gap: 6px; padding: 5px 11px; border-radius: 99px;
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
}
.status-pill .dot { width: 7px; height: 7px; border-radius: 50%; }
.status-open { background: rgba(43,110,82,0.25); color: #7CE3B3; border: 1px solid rgba(124,227,179,0.35); }
.status-open .dot { background: #4ADE80; box-shadow: 0 0 8px #4ADE80; }
.status-pre { background: rgba(223,200,187,0.18); color: var(--mujo-beige); border: 1px solid rgba(223,200,187,0.4); }
.status-pre .dot { background: var(--mujo-beige); }
.status-closed { background: rgba(255,255,255,0.1); color: #B0BAC0; border: 1px solid rgba(255,255,255,0.18); }
.status-closed .dot { background: #8C98A0; }
.status-private { background: rgba(184,107,53,0.25); color: #F7B98A; border: 1px solid rgba(247,185,138,0.4); }
.status-private .dot { background: #F59E0B; }

#admin-main { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* 操作欄：どの状態でも「上段 1 行＋同じ大きさのボタン 3 つ」（S-13） */
.admin-panel {
  margin: 12px 14px 0; background: var(--mujo-card); border-radius: 14px; padding: 12px 14px;
  box-shadow: 0 2px 10px rgba(27,47,60,0.06); border: 1px solid var(--mujo-line); flex-shrink: 0;
}
.time-select {
  /* iPhone は 16px 未満の入力欄を押すと画面を拡大して戻らないので 16px にする */
  font-family: Inter, sans-serif; font-size: 16px; font-weight: 700; color: var(--mujo-navy-deep);
  background: var(--mujo-bg); border: 1px solid #CBD2D6; border-radius: 6px; padding: 2px 6px;
}
.btn-ok {
  background: var(--mujo-navy); color: #FFFFFF; border: none; border-radius: 8px; padding: 7px 14px;
  font-size: 12px; font-weight: 700; cursor: pointer; box-shadow: 0 2px 6px rgba(27,47,60,0.2);
}
.btn-ok:active { transform: scale(0.97); }
.btn-sub {
  background: var(--mujo-bg); color: var(--mujo-navy); border: 1px solid #CBD2D6; border-radius: 7px;
  padding: 5px 9px; font-size: 11px; font-weight: 600; cursor: pointer;
}
.ctrl-top {
  height: 32px; display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
  font-size: 12px; font-weight: 700; color: var(--mujo-navy); white-space: nowrap; overflow: hidden;
}
.ctrl-top .note { overflow: hidden; text-overflow: ellipsis; }
.ctrl-top .note.muted { color: #7C878E; font-weight: 600; }
.ctrl-top .note.warn { color: #B42318; }
.ctrl-top .note.private { color: #B86B35; }
.ctrl-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ctrl-btns > * {
  height: 36px; min-width: 0; padding: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-size: 12px; font-weight: 700; border-radius: 8px;
}
.ctrl-btns .slot-empty { visibility: hidden; }
.seg-wrap {
  display: flex; width: 100%; height: 100%; background: var(--mujo-bg); padding: 2px; border-radius: 8px;
  border: 1px solid var(--mujo-line);
}
.seg-btn {
  flex: 1; border: none; background: transparent; padding: 4px 10px; border-radius: 6px;
  font-size: 12px; font-weight: 600; color: var(--mujo-muted); cursor: pointer; white-space: nowrap;
}
.seg-btn.active { background: var(--mujo-navy); color: #FFFFFF; }

/* 座席図のカード */
.map-card {
  margin: 8px 12px calc(12px + env(safe-area-inset-bottom)); background: var(--mujo-card); border-radius: 18px;
  border: 1px solid var(--mujo-line); box-shadow: 0 4px 18px rgba(27,47,60,0.06);
  flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center;
  padding: 8px 8px 6px; position: relative; overflow: hidden;
}
.map-card #floor { height: 100%; }
.map-card .floor-svg { width: 100%; height: 100%; display: block; margin: 0 auto; }
.seat-node { cursor: pointer; transition: transform .12s ease; transform-box: fill-box; transform-origin: center; }
.seat-node:active { transform: scale(0.95); }
/* 通信中の印は押した席だけ（自動更新では付けない） */
.seat-node.htmx-request { opacity: .7; }

/* 覆い（スタッフのロック・客向けの覆い） */
.map-overlay {
  position: absolute; inset: 0; background: rgba(18, 33, 43, 0.76); backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px; text-align: center; color: #FFFFFF; z-index: 10;
}
/* 客向け：透けない紺。ロゴ・見出しは上から決まった位置に置き、本文だけ下へ伸びる（C-9） */
.map-overlay.opaque {
  background: #12212B; justify-content: flex-start; padding-top: 29dvh;
  padding-bottom: calc(28px + env(safe-area-inset-bottom));
}
.ov-logo {
  display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 22px;
  font-family: Inter, sans-serif; font-size: 10px; font-weight: 600; letter-spacing: .45em; padding-left: .45em;
  color: #FFFFFF; opacity: .92;
}
.ov-badge {
  font-family: Inter, sans-serif; font-size: 11px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--mujo-beige); margin-bottom: 8px;
}
.ov-title { font-family: "Noto Serif JP", serif; font-size: 20px; font-weight: 600; letter-spacing: .06em; margin-bottom: 10px; }
.ov-desc { font-size: 12px; line-height: 1.7; color: #D5DCE0; }
/* 客向けの覆いの下の「11/23（月）17:42 現在」（どの状態でも同じ位置）。下へ寄せるのは margin-top: auto で、
   横向きなどの背の低い画面でも本文と重ならない（入りきらなければ下が切れる） */
.ov-asof {
  margin-top: auto; padding-top: 16px;
  font-family: Inter, "Noto Sans JP", sans-serif; font-size: 11px; letter-spacing: .08em; color: #8F9DA6;
}

/* ボトムシート（予約時刻） */
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; max-width: 560px; margin: 0 auto;
  background: #FFFFFF; border-top-left-radius: 20px; border-top-right-radius: 20px;
  box-shadow: 0 -8px 30px rgba(0,0,0,0.22); padding: 16px 18px calc(24px + env(safe-area-inset-bottom));
  z-index: 30; transform: translateY(105%);
  /* 閉じたシートは見えなくし、触れないようにする（影が下端に出ない・閉じたシートにフォーカスが行かない） */
  visibility: hidden; pointer-events: none;
  transition: transform .22s cubic-bezier(.2,.8,.2,1), visibility 0s linear .22s;
}
.sheet.open {
  transform: translateY(0); visibility: visible; pointer-events: auto;
  transition: transform .22s cubic-bezier(.2,.8,.2,1);
}
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(10, 18, 24, 0.35); z-index: 29;
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sheet-title { font-size: 14px; font-weight: 700; color: var(--mujo-navy-deep); }
.sheet-close { background: var(--mujo-bg); border: none; border-radius: 99px; width: 28px; height: 28px; font-size: 14px; cursor: pointer; }
.time-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.t-chip {
  background: var(--mujo-bg); border: 1px solid var(--mujo-line); border-radius: 8px; padding: 9px 0;
  font-family: Inter, sans-serif; font-size: 13px; font-weight: 600; color: var(--mujo-navy); cursor: pointer;
}
.t-chip:active { background: var(--mujo-beige); }
.custom-time-row {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px; padding: 8px 10px;
  background: var(--mujo-bg); border-radius: 8px; border: 1px solid var(--mujo-line);
}
.custom-time-row label { font-size: 12px; font-weight: 600; color: var(--mujo-navy); white-space: nowrap; }
.custom-time-row .btn-ok { flex-shrink: 0; white-space: nowrap; }
.custom-time-input {
  flex: 1; min-width: 0; font-family: Inter, sans-serif; font-size: 16px; font-weight: 700; padding: 4px 8px;
  border: 1px solid #CBD2D6; border-radius: 6px; background: #FFF; color: var(--mujo-navy-deep);
}
.t-clear {
  width: 100%; padding: 9px; border-radius: 8px; border: 1px solid #E5B4AC; background: #FDF4F3;
  color: var(--mujo-red); font-size: 12px; font-weight: 700; cursor: pointer;
}
/* 終日貸切・やめる（赤くしない） */
.t-clear.neutral { color: var(--mujo-navy); border-color: #CBD2D6; background: var(--mujo-bg); }
/* シートの大きなボタン（今すぐ CLOSED・全席をリセット） */
.sheet-actions { display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: 14px; }
.sheet-actions > * { height: 44px; font-size: 14px; font-weight: 700; border-radius: 10px; }
.sheet-label { font-size: 11px; font-weight: 700; color: #5A6872; margin-bottom: 6px; }
.sheet-desc { font-size: 13px; line-height: 1.6; color: var(--mujo-navy); margin: 0 0 12px; }
.btn-ok.danger { background: var(--mujo-red); }

/* 知らせ */
.toast {
  position: fixed; bottom: calc(18px + env(safe-area-inset-bottom)); left: 50%;
  transform: translateX(-50%) translateY(20px); background: #12212B; color: #FFF;
  font-size: 11px; font-weight: 600; padding: 8px 14px; border-radius: 99px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.3); opacity: 0; pointer-events: none; transition: all .2s;
  z-index: 40; white-space: nowrap; max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
/* エラーは長めの文言を折り返して読めるように */
.toast.error { background: var(--mujo-red); white-space: normal; text-align: center; border-radius: 12px; width: max-content; line-height: 1.5; }
