:root {
  --ink: #1d2420;
  --muted: #5b655f;
  --paper: #f5f3ee;
  --card: #ffffff;
  --line: #d8d5cc;
  --green: #1f5c46;
  --green-soft: #e4efe9;
  --red: #b3261e;
  --red-soft: #fbe9e7;
  --amber: #8a5a00;
  --amber-soft: #fdf3dc;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 18px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Hiragino Sans", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  line-height: 1.5;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }

.page { max-width: 640px; margin: 0 auto; padding: 72px 14px 112px; }
.page.no-nav { padding-bottom: 32px; }

/* 上の通信の表示 */
.status {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  min-height: 56px; padding: 8px 12px;
  padding-top: calc(8px + env(safe-area-inset-top));
  background: var(--green); color: #fff; font-size: .85rem; line-height: 1.3;
}
.status.off { background: var(--amber); }
.status strong { display: block; font-size: 1rem; }
.status .admin-btn {
  flex: none; min-height: 40px; padding: 4px 12px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,.6); background: transparent; color: #fff; font-size: .85rem;
}

/* 下の3つのボタン */
.nav {
  position: fixed; inset: auto 0 0 0; z-index: 20;
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--card); border-top: 2px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav button {
  min-height: 76px; border: 0; background: transparent; font-size: 1.15rem; font-weight: 700; color: var(--muted);
}
.nav button[aria-current="page"] { background: var(--green); color: #fff; }

/* ボタン */
.btn {
  display: block; width: 100%; min-height: 64px; padding: 10px 16px; border-radius: 12px;
  border: 2px solid var(--green); background: var(--card); color: var(--green);
  font-size: 1.15rem; font-weight: 700;
}
.btn.primary { background: var(--green); color: #fff; }
.btn.danger { border-color: var(--red); color: var(--red); }
.btn.danger.fill { background: var(--red); color: #fff; }
.btn:disabled { border-color: var(--line); background: #e9e7e1; color: #8b8f8a; cursor: not-allowed; }
.btn + .btn { margin-top: 10px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row .btn + .btn { margin-top: 0; }

/* カード・見出し */
.title { font-size: 1.4rem; font-weight: 800; margin-bottom: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 14px; }
.card h3 { font-size: 1.05rem; margin-bottom: 8px; }
.muted { color: var(--muted); font-size: .9rem; }
.empty { text-align: center; padding: 40px 12px; color: var(--muted); }
.notice { border-radius: 10px; padding: 12px; margin-bottom: 14px; font-weight: 600; background: var(--amber-soft); color: var(--amber); }
.notice.bad { background: var(--red-soft); color: var(--red); }

/* 売る：商品の写真 */
.search { width: 100%; min-height: 54px; padding: 8px 14px; border: 2px solid var(--line); border-radius: 12px; background: var(--card); margin-bottom: 10px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; }
.chip { flex: none; min-height: 46px; padding: 4px 16px; border-radius: 999px; border: 2px solid var(--line); background: var(--card); font-weight: 600; }
.chip[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #fff; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile {
  position: relative; display: block; padding: 0; overflow: hidden; text-align: left;
  border: 3px solid var(--line); border-radius: 12px; background: var(--card);
}
.tile.in-cart { border-color: var(--green); }
.tile .pic, .pic-box { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: #ebe8e0; }
.pic-empty { display: flex; align-items: center; justify-content: center; font-size: 2.2rem; font-weight: 800; color: #8c8f88; }
.tile .info { display: block; padding: 8px 10px 10px; }
.tile .name { display: block; font-weight: 700; line-height: 1.3; }
.tile .price { display: block; font-size: 1.2rem; font-weight: 800; color: var(--green); }
.tile .left { display: block; font-size: .85rem; color: var(--muted); }
.tile .left.low { color: var(--red); font-weight: 700; }
.tile .badge {
  position: absolute; top: 6px; right: 6px; min-width: 46px; height: 46px; padding: 0 8px; border-radius: 23px;
  display: flex; align-items: center; justify-content: center;
  background: var(--green); color: #fff; font-size: 1.3rem; font-weight: 800;
}
.cart-bar {
  position: fixed; left: 0; right: 0; bottom: calc(78px + env(safe-area-inset-bottom)); z-index: 15;
  padding: 10px 14px; background: var(--paper); border-top: 2px solid var(--line);
}
.cart-bar .inner { max-width: 612px; margin: 0 auto; }
.page.has-cart { padding-bottom: 200px; }

/* お会計 */
.line { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.line:last-child { border-bottom: 0; }
.line img, .line .thumb { width: 60px; height: 60px; border-radius: 8px; object-fit: cover; flex: none; background: #ebe8e0; }
.line .thumb { display: flex; align-items: center; justify-content: center; font-weight: 800; color: #8c8f88; }
.line .grow { flex: 1; min-width: 0; }
.line .name { font-weight: 700; line-height: 1.3; }
.stepper { display: flex; align-items: center; gap: 6px; flex: none; }
.stepper button { width: 52px; height: 52px; border-radius: 10px; border: 2px solid var(--green); background: var(--card); color: var(--green); font-size: 1.5rem; font-weight: 800; }
.stepper .num { min-width: 36px; text-align: center; font-size: 1.3rem; font-weight: 800; }
.stepper input { width: 64px; height: 52px; text-align: center; border: 2px solid var(--line); border-radius: 10px; font-size: 1.2rem; font-weight: 700; }
.total { display: flex; justify-content: space-between; align-items: baseline; font-size: 1.15rem; font-weight: 700; }
.total b { font-size: 2.2rem; font-weight: 800; }
.pay-tools { margin: 10px 0; }
.pay-tools .btn { min-height: 54px; border-color: var(--line); color: var(--ink); }
.keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 10px 0; }
.keys button { min-height: 52px; border-radius: 10px; border: 2px solid var(--line); background: var(--card); font-size: 1.4rem; font-weight: 700; }
.bills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.bills button { min-height: 64px; border-radius: 10px; border: 2px solid var(--green); background: var(--green-soft); color: var(--green); font-size: 1.2rem; font-weight: 800; }
.big-result { text-align: center; padding: 14px 10px; border-radius: 14px; background: var(--green-soft); color: var(--green); margin-bottom: 14px; }
.big-result.bad { background: var(--red-soft); color: var(--red); }
.big-result .label { font-size: 1.3rem; font-weight: 700; }
.big-result .value { font-size: 3.6rem; font-weight: 800; line-height: 1.15; overflow-wrap: anywhere; }

/* 在庫 */
.stock-num { font-size: 1.8rem; font-weight: 800; flex: none; text-align: right; min-width: 64px; }
.stock-num.low { color: var(--red); }
.stock-row { width: 100%; background: transparent; border: 0; border-bottom: 1px solid var(--line); text-align: left; }

/* しめ */
.sum { display: flex; justify-content: space-between; padding: 6px 0; font-size: 1.05rem; }
.sum.strong { border-top: 2px solid var(--ink); margin-top: 6px; padding-top: 10px; font-size: 1.25rem; font-weight: 800; }
.denom { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.denom .face { font-size: 1.1rem; font-weight: 700; width: 92px; flex: none; }
.denom .amount { flex: 1; text-align: right; color: var(--muted); font-size: .9rem; }

/* 入力欄 */
label.field { display: block; margin-bottom: 14px; font-weight: 700; }
label.field input, label.field select {
  display: block; width: 100%; min-height: 56px; margin-top: 4px; padding: 8px 12px;
  border: 2px solid var(--line); border-radius: 10px; background: var(--card); font-weight: 400;
}
input:focus-visible, button:focus-visible, select:focus-visible { outline: 3px solid #2f7dd1; outline-offset: 1px; }
.photo-pick { width: 150px; margin-bottom: 14px; }
.photo-pick img, .photo-pick .pic-empty { width: 150px; height: 150px; object-fit: cover; border-radius: 12px; background: #ebe8e0; display: flex; margin-bottom: 8px; }
.file-btn { display: flex; align-items: center; justify-content: center; min-height: 54px; border: 2px solid var(--green); color: var(--green); border-radius: 10px; font-weight: 700; background: var(--card); text-align: center; }
.file-btn input { position: absolute; width: 1px; height: 1px; opacity: 0; }

/* ログイン */
.login { max-width: 420px; margin: 0 auto; padding: 60px 20px; text-align: center; }
.login h1 { font-size: 1.7rem; margin-bottom: 8px; }
.login input { width: 100%; min-height: 72px; margin: 20px 0 12px; border: 2px solid var(--line); border-radius: 12px; text-align: center; font-size: 2rem; letter-spacing: .2em; background: var(--card); }
.error { color: var(--red); font-weight: 700; margin-bottom: 12px; }

/* 確認の窓 */
.modal-back {
  position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(20, 25, 22, .55);
}
.modal {
  width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  border-radius: 18px 18px 0 0; background: var(--paper);
}
.modal h2 { font-size: 1.35rem; margin-bottom: 10px; }
.modal p { margin-bottom: 14px; }
.toast {
  position: fixed; left: 50%; top: calc(66px + env(safe-area-inset-top)); z-index: 50; transform: translateX(-50%);
  width: max-content; max-width: 90vw; padding: 12px 20px; border-radius: 10px;
  background: var(--ink); color: #fff; font-weight: 700;
}
