:root {
  --acc: #C2410C;
  --acc-d: #9A3412;
  --acc-bg: #FFEDD5;
  --acc-ink: #9A3412;
  --ok-bg: #D1FAE5;
  --ok-ink: #065F46;
  --warn-bg: #FEF3C7;
  --warn-ink: #92400E;
  --cook-bg: #E0E7FF;
  --cook-ink: #3730A3;
  --bg: #F4F6F8;
  --card: #FFFFFF;
  --ink: #1F2937;
  --mut: #6B7280;
  --line: #E5E7EB;
  --danger: #DC2626;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Noto Sans JP', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
button { font-family: inherit; }

/* ---- デモバナー ---- */
.demo-banner {
  background: #1F2937;
  color: #FDE68A;
  font-size: 12px;
  padding: 7px 12px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.bn-reset {
  background: transparent;
  border: 1px solid #FDE68A88;
  color: #FDE68A;
  border-radius: 6px;
  font-size: 11px;
  padding: 2px 10px;
  cursor: pointer;
}

/* ---- ヘッダー ---- */
.app-header {
  background: linear-gradient(135deg, var(--acc), var(--acc-d));
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 40;
}
.shop { display: flex; align-items: center; gap: 10px; min-width: 0; }
.shop-logo {
  width: 42px; height: 42px;
  background: #ffffff22;
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 24px;
  flex: none;
}
.shop-name { font-weight: 900; font-size: 17px; letter-spacing: .02em; white-space: nowrap; }
.shop-sub { font-size: 11px; opacity: .85; }
.role-switch { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; }
.role-switch span { font-size: 10px; opacity: .85; }
.role-switch select {
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  padding: 6px 8px;
  background: #fff;
  color: var(--ink);
  max-width: 180px;
}

/* ---- レイアウト ---- */
main { max-width: 720px; margin: 0 auto; padding: 12px; }
.card {
  background: var(--card);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.card.slim { padding: 10px 14px; }
.card h2 { font-size: 15px; margin: 0 0 10px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.mut { color: var(--mut); }
.small { font-size: 12px; }
.center { text-align: center; }
.empty { color: var(--mut); font-size: 13px; text-align: center; padding: 14px 0; margin: 0; }
.grow { flex: 1; }

.badge {
  background: var(--line);
  color: var(--mut);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 10px;
}
.badge.warn { background: var(--warn-bg); color: var(--warn-ink); }
.badge.ok { background: var(--ok-bg); color: var(--ok-ink); }

.notice {
  background: var(--warn-bg);
  color: var(--warn-ink);
  border-radius: 10px;
  font-size: 13px;
  padding: 10px 12px;
  margin: 10px 0;
}
.notice.ok-n { background: var(--ok-bg); color: var(--ok-ink); }

/* ---- ボタン ---- */
.btn {
  border: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
  padding: 10px 16px;
  cursor: pointer;
  background: var(--line);
  color: var(--ink);
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--acc); color: #fff; }
.btn.ghost { background: transparent; border: 1.5px solid var(--line); color: var(--ink); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.big { padding: 14px 18px; font-size: 15px; }
.btn.wide { width: 100%; display: block; margin-top: 10px; }
.btn.mini2 {
  background: #fff;
  border: 1.5px solid var(--warn-ink);
  color: var(--warn-ink);
  font-size: 12px;
  padding: 6px 12px;
  flex: none;
}
.btn.onwhite { background: #fff; color: var(--acc-d); margin-top: 10px; }
.btnrow { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.btnrow .btn { flex: 1; min-width: 130px; }

/* ---- お客様：メニュー ---- */
.table-note { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tbl-chip {
  background: var(--acc-bg);
  color: var(--acc-ink);
  font-weight: 900;
  font-size: 12px;
  border-radius: 999px;
  padding: 3px 12px;
  flex: none;
  white-space: nowrap;
}
.cat-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 10px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.cat-bar::-webkit-scrollbar { display: none; }
.cat-b {
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--mut);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  padding: 7px 16px;
  white-space: nowrap;
  cursor: pointer;
  flex: none;
}
.cat-b.on { background: var(--acc); border-color: var(--acc); color: #fff; }

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 76px;
}
.m-card {
  position: relative;
  background: var(--card);
  border: none;
  border-radius: 14px;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  text-align: left;
}
.m-card:active { transform: scale(.97); }
.m-emoji { font-size: 30px; line-height: 1.2; }
.m-emoji.sm { font-size: 22px; }
.m-name { font-weight: 700; font-size: 13px; line-height: 1.4; }
.m-price { color: var(--acc-d); font-weight: 900; font-size: 15px; }
.m-card.sold { opacity: .55; }
.sold-badge {
  position: absolute;
  top: 10px; right: 10px;
  background: var(--ink);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 6px;
  padding: 2px 8px;
}

.cartbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(68px + env(safe-area-inset-bottom));
  width: calc(100% - 24px);
  max-width: 696px;
  background: var(--acc);
  color: #fff;
  border: none;
  border-radius: 14px;
  font-weight: 900;
  font-size: 15px;
  padding: 15px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(194,65,12,.4);
  z-index: 45;
}
.cartbar:active { transform: translateX(-50%) scale(.98); }
.cb-n {
  background: #ffffff33;
  border-radius: 999px;
  font-size: 12px;
  padding: 2px 10px;
}

/* ---- シート：商品・かご ---- */
.si-head { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.si-emoji { font-size: 44px; flex: none; }
.si-head h3 { margin: 0 0 2px; font-size: 17px; }
.si-head p { margin: 0; }
.si-row { display: flex; gap: 12px; align-items: center; }
.qty { display: flex; align-items: center; gap: 12px; flex: none; }
.qty b { font-size: 18px; min-width: 22px; text-align: center; }
.qty-b {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: #fff;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  display: grid; place-items: center;
}
.qty-b:disabled { opacity: .35; }
.qty.sm { gap: 8px; }
.qty.sm .qty-b { width: 32px; height: 32px; font-size: 16px; }
.qty.sm b { font-size: 15px; min-width: 18px; }

.cart-list { margin: 12px 0; }
.cart-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.cr-name { flex: 1; font-weight: 500; }
.cr-price { font-weight: 700; min-width: 64px; text-align: right; }
.cart-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0 4px;
  font-size: 15px;
}
.cart-total b { font-size: 20px; color: var(--acc-d); }

/* ---- 注文カード ---- */
.ord {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
}
.ord-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.ord-head .stpill { margin-left: auto; }
.ord-line { display: flex; justify-content: space-between; font-size: 13px; padding: 2px 0; }
.ord-line.tt { border-top: 1px dashed var(--line); margin-top: 6px; padding-top: 6px; font-weight: 700; }
.ord-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; gap: 10px; }

.stpill {
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  padding: 3px 10px;
  white-space: nowrap;
}
.st-new { background: var(--warn-bg); color: var(--warn-ink); }
.st-cook { background: var(--cook-bg); color: var(--cook-ink); }
.st-served { background: var(--ok-bg); color: var(--ok-ink); }

/* ---- 利用額カード ---- */
.next-card {
  background: linear-gradient(135deg, var(--acc), var(--acc-d));
  color: #fff;
}
.next-card .mut { color: #ffffffcc; }
.next-main { font-size: 34px; font-weight: 900; line-height: 1.3; }
.oncard { color: #fff; margin: 10px 0 0; }

/* ---- お店：呼び出し ---- */
.card.calls { background: var(--warn-bg); }
.call-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  font-size: 14px;
  color: var(--warn-ink);
}
.call-row + .call-row { border-top: 1px dashed #D9C58A; }

/* ---- お店：テーブル ---- */
.tgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}
.tcell {
  background: var(--card);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tcell.empty-t { opacity: .6; justify-content: center; align-items: center; min-height: 110px; }
.tno { font-weight: 900; font-size: 13px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.t-total { font-size: 22px; font-weight: 900; color: var(--acc-d); }
.t-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.tcell .btn { margin-top: auto; font-size: 13px; padding: 9px 10px; }

/* ---- お店：メニュー管理 ---- */
.it-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}
.it-row:last-of-type { border-bottom: none; }
.it-main {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  padding: 4px 0;
  cursor: pointer;
  text-align: left;
  font-size: 14px;
  min-width: 0;
}
.it-name { font-weight: 500; flex: 1; min-width: 0; }
.it-name.soldtx { text-decoration: line-through; color: var(--mut); }
.it-price { font-weight: 700; color: var(--acc-d); flex: none; }
.sw {
  border: none;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  padding: 6px 12px;
  cursor: pointer;
  flex: none;
  min-width: 64px;
}
.sw.on { background: var(--ok-bg); color: var(--ok-ink); }
.sw.off { background: var(--line); color: var(--mut); }

/* ---- フォーム ---- */
.fld { display: block; font-size: 12px; font-weight: 700; color: var(--mut); margin: 12px 0; }
.fld input, .fld select {
  display: block;
  width: 100%;
  margin-top: 4px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  background: #fff;
}
.fld input:focus, .fld select:focus { outline: 2px solid var(--acc); border-color: var(--acc); }

/* ---- お店：売上 ---- */
.cost-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 0 12px;
}
.cost-total b { font-size: 30px; font-weight: 900; color: var(--acc-d); }
.stats3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.stats3 > div {
  background: var(--bg);
  border-radius: 10px;
  padding: 10px 6px;
  text-align: center;
  display: flex;
  flex-direction: column;
}
.stats3 b { font-size: 17px; font-weight: 900; }
.stats3 span { font-size: 11px; color: var(--mut); }
.rank-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.rank-row:last-of-type { border-bottom: none; }
.rk {
  width: 24px; height: 24px;
  background: var(--acc-bg);
  color: var(--acc-ink);
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px;
  font-weight: 900;
  flex: none;
}
.rk-name { flex: 1; font-weight: 500; min-width: 0; }

/* ---- タブバー ---- */
.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--card);
  border-top: 1px solid var(--line);
  display: flex;
  z-index: 50;
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1;
  background: transparent;
  border: none;
  padding: 9px 2px 8px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--mut);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
.tab .ic { font-size: 21px; line-height: 1.2; }
.tab.on { color: var(--acc-d); }

/* ---- シート ---- */
.sheet { position: fixed; inset: 0; z-index: 60; }
.sheet.hidden { display: none; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.sheet-panel {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: var(--card);
  border-radius: 18px 18px 0 0;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  max-height: 80vh;
  overflow-y: auto;
  max-width: 720px;
  margin: 0 auto;
  animation: up .22s ease;
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-panel h3 { margin: 0 0 8px; font-size: 16px; }

/* ---- トースト ---- */
.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(86px + env(safe-area-inset-bottom));
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  border-radius: 12px;
  padding: 11px 18px;
  z-index: 70;
  max-width: calc(100% - 32px);
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.toast.hidden { display: none; }

/* ---- スピナー ---- */
.spin-overlay {
  position: fixed; inset: 0;
  background: rgba(255,255,255,.65);
  z-index: 80;
  display: grid; place-items: center;
}
.spin-box {
  background: var(--card);
  border-radius: 14px;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 8px 30px rgba(0,0,0,.18);
}
.spinner {
  width: 22px; height: 22px;
  border: 3px solid var(--line);
  border-top-color: var(--acc);
  border-radius: 50%;
  animation: rot .8s linear infinite;
  flex: none;
}
@keyframes rot { to { transform: rotate(360deg); } }

/* ---- イントロ ---- */
.overlay {
  position: fixed; inset: 0;
  background: rgba(31,41,55,.6);
  z-index: 55;
  display: grid; place-items: center;
  padding: 20px;
}
.intro {
  background: var(--card);
  border-radius: 18px;
  padding: 26px 22px;
  max-width: 420px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
}
.intro-logo {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--acc), var(--acc-d));
  border-radius: 18px;
  display: grid; place-items: center;
  font-size: 34px;
  margin-bottom: 12px;
}
.intro h2 { font-size: 18px; margin: 0 0 10px; }
.intro p { font-size: 13.5px; margin: 0 0 10px; }
.demo-chip {
  background: var(--acc-bg);
  color: var(--acc-ink);
  font-size: 11px;
  font-weight: 900;
  border-radius: 6px;
  padding: 2px 8px;
  vertical-align: 2px;
}

@media print {
  .demo-banner, .tabbar, .cartbar, .role-switch { display: none !important; }
  body { padding-bottom: 0; }
}

@media (min-width: 760px) {
  .menu-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
  .tgrid { grid-template-columns: repeat(4, 1fr); }
}
