/* カフェルナカルド 予約管理 — カルドブラウン × ルナイエロー */
:root {
  --brown: #8B5A3C;
  --brown-dark: #6E442C;
  --yellow: #FFC93C;
  --teal: #5DC2D0;
  --pink: #FF7A9C;
  --ink: #1E1A17;
  --muted: #7A6A5E;
  --line: #E7DED6;
  --bg: #FBF8F4;
  --card: #FFFFFF;
  --ok: #3E9B6B;
  --warn: #D9534F;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(30,26,23,.06), 0 6px 18px rgba(30,26,23,.06);
  --tap: 44px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 700; }
.hidden { display: none !important; }
.spacer { flex: 1; }
.warn { color: var(--warn); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

/* ---------- レイアウト ---------- */
#app { min-height: 100%; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) 14px 10px;
  background: var(--brown); color: #fff;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; flex: 1; }
.logo { width: 24px; height: 24px; border-radius: 6px; display: block; }
.logo.big { width: 56px; height: 56px; border-radius: 12px; }
/* 月を送るとき、はみ出した紙で横スクロールが出ないようにする */
.view { flex: 1; padding: 12px 12px 84px; overflow-x: hidden; }

.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 20;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  border: 0; background: none; padding: 10px 4px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--muted); min-height: var(--tap);
}
.tab.on { color: var(--brown); font-weight: 700; }


/* ---------- 部品 ---------- */
.btn {
  border: 1px solid transparent; border-radius: 999px; padding: 10px 16px;
  background: var(--brown); color: #fff; font-weight: 600; cursor: pointer;
  min-height: var(--tap);
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brown); }
.btn.ghost { background: #fff; color: var(--brown); border-color: var(--line); }
.btn.danger { color: var(--warn); }
.btn.danger.ghost { border-color: #F0D6D5; }
.btn.sm { padding: 6px 12px; min-height: 34px; font-size: 13px; }
.icon-btn {
  border: 1px solid var(--line); background: #fff; border-radius: 10px;
  width: 38px; height: 38px; cursor: pointer; color: var(--brown); font-size: 18px; line-height: 1;
}
.icon-btn.danger { color: var(--warn); }
.topbar .icon-btn { background: transparent; border-color: rgba(255,255,255,.4); color: #fff; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 12px; overflow: hidden; }
.card.pad { padding: 14px; }
.sub-head { font-size: 14px; color: var(--brown-dark); margin-bottom: 10px; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); margin: 6px 0; line-height: 1.6; }
.chip { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: #F2ECE6; color: var(--muted); margin-left: 6px; }
.chip.gold { background: #FFF3D2; color: #8A6300; font-weight: 700; }
.chip.new { background: #E4F6F8; color: #256B76; }
.chip.warn { background: #FBE7E7; color: var(--warn); }
.toolbar { margin-bottom: 10px; }
.search, .day-input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; min-height: var(--tap);
}

/* ---------- カレンダー ---------- */
.month-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.month-head h2 { flex: 1; font-size: 17px; }
.cal-grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px;
  /* 横にはらう操作を拾うため、横方向の画面送りは端末に任せない */
  touch-action: pan-y;
  will-change: transform;
}
.cal-wday { text-align: center; font-size: 11px; color: var(--muted); padding: 4px 0; }
.cal-wday.sun, .cal-date.sun, .day-stat strong.sun { color: #C8553D; }
.cal-wday.sat, .cal-date.sat, .day-stat strong.sat { color: #3D6DC8; }
.cal-cell {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  min-height: 86px; padding: 4px; cursor: pointer; text-align: left;
  display: flex; flex-direction: column; gap: 2px;
  /* はみ出しを許すと、列が中身の幅まで広がって7列が画面に収まらなくなる */
  overflow: hidden; min-width: 0;
}
.cal-cell.empty { background: transparent; border: 0; cursor: default; }
.cal-cell.today { border-color: var(--yellow); box-shadow: inset 0 0 0 1px var(--yellow); }
.cal-cell.selected { background: #FFF8E8; }
.cal-date { font-size: 13px; font-weight: 700; }
.cal-count { display: flex; flex-direction: column; font-size: 10px; color: var(--brown); line-height: 1.3; }
.cal-count strong { font-size: 12px; }
/* カレンダーのイベント枠。予約の件数とは別物だと分かるように帯で出す */
.cal-event {
  display: block; font-size: 9px; line-height: 1.4; margin-top: 2px;
  background: #6B7280; color: #fff; border-radius: 3px; padding: 0 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}
.cal-sub { font-size: 10px; color: var(--warn); }

/* ---------- 日別ヘッダ ---------- */
.day-head { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.day-nav { display: flex; align-items: center; gap: 6px; }
.day-nav .day-input { flex: 1; }
.day-stat { display: flex; align-items: baseline; gap: 10px; font-size: 13px; color: var(--muted); }
.day-stat strong { font-size: 16px; color: var(--ink); }
.day-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.day-actions a.btn { text-decoration: none; display: inline-flex; align-items: center; }

/* ---------- タイムライン ---------- */
.timeline-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; }
.timeline { display: grid; grid-template-columns: 92px minmax(560px, 1fr); min-width: max-content; }
.tl-corner { position: sticky; left: 0; z-index: 3; background: #F7F2ED; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 6px 8px; font-size: 11px; color: var(--muted); }
.tl-ruler { display: grid; grid-template-columns: repeat(var(--cols), 1fr); border-bottom: 1px solid var(--line); background: #F7F2ED; }
.tl-tick { font-size: 10px; color: var(--muted); padding: 6px 0 6px 3px; border-left: 1px solid transparent; }
.tl-tick.hour { border-left-color: var(--line); }
.tl-label {
  position: sticky; left: 0; z-index: 2; background: var(--card);
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 6px 8px; display: flex; flex-direction: column; justify-content: center;
}
.tl-label strong { font-size: 13px; }
.tl-label small { font-size: 10px; color: var(--muted); }
.tl-label.room { background: #FFF8E8; }
.tl-track {
  position: relative; height: 48px; border-bottom: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(var(--cols), 1fr);
}
.tl-slot { border: 0; border-left: 1px solid #F3EDE7; background: transparent; cursor: pointer; padding: 0; }
.tl-slot.hour { border-left-color: var(--line); }
.tl-slot:hover { background: #FFF8E8; }
.tl-block {
  position: absolute; top: 4px; bottom: 4px; border: 0; border-radius: 8px; cursor: pointer;
  padding: 3px 6px; overflow: hidden; text-align: left; color: #fff;
  display: flex; flex-direction: column; justify-content: center; min-width: 34px;
  background: var(--brown); box-shadow: var(--shadow);
}
/* 短い枠に長い名前が入る。切れるのは仕方がないので、切れたと分かる形にする */
.tl-block-name { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-block-meta { font-size: 10px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-block.seated { background: var(--ok); }
.tl-block.done { background: #9A8C81; }
.tl-now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--pink); z-index: 1; pointer-events: none; }

/* ---------- 予約リスト ---------- */
.res-row { display: flex; align-items: stretch; border-bottom: 1px solid var(--line); }
.res-row:last-child { border-bottom: 0; }
.res-row.cancelled, .res-row.noshow { opacity: .55; }
.res-main { flex: 1; display: flex; gap: 10px; padding: 10px 12px; background: none; border: 0; text-align: left; cursor: pointer; }
.res-time { display: flex; flex-direction: column; align-items: center; min-width: 46px; }
.res-time strong { font-size: 15px; }
.res-time small { font-size: 10px; color: var(--muted); }
.res-body { flex: 1; min-width: 0; }
.res-name { font-size: 14px; font-weight: 700; }
.res-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.res-note { font-size: 11px; color: var(--brown); margin-top: 3px; background: #FFF8E8; border-radius: 6px; padding: 2px 6px; display: inline-block; }
.res-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px; padding: 8px 8px 8px 0; align-content: center; }
.st-btn {
  border: 1px solid var(--line); background: #fff; border-radius: 8px;
  font-size: 10px; padding: 5px 6px; cursor: pointer; color: var(--muted); min-width: 52px;
}
.st-btn.sm { min-width: 0; }
.st-btn.on.seated { background: var(--ok); border-color: var(--ok); color: #fff; }
.st-btn.on.done { background: #9A8C81; border-color: #9A8C81; color: #fff; }
.st-btn.on.cancelled, .st-btn.on.noshow { background: var(--warn); border-color: var(--warn); color: #fff; }

/* ---------- 顧客 ---------- */
.cust-head, .cust-row {
  display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, .6fr) minmax(0, 1.2fr) minmax(0, 1.1fr); gap: 8px; align-items: center;
  padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 12px;
}
.cust-head { background: #F7F2ED; color: var(--muted); font-size: 11px; }
.cust-row { background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; text-align: left; cursor: pointer; }
.cust-name { font-weight: 700; font-size: 13px; display: flex; flex-direction: column; }
.cust-name small { font-weight: 400; color: var(--muted); font-size: 10px; }
.cust-visits { font-weight: 700; }
.cust-visits.gold { color: #8A6300; }
.cust-last, .cust-contact { color: var(--muted); }
.cust-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.cust-summary > div { background: #F7F2ED; border-radius: 10px; padding: 8px; text-align: center; display: flex; flex-direction: column; }
.cust-summary strong { font-size: 15px; }
.cust-summary small { font-size: 10px; color: var(--muted); }
.hist-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, .5fr) minmax(0, .9fr) minmax(0, .7fr) auto; gap: 6px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 11px; }
.hist-row.cancelled, .hist-row.noshow { opacity: .55; }
.hist-status { color: var(--muted); }

/* ---------- 設定テーブル ---------- */
.tbl { font-size: 12px; }
.tbl-head, .tbl-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, .6fr) minmax(0, 1fr) minmax(0, .8fr) minmax(0, .5fr) 38px; gap: 6px; align-items: center; padding: 6px 0; }
.tbl-head { color: var(--muted); font-size: 11px; border-bottom: 1px solid var(--line); }
.tbl-row.off { opacity: .5; }
.tbl input, .tbl select { width: 100%; padding: 7px; border: 1px solid var(--line); border-radius: 8px; min-height: 38px; }
.tbl-add { padding-top: 10px; }
.copy-row { display: flex; gap: 6px; align-items: center; }
.copy-row input { flex: 1; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: #F7F2ED; }

/* ---------- モーダル・フォーム ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50; background: rgba(30,26,23,.45);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: var(--card); width: 100%; max-width: 560px; max-height: 92vh;
  border-radius: 16px 16px 0 0; display: flex; flex-direction: column;
  animation: slideUp .18s ease-out;
}
@keyframes slideUp { from { transform: translateY(16px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 8px; border-bottom: 1px solid var(--line); }
.modal-head h2 { flex: 1; font-size: 16px; }
.modal-body { padding: 14px; overflow-y: auto; }
.modal-actions {
  display: flex; gap: 8px; align-items: center; padding: 10px 14px;
  padding-bottom: max(10px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #FCFAF8;
}
.form { display: flex; flex-direction: column; gap: 12px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
/* 升目の中身は、放っておくと「これ以上は縮められない幅」を主張して
   隣の升へはみ出す。日付と時刻の入力欄がそれで、隣と重なっていた */
.grid-2 > * { min-width: 0; }
/* iPhone の Safari は、日付と時刻の欄に自前の幅を持っていて、width: 100% を
   聞いてくれない。見た目の作りをこちらで持つと、はじめて幅に従う */
.field input[type="date"], .field input[type="time"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  text-align: left;
}
.field { display: flex; flex-direction: column; gap: 4px; position: relative; }
.field-label { font-size: 11px; color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; min-height: var(--tap); width: 100%;
}
.field textarea { min-height: 60px; resize: vertical; }
.field small { font-size: 10px; color: var(--muted); }

.suggest { position: absolute; top: 100%; left: 0; right: 0; z-index: 5; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; }
.suggest-item { display: flex; flex-direction: column; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; cursor: pointer; border-bottom: 1px solid var(--line); }
.suggest-item:last-child { border-bottom: 0; }
.suggest-item:hover { background: #FFF8E8; }
.suggest-name { font-size: 13px; font-weight: 600; }
.suggest-meta { font-size: 10px; color: var(--muted); }

.visit-badge { display: flex; flex-wrap: wrap; gap: 10px; align-items: baseline; background: #FFF8E8; border: 1px solid #F4E3B8; border-radius: 10px; padding: 8px 10px; font-size: 12px; }
.visit-badge strong { color: #8A6300; }
.form-summary { display: flex; gap: 12px; font-size: 12px; color: var(--muted); }

.seat-picker { display: flex; flex-direction: column; gap: 8px; }
.seat-group { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.seat-area { width: 100%; font-size: 10px; color: var(--muted); }
.seat {
  border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 6px 10px;
  cursor: pointer; display: flex; flex-direction: column; align-items: center; min-width: 62px; min-height: 44px; justify-content: center;
}
.seat-name { font-size: 12px; font-weight: 600; }
.seat-cap { font-size: 9px; color: var(--muted); }
.seat.on { background: var(--brown); border-color: var(--brown); color: #fff; }
.seat.on .seat-cap { color: rgba(255,255,255,.8); }
.seat.busy { border-color: var(--pink); background: #FFF0F4; }
.seat.busy.on { background: var(--warn); border-color: var(--warn); color: #fff; }
.seat.room { border-style: dashed; }

/* ---------- 繰り返し（イベント枠） ---------- */
.repeat-box {
  display: flex; flex-direction: column; gap: 10px;
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip-btn {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 6px 12px; font-size: 12px; cursor: pointer; min-height: 32px;
}
.chip-btn.on { background: var(--brown); border-color: var(--brown); color: #fff; }

/* ---------- ログイン ---------- */
.login { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 28px 22px; width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 12px; align-items: center; text-align: center; }
.login-card h1 { font-size: 16px; }
.login-card input { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 10px; min-height: var(--tap); }
.login-card .btn { width: 100%; }

/* ---------- トースト ---------- */
#toasts { position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 9px 15px; border-radius: 999px; font-size: 13px; box-shadow: var(--shadow); max-width: 88vw; }
.toast.ok { background: var(--ok); }
.toast.error { background: var(--warn); }
.toast.out { opacity: 0; transition: opacity .3s; }

/* ---------- 広い画面 ---------- */
@media (min-width: 760px) {
  .view { padding: 16px 20px 90px; max-width: 1100px; margin: 0 auto; width: 100%; }
  .cal-cell { min-height: 112px; }
  .overlay { align-items: center; }
  .modal { border-radius: 16px; }
  .day-head { flex-direction: row; align-items: center; }
  .day-nav { flex: 0 0 auto; }
  .day-stat { flex: 1; }
}

/* 設定のチェックボックス行 */
/* 押せる範囲は文字の幅まで。行の右端の余白を押しても切り替わらないようにする */
.field.check {
  flex-direction: row; align-items: flex-start; gap: 8px; margin: 8px 0;
  align-self: flex-start; width: fit-content; max-width: 100%; cursor: pointer;
}
.field.check input { width: 20px; height: 20px; min-height: 0; flex: none; margin-top: 1px; }
.field.check span { font-size: 13px; }
/* 説明つきのチェック（メール設定）。見出しと説明を縦に並べる */
.field.check span:has(strong) { display: flex; flex-direction: column; gap: 2px; }
.field.check .hint { margin: 0; }
/* イベント枠：エリア名を押すとまとめて選べる */
.seat-area.as-btn {
  background: none; border: 1px dashed var(--line); border-radius: 6px;
  padding: 2px 8px; cursor: pointer; font: inherit; color: var(--muted);
}
.seat-area.as-btn:hover { border-style: solid; color: var(--brown-dark); }
/* イベント枠の帯は、お客様の予約と見分けがつくようにする */
.tl-block.block { background: repeating-linear-gradient(45deg, #6B7280, #6B7280 6px, #7C8595 6px, #7C8595 12px); color: #fff; }
.chip.block { background: #6B7280; color: #fff; }

/* 予約番号 */
.chip.code { background: #EFE7DF; color: var(--brown-dark); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .06em; }

/* 予約フォームの駐車場の行 */
.parking-line { font-size: 12px; color: var(--muted); }
.parking-line .warn { font-weight: 700; }

/* 席マスタの表（接続グループ列を追加） */
.tbl-head, .tbl-row { grid-template-columns: minmax(0, 1.3fr) minmax(0, .55fr) minmax(0, .95fr) minmax(0, .7fr) minmax(0, .5fr) minmax(0, .55fr) 38px; }
.tbl-head span { display: block; }

/* ---------- 新着（未確認）予約 ---------- */
.bell {
  position: relative; border: 1px solid rgba(255,255,255,.4); background: transparent;
  border-radius: 10px; min-width: 52px; height: 38px; padding: 0 10px; cursor: pointer;
  color: #fff; font-size: 12px; font-weight: 600; line-height: 1;
}
.bell-badge {
  position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 999px; background: var(--warn); color: #fff; font-size: 11px; font-weight: 700;
  display: grid; place-items: center; box-shadow: 0 0 0 2px var(--brown);
}
.chip.new-mark { background: var(--warn); color: #fff; font-weight: 700; }
.res-row.unseen { background: #FFF6DF; box-shadow: inset 3px 0 0 var(--warn); }
.res-copy { display: flex; align-items: center; padding: 0 8px 0 0; }

/* 新着バナー */
.newres {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 96px; z-index: 90;
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  background: var(--ink); color: #fff; border-radius: 14px; padding: 12px 14px;
  box-shadow: 0 8px 28px rgba(0,0,0,.28); width: min(92vw, 460px);
  animation: slideUp .2s ease-out;
}
.newres strong { display: block; font-size: 14px; }
.newres small { font-size: 11px; opacity: .75; }
.newres > div { flex: 1; }
.newres .icon-btn { background: transparent; border-color: rgba(255,255,255,.35); color: #fff; }
.newres-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--warn); flex: none; animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

/* 未確認一覧 */
.pend-row { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; background: #FFF9EE; }
.pend-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 6px; }
.pend-head strong { font-size: 14px; }
.pend-text { font-size: 14px; font-weight: 600; line-height: 1.6; margin: 0 0 8px; color: var(--ink); word-break: break-all; }
.pend-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.copy-fallback {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px;
  font-size: 13px; line-height: 1.7; background: #FFF9EE; resize: vertical;
  -webkit-user-select: text; user-select: text;
}
/* 通知を受け取る端末の一覧 */
.dev-list { font-size: 12px; }
.dev-row { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.dev-row:last-child { border-bottom: 0; }
.dev-row.off { opacity: .75; }
.dev-row span:last-child { color: var(--muted); text-align: right; }

/* ---------- 一覧の列が広がらないように ---------- */
/* 1fr は中身の最小幅より狭くならない。長いメールや名前が入ると列が広がり、
   行ごと画面からはみ出す。列は minmax(0,…) で潰せるようにし、
   中身は「…」で切る */
.cust-head > *, .cust-row > *, .hist-row > *, .tbl-head > *, .tbl-row > * { min-width: 0; }
.cust-name, .cust-name small, .cust-visits, .cust-last, .cust-contact {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- 細い画面（320px）での折り返し ---------- */
/* カードの中の操作列は、入らなければ折り返す。ボタンが画面の外へ出ないように */
.modal-actions { flex-wrap: wrap; }
/* 送信記録は宛先が長い。行で折らず、溢れたぶんを「…」で切る */
.dev-row { min-width: 0; }
.dev-row > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 席の一覧の入力欄は、列の幅に合わせて縮める */
.tbl-row select, .tbl-row input { width: 100%; min-width: 0; }
/* とても細い画面では、席の一覧は7列がどうしても入らない。
   潰して読めなくするより、横に送れるようにする */
@media (max-width: 360px) {
  .tbl { overflow-x: auto; }
  .tbl-head, .tbl-row { min-width: 360px; }
}

/* ---------- 顧客一覧は細い画面で2段にする ---------- */
/* 4列を横に並べると、名前も連絡先も「…」だらけになる。
   スマートフォンでは名前と回数を上、前回来店と連絡先を下に置く */
@media (max-width: 480px) {
  .cust-head { display: none; }
  .cust-row { display: flex; flex-wrap: wrap; row-gap: 2px; }
  /* 1段目：お名前と来店回数 */
  .cust-name { flex: 1 1 60%; }
  .cust-visits { flex: 0 0 auto; margin-left: auto; }
  /* 2段目：前回来店と連絡先。連絡先はメールが長いので、余りを全部使って切る */
  .cust-last { flex: 0 0 auto; }
  .cust-contact { flex: 1 1 0; min-width: 0; text-align: right; }
}

/* ---------- メンバーカード（NFC のタップ先） ---------- */
/* 1枚のカードを見るだけの画面なので、広い画面でも中央に寄せて幅を抑える */
.view.member-page {
  max-width: 560px; margin: 0 auto; width: 100%;
  display: flex; flex-direction: column; gap: 12px;
  /* 下のタブ帯が無い画面なので、余白を詰める */
  padding-bottom: 32px;
}
.member-page .card { padding: 14px; margin-bottom: 0; }
.member-name { font-size: 20px; margin: 0 0 6px; }
.member-plan { margin: 0 0 6px; }
.ok-line { color: var(--ok); font-weight: 700; margin: 0; }
.btn.big { display: block; width: 100%; padding: 16px; font-size: 16px; }

/* 来店履歴。日付・人数・状態の3つだけを、詰めて並べる */
.member-hist { display: flex; flex-direction: column; }
.member-hist-row {
  display: flex; gap: 10px; align-items: baseline; font-size: 12px;
  padding: 7px 0; border-bottom: 1px solid var(--line);
}
.member-hist-row:last-child { border-bottom: 0; }
/* 日付と人数は続けて読ませ、状態だけ右へ寄せる */
.member-hist-row > :first-child { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-hist-row > :nth-child(2) { flex: 0 0 auto; color: var(--muted); }
.member-hist-row .hist-status { flex: 0 0 auto; margin-left: auto; color: var(--muted); }
.member-more { margin-top: 10px; }

/* ---------- メンバー名簿の行 ---------- */
.member-row {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 12px;
}
.member-row:last-child { border-bottom: 0; }
.member-row.off { opacity: .6; }
.member-who { flex: 1 1 55%; min-width: 0; display: flex; flex-direction: column; }
.member-who strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-state { flex: 0 0 auto; margin-left: auto; text-align: right; display: flex; flex-direction: column; }
.member-acts { flex: 1 1 100%; display: flex; gap: 6px; }

/* ---------- 顧客カルテから引く ---------- */
.pick-list { display: flex; flex-direction: column; max-height: 190px; overflow-y: auto; }
.pick-row {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  background: none; border: 0; border-bottom: 1px solid var(--line);
  padding: 7px 2px; text-align: left; cursor: pointer; font-size: 12px; width: 100%;
}
.pick-row:hover { background: var(--card-2, #F7F2ED); }
.picked {
  display: flex; align-items: center; gap: 8px; justify-content: space-between;
  background: #F7F2ED; border-radius: 8px; padding: 7px 10px; font-size: 12px; margin-top: 6px;
}

/* ---------- 顧客カルテの中のメンバー表示 ---------- */
/* .card は余白を持たないので、ここで明示する。
   ボタンが文字にくっついて読みにくかったぶんも空ける */
.member-card { padding: 12px; margin-bottom: 14px; }
.member-card p { margin: 0 0 4px; }
.member-card p:last-of-type { margin-bottom: 0; }
.member-card .btn { margin-top: 10px; }

/* ---------- 顧客一覧のメンバー印 ---------- */
.cust-name-line { display: flex; align-items: center; gap: 6px; min-width: 0; }
.cust-name-line > :first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.member {
  flex: 0 0 auto; margin-left: 0; background: var(--brown); color: #fff; font-weight: 700;
}
.chip.member.off { background: var(--line); color: var(--muted); }

/* ---------- 設定のたたみ ---------- */
/* 項目が増えたので、既定は見出しだけ。押した項目の中身だけを出す */
.fold {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 10px; overflow: hidden;
}
.fold-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; padding: 14px; background: none; border: 0; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 700; color: var(--brown-dark); text-align: left;
}
.fold-head > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fold-caret { flex: 0 0 auto; color: var(--muted); transition: transform .15s ease; }
.fold.on .fold-caret { transform: rotate(180deg); }
.fold-body { display: none; }
.fold.on .fold-body { display: block; }
/* たたみの見出しがあるので、カードの中の見出しは伏せる */
.fold .card { margin: 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; box-shadow: none; }
.fold .card > .sub-head { display: none; }

/* ---------- カレンダーの休み・臨時の営業時間 ---------- */
.cal-cell.closed { background: #F4F1EC; }
.cal-closed {
  align-self: stretch; text-align: center; font-size: 10px; font-weight: 700;
  color: #4A4640; background: #E6E0D6; border-radius: 4px; padding: 1px 2px;
}
.cal-closed.temp { color: #fff; background: #8A7A6B; }
.cal-hours {
  align-self: stretch; text-align: center; font-size: 10px; font-weight: 700;
  color: #fff; background: #1F5C4A; border-radius: 4px; padding: 1px 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* 細い画面では升目が47pxしかないので、時刻だけ一段小さくする */
@media (max-width: 480px) {
  .cal-hours { font-size: 9px; letter-spacing: -.02em; padding: 1px; }
}

/* ---------- 会員番号 ---------- */
/* 木のカードに手書きする番号。数字だけだと他の数と紛れるので、印を付けて出す */
.member-no {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; letter-spacing: .08em; color: var(--brown-dark);
  margin: 0 0 2px;
}
.member-no-chip {
  flex: 0 0 auto; display: inline-block; margin-right: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px; letter-spacing: .04em;
  background: #EFE7DF; color: var(--brown-dark);
  border-radius: 4px; padding: 1px 5px;
}
.member-page .member-no { font-size: 13px; }

/* 送っている間のボタン。押しても効かないことが見て分かるように */
.btn.busy { opacity: .6; cursor: progress; }
