/* 全国！おつまみ横丁 オーダーシステム PoC 共通スタイル
   濃紺 #1F3864（見出し） / オレンジ #ED7D31（アクセント）
   タブレット運用前提：ボタンは大きく、文字は大きく。 */

:root {
  --navy: #1F3864;
  --navy-light: #2E4E86;
  --orange: #ED7D31;
  --orange-dark: #C75B14;
  --bg: #F4F6FA;
  --card: #FFFFFF;
  --line: #D5DBE7;
  --text: #1A1A1A;
  --muted: #6B7280;
  --green: #14804A;
  --red: #C0392B;
  --yellow: #FFF3CD;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo",
               system-ui, -apple-system, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

/* ---------- ヘッダ ---------- */
header.app {
  background: var(--navy);
  color: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
header.app h1 { font-size: 20px; margin: 0; font-weight: 700; }
header.app .sub { font-size: 13px; opacity: .85; margin-left: auto; text-align: right; }
header.app .badge {
  background: var(--orange);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 13px;
  font-weight: 700;
}
nav.pages { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 16px;
  background: var(--navy-light); }
nav.pages .navlabel { color: #C9D6EE; font-size: 12px; align-self: center;
  margin-right: 4px; }
nav.pages a {
  color: #fff; text-decoration: none; font-size: 13px;
  background: rgba(255,255,255,.14); padding: 5px 12px; border-radius: 999px;
}
nav.pages a.on { background: var(--orange); font-weight: 700; }

main { padding: 16px; max-width: 1400px; margin: 0 auto; }

h2.sec {
  color: var(--navy); font-size: 20px; margin: 24px 0 10px;
  border-left: 6px solid var(--orange); padding-left: 10px;
}
h2.sec:first-child { margin-top: 4px; }

/* ---------- ボタン ---------- */
button, .btn {
  font-family: inherit;
  font-size: 18px;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  padding: 14px 20px;
  cursor: pointer;
  background: var(--navy);
  color: #fff;
  min-height: 52px;
  transition: filter .1s;
}
a.btn { display: inline-block; text-decoration: none; text-align: center; }
button:active, a.btn:active { filter: brightness(.85); }
button:disabled { background: #B7BFCD; cursor: not-allowed; }
button.orange { background: var(--orange); }
button.green { background: var(--green); }
button.red { background: var(--red); }
button.ghost { background: #fff; color: var(--navy); border: 2px solid var(--navy); }
button.small { font-size: 15px; padding: 8px 14px; min-height: 40px; }
button.big { font-size: 24px; padding: 20px; width: 100%; }

/* ---------- カード ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
}
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }

.muted { color: var(--muted); font-size: 14px; }
.right { text-align: right; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- メニューカード ---------- */
.menu-item {
  background: #fff; border: 2px solid var(--line); border-radius: 12px;
  padding: 12px; display: flex; flex-direction: column; gap: 6px; position: relative;
}
.menu-item .emoji { font-size: 34px; line-height: 1; }
.menu-item .name { font-weight: 700; font-size: 17px; color: var(--navy); }
.menu-item .desc { font-size: 13px; color: var(--muted); min-height: 2.4em; }
.menu-item .price { font-size: 22px; font-weight: 800; color: var(--orange-dark); }
.menu-item.soldout { opacity: .55; background: #EEE; }
.menu-item .soldout-tag {
  position: absolute; top: 8px; right: 8px; background: var(--red); color: #fff;
  font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 6px;
}
/* ＋と−は必ず離す（誤り対応フロー §4.1：44px以上あける／間に数量を大きく出す） */
.qty-ctl { display: flex; align-items: center; gap: 14px; margin-top: auto; }
.qty-ctl button { width: 56px; height: 56px; padding: 0; font-size: 28px; border-radius: 10px; flex: none; }
.qty-ctl .q { flex: 1; min-width: 48px; text-align: center; font-size: 30px; font-weight: 900;
  color: var(--navy); }
.menu-item.picked { border-color: var(--orange); background: #FFF7F0; }

/* ---------- カート明細（客画面。0にすると行が消える） ---------- */
.cartbox { background: #fff; border: 2px solid var(--orange); border-radius: 12px;
  padding: 10px 12px; margin-top: 14px; }
.cartbox h3 { margin: 0 0 6px; font-size: 17px; color: var(--navy); }
.cart-row { display: flex; align-items: center; gap: 12px; padding: 8px 0;
  border-bottom: 1px solid var(--line); }
.cart-row:last-child { border-bottom: none; }
.cart-row .nm { flex: 1; font-weight: 700; font-size: 16px; }
.cart-row .n { font-size: 24px; font-weight: 900; min-width: 40px; text-align: center; }
.cart-row button { width: 46px; height: 46px; padding: 0; font-size: 24px; flex: none; }

/* ---------- 確認ダイアログ ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(10,16,32,.55);
  display: flex; align-items: center; justify-content: center; z-index: 900; padding: 16px; }
.modal-box { background: #fff; border-radius: 16px; padding: 22px; max-width: 560px;
  width: 100%; max-height: 88vh; overflow: auto; box-shadow: 0 12px 40px rgba(0,0,0,.35); }
.modal-title { font-size: 24px; font-weight: 900; color: var(--navy); margin-bottom: 10px; }
.modal-body { font-size: 18px; line-height: 1.6; }
.modal-btns { display: flex; gap: 16px; margin-top: 22px; }
.modal-btns button { flex: 1; font-size: 20px; padding: 16px; }

/* ---------- 差額表示（明細修正） ---------- */
.diffbox { border-radius: 12px; padding: 14px; margin: 12px 0; text-align: center;
  border: 3px solid var(--line); background: #fff; }
.diffbox .lbl { font-size: 15px; color: var(--muted); font-weight: 700; }
.diffbox .val { font-size: 44px; font-weight: 900; line-height: 1.15; }
.diffbox.plus { border-color: var(--navy); background: #EEF3FC; }
.diffbox.plus .val { color: var(--navy); }
.diffbox.minus { border-color: var(--red); background: #FDEEEC; }
.diffbox.minus .val { color: var(--red); }
.diffbox.zero .val { font-size: 28px; color: var(--muted); }

/* ---------- 合計バー ---------- */
.totalbar {
  position: fixed; left: 0; right: 0; bottom: 0; background: var(--navy);
  color: #fff; padding: 10px 16px 14px; box-shadow: 0 -3px 12px rgba(0,0,0,.25); z-index: 60;
}
.totalbar .line { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.totalbar .amount { font-size: 34px; font-weight: 800; margin-left: auto; }
.pad-bottom { height: 160px; }

/* ---------- 大表示（注文番号） ---------- */
.bignum {
  font-size: 96px; font-weight: 900; color: var(--navy); line-height: 1;
  letter-spacing: 2px;
}
.bigyen { font-size: 56px; font-weight: 900; color: var(--orange-dark); }

/* ---------- テーブル ---------- */
table.tbl { width: 100%; border-collapse: collapse; background: #fff; font-size: 15px; }
table.tbl th, table.tbl td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
table.tbl th { background: var(--navy); color: #fff; font-weight: 700; }
table.tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl tr:nth-child(even) td { background: #FAFBFD; }

/* ---------- ステータスバッジ ---------- */
.st { display: inline-block; padding: 3px 10px; border-radius: 999px;
      font-size: 13px; font-weight: 700; color: #fff; white-space: nowrap; }
.st-注文受付済 { background: #8892A6; }
.st-決済確認済 { background: var(--navy); }
.st-調理中 { background: var(--orange); }
.st-呼出中 { background: var(--green); }
.st-受渡済 { background: #B7BFCD; color: #333; }
.st-キャンセル { background: var(--red); }

/* ---------- トースト ---------- */
#toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 24px;
  background: rgba(20,20,20,.92); color: #fff; padding: 14px 24px; border-radius: 10px;
  font-size: 17px; font-weight: 700; z-index: 999; display: none; max-width: 90vw;
}
#toast.err { background: var(--red); }

/* ---------- KDS ---------- */
.kds-col { display: flex; flex-direction: column; gap: 12px; }
.kds-card { background: #fff; border-left: 10px solid var(--navy); border-radius: 10px;
  padding: 12px 14px; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.kds-card.cooking { border-left-color: var(--orange); }
.kds-card.late { background: #FFF0EC; border-left-color: var(--red); }
.kds-card .no { font-size: 40px; font-weight: 900; color: var(--navy); line-height: 1.1; }
.kds-card .elapsed { font-size: 20px; font-weight: 800; }
.kds-card .elapsed.late { color: var(--red); }
.kds-card ul { margin: 8px 0; padding-left: 0; list-style: none; }
.kds-card li { font-size: 21px; font-weight: 700; padding: 2px 0; }
.kds-card li .x { color: var(--orange-dark); }

/* ---------- 呼出表示 ---------- */
body.call { background: #0E1B33; color: #fff; min-height: 100vh; }
.call-head { text-align: center; padding: 14px; background: var(--navy); }
.call-head h1 { margin: 0; font-size: 34px; letter-spacing: 4px; }
.call-head p { margin: 4px 0 0; font-size: 18px; color: #FFD9BF; }
/* auto-fit にすると件数が少ないときにカードが横いっぱいに広がる＝遠くから見やすい */
.call-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 20px; padding: 24px; }
.call-num {
  background: #fff; color: var(--navy); border-radius: 18px; text-align: center;
  padding: 22px 8px; font-weight: 900; line-height: 1;
  font-size: clamp(52px, 8vw, 110px); white-space: nowrap;
  border: 8px solid var(--orange); cursor: pointer;
  animation: pop .4s ease-out;
}
.call-num small { display: block; font-size: 18px; color: var(--orange-dark);
  font-weight: 700; margin-top: 8px; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.call-empty { text-align: center; padding: 80px 20px; font-size: 30px; color: #9FB0D0; }
.call-foot { padding: 12px 24px; background: rgba(255,255,255,.07); font-size: 18px; }
.call-foot .chip { display: inline-block; background: rgba(255,255,255,.15); color: #fff;
  border-radius: 8px; padding: 6px 14px; margin: 4px 6px 0 0; font-weight: 700; }

/* ---------- 検索・入力 ---------- */
input[type=text], input[type=number], select {
  font-family: inherit; font-size: 18px; padding: 12px; border: 2px solid var(--line);
  border-radius: 10px; background: #fff; min-height: 50px;
}
input[type=text]:focus, select:focus { outline: 3px solid #BBD0FF; border-color: var(--navy); }

/* ---------- トグル ---------- */
.toggle { display: flex; align-items: center; gap: 10px; }
.toggle .sw { width: 74px; height: 40px; border-radius: 999px; background: #B7BFCD;
  position: relative; cursor: pointer; transition: background .15s; flex: none; }
.toggle .sw.on { background: var(--red); }
.toggle .sw::after { content: ""; position: absolute; top: 4px; left: 4px; width: 32px;
  height: 32px; border-radius: 50%; background: #fff; transition: left .15s; }
.toggle .sw.on::after { left: 38px; }

/* ---------- 選択チップ ---------- */
.chips { display: flex; gap: 10px; flex-wrap: wrap; }
.chip-btn {
  border: 3px solid var(--line); background: #fff; color: var(--navy);
  border-radius: 12px; padding: 14px 22px; font-size: 19px; font-weight: 700; cursor: pointer;
}
.chip-btn.sel { border-color: var(--orange); background: #FFF1E6; color: var(--orange-dark); }

.tabbar { display: flex; gap: 0; margin-bottom: 14px; border-bottom: 3px solid var(--navy); }
.tabbar button {
  border-radius: 10px 10px 0 0; background: #E3E8F1; color: var(--navy);
  font-size: 18px; padding: 12px 24px; margin-right: 4px;
}
.tabbar button.on { background: var(--navy); color: #fff; }

.hint { background: var(--yellow); border-left: 5px solid var(--orange);
  padding: 10px 14px; border-radius: 6px; font-size: 14px; margin-bottom: 14px; }

/* 管理ページ用の確実な2カラム（auto-fillだと画面幅次第で4列に割れてしまうため） */
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .two { grid-template-columns: 1fr; } }

/* スマホでは2列。8品が2〜3スクロールで見渡せるようにする（列内で選ぶ想定） */
@media (max-width: 560px) {
  main { padding: 12px; }
  .g3 { grid-template-columns: 1fr 1fr; gap: 8px; }
  .menu-item { padding: 8px; }
  .menu-item .emoji { font-size: 26px; }
  .menu-item .name { font-size: 15px; }
  .menu-item .desc { font-size: 11px; min-height: 2.6em; }
  .menu-item .price { font-size: 19px; }
  .qty-ctl button { width: 44px; height: 44px; font-size: 22px; }
  .qty-ctl .q { font-size: 20px; }
  .bignum { font-size: 72px; }
  .bigyen { font-size: 42px; }
}
