:root {
  --accent: #d84315;
  --accent-dark: #bf360c;
  --bg: #faf7f2;
  --card: #ffffff;
  --text: #2b2320;
  --muted: #8d817a;
  --line: #e8e0d8;
  --ok: #2e7d32;
  --nav-h: 58px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", Meiryo, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 8px);
  font-size: 15px;
  line-height: 1.5;
}

/* ヘッダ */
.c-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 10px 14px;
}
.c-header .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.c-header .store { font-weight: 700; font-size: 16px; display: inline-flex; align-items: center; gap: 6px; }
.c-header .logo { height: 26px; width: auto; max-width: 140px; object-fit: contain; }
.c-notice { margin: 10px 14px 0; padding: 10px 12px; background: #fff8e1; border: 1px solid #ffe082; border-radius: 10px; font-size: 13px; line-height: 1.6; white-space: pre-line; }
.c-header .table-name { font-size: 13px; color: var(--muted); }
.plan-banner {
  margin-top: 6px; padding: 6px 10px;
  background: #fff3e0; border: 1px solid #ffcc80; border-radius: 8px;
  font-size: 12.5px; color: #7a4400;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.plan-banner .lo-passed { color: var(--accent-dark); font-weight: 700; }
.expired-banner {
  margin-top: 6px; padding: 8px 10px;
  background: #ffebee; border: 1px solid #ef9a9a; border-radius: 8px;
  font-size: 13px; color: #b71c1c; font-weight: 600;
}

/* クイック注文バー(メニュー画面下部) */
.quick-bar {
  position: fixed; left: 10px; right: 10px;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 10px);
  z-index: 25;
  display: flex; align-items: center; gap: 10px;
  background: var(--card);
  border: 1px solid var(--line); border-radius: 14px;
  padding: 10px 12px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .18);
}
.quick-bar .qb-info {
  flex: 1; min-width: 0;
  display: flex; align-items: baseline; gap: 8px;
  text-decoration: none; color: var(--text);
}
.quick-bar .qb-count { font-size: 13px; color: var(--muted); white-space: nowrap; }
.quick-bar .qb-total { font-size: 17px; font-weight: 700; }
.quick-bar .qb-edit { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.quick-bar .qb-submit {
  border: 0; border-radius: 10px;
  background: var(--accent); color: #fff;
  padding: 11px 18px;
  font-size: 15px; font-weight: 700;
  cursor: pointer;
}
.quick-bar .qb-submit:disabled { opacity: .6; }
body.has-quick-bar { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 76px); }

/* カテゴリタブ */
.cat-tabs {
  position: sticky; top: 0; z-index: 15;
  display: flex; gap: 8px; overflow-x: auto;
  padding: 10px 14px; background: var(--bg);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tabs a {
  flex: 0 0 auto; padding: 7px 14px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line);
  color: var(--text); text-decoration: none; font-size: 13.5px; font-weight: 600;
}
.cat-tabs a.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* 商品リスト */
.menu-section { padding: 4px 14px 14px; }
.menu-section h2 {
  font-size: 15px; margin: 14px 0 8px; padding-left: 8px;
  border-left: 4px solid var(--accent);
}
.product-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.product-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden; cursor: pointer; position: relative;
  -webkit-tap-highlight-color: transparent;
}
.product-card .thumb {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block;
  background: linear-gradient(135deg, #f3ede6, #e8e0d8);
}
.product-card .thumb.noimg { display: flex; align-items: center; justify-content: center; color: #c9bfb5; font-size: 26px; }
.product-card .info { padding: 8px 10px 10px; }
.product-card .name { font-size: 13.5px; font-weight: 600; line-height: 1.35; }
.product-card .price { margin-top: 4px; font-size: 14px; font-weight: 700; color: var(--accent-dark); }
.product-card .price .strike { text-decoration: line-through; color: var(--muted); font-weight: 400; font-size: 12px; margin-right: 4px; }
.product-card.soldout { opacity: .55; pointer-events: none; }
.badge-plan {
  position: absolute; top: 6px; left: 6px;
  background: var(--ok); color: #fff; font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px;
}
.badge-soldout {
  position: absolute; top: 6px; right: 6px;
  background: #616161; color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 999px;
}

/* 下部ナビ */
.c-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--card); border-top: 1px solid var(--line);
}
.c-nav a, .c-nav button {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; text-decoration: none; color: var(--muted); font-size: 10.5px;
  background: none; border: none; cursor: pointer; position: relative;
  font-family: inherit;
}
.c-nav .icon { font-size: 20px; line-height: 1; }
.c-nav a.active { color: var(--accent); font-weight: 700; }
.c-nav .cart-badge {
  position: absolute; top: 4px; right: calc(50% - 22px);
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--accent); color: #fff; border-radius: 999px;
  font-size: 11px; font-weight: 700; display: none;
  align-items: center; justify-content: center;
}
.c-nav .cart-badge.show { display: flex; }

/* モーダル */
.modal-back {
  position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.45);
  display: none; align-items: flex-end; justify-content: center;
}
.modal-back.open { display: flex; }
.modal {
  background: var(--card); width: 100%; max-width: 560px;
  border-radius: 16px 16px 0 0; max-height: 85vh; overflow-y: auto;
  padding: 18px 16px calc(16px + env(safe-area-inset-bottom, 0px));
}
.modal h3 { font-size: 17px; margin-bottom: 4px; }
.modal .desc { font-size: 13px; color: var(--muted); margin-bottom: 8px; white-space: pre-wrap; }
.modal .base-price { font-weight: 700; color: var(--accent-dark); margin-bottom: 10px; }
.opt-group { margin: 12px 0; }
.opt-group .g-name { font-size: 13.5px; font-weight: 700; margin-bottom: 6px; }
.opt-group .g-name .req { color: var(--accent); font-size: 11px; margin-left: 6px; }
.opt-item {
  display: flex; align-items: center; gap: 8px; padding: 9px 10px;
  border: 1px solid var(--line); border-radius: 10px; margin-bottom: 6px;
  font-size: 14px; cursor: pointer;
}
.opt-item input { width: 18px; height: 18px; accent-color: var(--accent); }
.opt-item .delta { margin-left: auto; font-size: 13px; color: var(--muted); }
.qty-row { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 14px 0; }
.qty-row button {
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--card); font-size: 20px; cursor: pointer; color: var(--text);
}
.qty-row .qty { font-size: 20px; font-weight: 700; min-width: 2em; text-align: center; }
.btn-primary {
  display: block; width: 100%; padding: 14px; border: none; border-radius: 12px;
  background: var(--accent); color: #fff; font-size: 15.5px; font-weight: 700;
  cursor: pointer; font-family: inherit;
}
.btn-primary:disabled { background: #cbb; }
.btn-ghost {
  display: block; width: 100%; padding: 12px; margin-top: 8px;
  background: none; border: none; color: var(--muted); font-size: 14px; cursor: pointer;
  font-family: inherit;
}

/* カート・履歴・会計 共通 */
.page { padding: 14px; }
.page h1 { font-size: 18px; margin-bottom: 12px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 10px;
}
.cart-item { display: flex; gap: 10px; align-items: flex-start; }
.cart-item .c-info { flex: 1; }
.cart-item .c-name { font-weight: 600; font-size: 14px; }
.cart-item .c-opts { font-size: 12px; color: var(--muted); margin-top: 2px; }
.cart-item .c-price { font-weight: 700; font-size: 14px; white-space: nowrap; }
.cart-item .c-qty { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.cart-item .c-qty button {
  width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--card); font-size: 16px; cursor: pointer;
}
.cart-item .c-qty .c-del {
  width: auto; height: auto; border-radius: 8px;
  background: none; border: none;
  color: var(--accent); font-size: 12.5px; cursor: pointer;
  padding: 4px 8px; margin-left: auto;
  font-family: inherit; white-space: nowrap;
  text-decoration: underline;
}
.total-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 4px; font-size: 15px;
}
.total-row.grand { font-size: 18px; font-weight: 700; border-top: 2px solid var(--text); }
.order-block { margin-bottom: 14px; }
.order-block .o-head {
  display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); margin-bottom: 6px;
}
.o-item { display: flex; justify-content: space-between; gap: 8px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.o-item:last-child { border-bottom: none; }
.o-item .oi-opts { font-size: 12px; color: var(--muted); }
.o-item .oi-price { white-space: nowrap; font-weight: 600; }
.tag-plan { display: inline-block; background: #e8f5e9; color: var(--ok); font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; margin-left: 4px; }
.tag-staff { display: inline-block; background: #ede7f6; color: #5e35b1; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; margin-left: 4px; }
.empty-note { text-align: center; color: var(--muted); padding: 40px 0; font-size: 14px; }

/* 会計ロック画面 */
.locked-panel { text-align: center; padding: 26px 14px; }
.locked-panel .big { font-size: 40px; margin-bottom: 8px; }
.locked-panel p { color: var(--muted); font-size: 14px; }

/* トースト */
#toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px);
  transform: translateX(-50%) translateY(20px);
  background: rgba(43,35,32,.92); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 13.5px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 60;
  max-width: 90vw; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 案内ページ */
.info-page { min-height: 80vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center; }
.info-page .big { font-size: 52px; margin-bottom: 14px; }
.info-page h1 { font-size: 19px; margin-bottom: 10px; }
.info-page p { color: var(--muted); font-size: 14px; }

/* ---- フェーズ1: 検索・おすすめ・残数・メモ・呼出用件 ---- */
.menu-search { position: sticky; z-index: 9; background: var(--bg); padding: 6px 14px 8px; }
.menu-search input { width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 15px; background: var(--card); }
.badge-low { position: absolute; top: 6px; right: 6px; background: #fff3e0; color: #ef6c00; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; z-index: 1; }
.product-card .price .price-label { margin-left: 4px; font-size: 11px; font-weight: 600; color: #ef6c00; background: #fff3e0; padding: 1px 6px; border-radius: 999px; vertical-align: middle; }
.note-box { margin-top: 10px; }
.note-box label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.note-box textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px; font-size: 14px; font-family: inherit; }
.o-note { font-size: 13px; color: #5d4037; background: #fff8e1; border-radius: 8px; padding: 6px 8px; margin: 4px 0 6px; white-space: pre-wrap; }
.o-item .oi-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.btn-reorder { border: 1px solid var(--accent); color: var(--accent); background: #fff; border-radius: 999px; font-size: 12px; padding: 3px 10px; }
.btn-reorder:disabled { opacity: .5; }
.call-modal h3 { text-align: center; }
.call-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.call-opt { padding: 16px 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); font-size: 16px; font-weight: 700; }
.call-opt:disabled { opacity: .5; }

/* ---- フェーズ2: 税抜/税込表示 ---- */
.product-card .price .tax-in { display: block; font-size: 11px; font-weight: 500; color: var(--muted); }
.c-gross { font-size: 11px; font-weight: 500; color: var(--muted); text-align: right; }
.total-row.sub { font-size: 12.5px; color: var(--muted); }
.tag-rate { display: inline-block; background: #fff3e0; color: #ef6c00; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 999px; margin-left: 4px; }

/* ---- フェーズ6: 定型メモ・バリエーション/税率選択 ---- */
.note-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.note-chips button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 11px; font-size: 13px; color: var(--ink); }
.note-chips button:active { background: #f0f3f6; }
.opt-group.variations .g-name { color: #1565c0; }
