:root {
  --bg: #faf6f0;
  --card: #ffffff;
  --ink: #4a3f38;
  --sub: #8a7d73;
  --line: #ece4da;
  --accent: #3d4b6e;      /* 夜空の紺 */
  --accent-soft: #e6e9f2;
  --warm: #c98b6b;
  --low: #d9822b;
  --sold: #9b9590;
  --ok: #4f8a5b;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(74, 63, 56, .06), 0 4px 14px rgba(74, 63, 56, .06);
  font-family: "Hiragino Maru Gothic ProN", "BIZ UDPGothic", "Yu Gothic UI", "Meiryo", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; line-height: 1.7; -webkit-text-size-adjust: 100%; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }

.proto-bar {
  background: #fff4d6; color: #7a5a12; font-size: 12.5px; text-align: center;
  padding: 6px 12px; border-bottom: 1px solid #f0e0b0;
}
.proto-bar a { color: inherit; font-weight: 700; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* ---------- お客さん向け ---------- */
.site-head { text-align: center; padding: 40px 20px 18px; }
.logo { font-size: 30px; letter-spacing: .18em; margin: 0; font-weight: 700; color: var(--accent); }
.logo .star { color: var(--warm); font-size: .7em; vertical-align: .35em; margin-left: .15em; }
.tagline { margin: 6px 0 0; color: var(--sub); font-size: 14px; }

.notice {
  max-width: 640px; margin: 16px auto 0; background: var(--accent-soft); color: var(--accent);
  border-radius: var(--radius); padding: 12px 16px; font-size: 13.5px; text-align: center;
}

.toolbar {
  position: sticky; top: 0; z-index: 5; background: rgba(250, 246, 240, .94);
  backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); padding: 12px 0; margin-top: 20px;
}
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 999px;
  padding: 6px 14px; font-size: 13.5px; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.filters { display: flex; gap: 10px; margin-top: 10px; align-items: center; flex-wrap: wrap; }
.filters input[type="search"], .filters select {
  border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 7px 12px; font-size: 14px;
}
.filters input[type="search"] { flex: 1 1 200px; min-width: 0; }
.check { display: inline-flex; gap: 6px; align-items: center; font-size: 13.5px; color: var(--sub); }
.count { color: var(--sub); font-size: 13px; margin: 16px 0 10px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; padding-bottom: 50px; }
@media (max-width: 520px) { .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; } .wrap { padding: 0 14px; } }

.card {
  background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  border: 0; padding: 0; text-align: left; display: flex; flex-direction: column; transition: transform .15s;
}
.card:hover { transform: translateY(-2px); }
.card .thumb { position: relative; aspect-ratio: 1; background: var(--line); }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card.is-soldout .thumb img { filter: grayscale(.5) opacity(.6); }
.card .body { padding: 10px 12px 14px; }
.card .cat { font-size: 11.5px; color: var(--sub); }
.card .name { font-size: 14.5px; margin: 2px 0 6px; line-height: 1.45; }
.card .row { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.price { font-weight: 700; }

.badge { display: inline-block; font-size: 12px; border-radius: 999px; padding: 2px 9px; font-weight: 700; white-space: nowrap; }
.badge.ok { background: #e4f1e6; color: var(--ok); }
.badge.low { background: #fbeadb; color: var(--low); }
.badge.soldout { background: #eeeceb; color: var(--sold); }
.thumb .badge.soldout { position: absolute; left: 10px; top: 10px; background: rgba(74, 63, 56, .82); color: #fff; }

.empty { text-align: center; color: var(--sub); padding: 60px 0; }

.site-foot { border-top: 1px solid var(--line); text-align: center; padding: 28px 20px 40px; color: var(--sub); font-size: 13px; }
.contact-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 12px 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 10px;
  padding: 10px 18px; border: 1px solid var(--line); background: var(--card); text-decoration: none;
  color: var(--ink); font-size: 14.5px;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: #b3402e; border-color: #f0cfc8; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }

/* モーダル */
.modal { position: fixed; inset: 0; background: rgba(40, 32, 28, .45); display: none; align-items: center; justify-content: center; z-index: 20; padding: 16px; }
.modal.open { display: flex; }
.sheet { background: var(--card); border-radius: 18px; max-width: 820px; width: 100%; max-height: 92vh; overflow: auto; position: relative; }
.close { position: absolute; right: 10px; top: 10px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .9); font-size: 20px; z-index: 2; }

.detail { display: grid; grid-template-columns: 1fr 1fr; }
@media (max-width: 680px) { .detail { grid-template-columns: 1fr; } }
.gallery .main { aspect-ratio: 1; background: var(--line); }
.gallery .main img { width: 100%; height: 100%; object-fit: cover; }
.gallery .thumbs { display: flex; gap: 6px; padding: 8px; flex-wrap: wrap; }
.gallery .thumbs button { width: 56px; height: 56px; padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; background: none; }
.gallery .thumbs button[aria-current="true"] { border-color: var(--accent); }
.gallery .thumbs img { width: 100%; height: 100%; object-fit: cover; }
.detail .info { padding: 26px 24px; }
.detail h2 { font-size: 20px; margin: 4px 0 8px; line-height: 1.45; }
.detail .price { font-size: 22px; }
.detail .desc { white-space: pre-wrap; color: #5e534b; font-size: 14.5px; margin: 16px 0; }
.howto { background: var(--bg); border-radius: 12px; padding: 14px; font-size: 13.5px; }
.howto .contact-btns { justify-content: flex-start; margin-bottom: 0; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff;
  padding: 10px 18px; border-radius: 999px; font-size: 14px; opacity: 0; transition: .2s; pointer-events: none; z-index: 30;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 管理画面 ---------- */
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 0 8px; flex-wrap: wrap; }
.admin-head h1 { font-size: 20px; margin: 0; color: var(--accent); }
.admin-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs button { border: 0; background: none; padding: 10px 16px; border-bottom: 3px solid transparent; color: var(--sub); }
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
@media (max-width: 620px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--card); border-radius: 12px; padding: 10px 14px; box-shadow: var(--shadow); border: 0; text-align: left; }
.stat .n { font-size: 22px; font-weight: 700; }
.stat .l { font-size: 12px; color: var(--sub); }
.stat[aria-pressed="true"] { outline: 2px solid var(--accent); }

.list { display: flex; flex-direction: column; gap: 8px; padding-bottom: 60px; }
.rowitem {
  display: grid; grid-template-columns: 56px 1fr auto auto; gap: 12px; align-items: center;
  background: var(--card); border-radius: 12px; padding: 8px 12px 8px 8px; box-shadow: var(--shadow);
}
.rowitem.hidden-item { opacity: .55; }
.rowitem img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; }
.rowitem .meta { min-width: 0; }
.rowitem .meta .name { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rowitem .meta .sub { font-size: 12px; color: var(--sub); }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); font-size: 20px; line-height: 1; }
.stepper .num { min-width: 34px; text-align: center; font-weight: 700; font-size: 17px; }
.stepper .num.zero { color: var(--sold); }
@media (max-width: 560px) {
  .rowitem { grid-template-columns: 48px 1fr auto; }
  .rowitem img { width: 48px; height: 48px; }
  .rowitem .edit { grid-column: 2 / 4; justify-self: end; }
}

.form { padding: 24px; display: grid; gap: 14px; }
.form h2 { margin: 0; font-size: 18px; }
.field label { display: block; font-size: 13px; color: var(--sub); margin-bottom: 4px; }
.field input[type="text"], .field input[type="number"], .field input[type="url"], .field input[type="email"], .field input[type="password"], .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; background: #fff; font-size: 15px;
}
.field textarea { min-height: 110px; resize: vertical; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.imgs { display: flex; gap: 8px; flex-wrap: wrap; }
.imgs .im { position: relative; width: 84px; height: 84px; border-radius: 10px; overflow: hidden; }
.imgs .im img { width: 100%; height: 100%; object-fit: cover; }
.imgs .im button { position: absolute; right: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .55); color: #fff; font-size: 13px; }
.imgs .im .first { position: absolute; left: 0; bottom: 0; right: 0; background: rgba(61, 75, 110, .8); color: #fff; font-size: 10.5px; text-align: center; }
.imgs label.add { width: 84px; height: 84px; border: 2px dashed var(--line); border-radius: 10px; display: flex; align-items: center; justify-content: center; color: var(--sub); font-size: 12px; text-align: center; cursor: pointer; }
.form .foot { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.hint { font-size: 12px; color: var(--sub); }
.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); max-width: 640px; }
