* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
  line-height: 1.7;
  color: #222;
  background: #fafafa;
}

.container { max-width: 960px; margin: 0 auto; padding: 0 16px; }
main.container { padding-top: 24px; padding-bottom: 48px; min-height: 60vh; }

.site-header { background: #fff; border-bottom: 1px solid #ddd; }
.admin-header { background: #1f2937; border-bottom: none; }
.admin-header a, .admin-header .muted { color: #f3f4f6; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 12px; padding-bottom: 12px; }
.header-inner nav { display: flex; align-items: center; gap: 16px; }
.brand { font-weight: bold; font-size: 1.1rem; text-decoration: none; color: inherit; }

.site-footer { border-top: 1px solid #ddd; background: #fff; padding: 16px 0; color: #666; font-size: 0.9rem; }

.placeholder { color: #888; }
.muted { color: #888; }

form.inline { display: inline; margin: 0; }
.card { background: #fff; border: 1px solid #ddd; border-radius: 6px; padding: 20px; max-width: 420px; }
.card.wide { max-width: 720px; }
.card + .card { margin-top: 24px; }
label { display: block; margin-top: 12px; font-weight: bold; }
input[type="text"], input[type="password"], input[type="email"], input[type="tel"], select, textarea { width: 100%; padding: 8px; margin-top: 4px; border: 1px solid #bbb; border-radius: 4px; font-size: 1rem; font-family: inherit; background: #fff; }
input[type="number"] { width: 6em; padding: 8px; margin-top: 4px; border: 1px solid #bbb; border-radius: 4px; font-size: 1rem; font-family: inherit; background: #fff; }
input[type="file"] { margin-top: 4px; }
button, a.button { display: inline-block; padding: 8px 16px; border: 0; border-radius: 4px; background: #2563eb; color: #fff; font-size: 0.95rem; text-decoration: none; cursor: pointer; }
button.danger { background: #b91c1c; }
button:disabled { background: #d1d5db; color: #6b7280; cursor: not-allowed; }
.admin-header button { background: #4b5563; }
.card button { margin-top: 16px; }
.error { color: #b91c1c; background: #fee2e2; padding: 8px 12px; border-radius: 4px; }
.error ul { margin: 0; padding-left: 1.2em; }
.notice { color: #92400e; background: #fef3c7; padding: 8px 12px; border-radius: 4px; }
.field-error { color: #b91c1c; margin: 4px 0 0; font-size: 0.9rem; }
small.muted { display: block; margin-top: 2px; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }

.table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid #ddd; }
.table th, .table td { padding: 8px 12px; border-bottom: 1px solid #eee; text-align: left; }
.table th { background: #f3f4f6; font-size: 0.9rem; }
.table .num { text-align: right; }
.badge { display: inline-block; padding: 0 8px; border-radius: 10px; font-size: 0.85rem; background: #e5e7eb; color: #374151; }
.badge.published { background: #dcfce7; color: #166534; }
.badge.sold-out { background: #fee2e2; color: #991b1b; }

.image-grid { list-style: none; margin: 12px 0; padding: 0; display: flex; flex-wrap: wrap; gap: 16px; }
.image-grid li { width: 140px; }
.image-grid img { display: block; width: 140px; height: 140px; object-fit: cover; border: 1px solid #ddd; border-radius: 4px; background: #f3f4f6; }
.image-grid button { margin-top: 6px; padding: 4px 10px; }

/* ---- 公開側：商品一覧 ---- */
.product-grid { list-style: none; margin: 16px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; }
.product-card { background: #fff; border: 1px solid #ddd; border-radius: 6px; overflow: hidden; }
.product-card > a { display: block; color: inherit; text-decoration: none; }
.product-card img, .product-card .no-image { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: #f3f4f6; }
.product-card .no-image { display: flex; align-items: center; justify-content: center; color: #9ca3af; font-size: 0.9rem; }
.product-card .product-name { display: block; padding: 10px 12px 0; font-weight: bold; }
.product-card .product-meta { padding: 4px 12px 12px; }
.product-card .price { margin: 0 0 4px; }
.price { font-size: 1.1rem; font-weight: bold; }

/* ---- 公開側：商品詳細 ---- */
.product-detail .gallery { list-style: none; margin: 16px 0; padding: 0; display: flex; flex-wrap: wrap; gap: 12px; }
.product-detail .gallery img { display: block; width: 100%; max-width: 360px; border: 1px solid #ddd; border-radius: 4px; background: #f3f4f6; }
.product-detail .price { font-size: 1.5rem; margin: 8px 0; }
.product-detail .description { white-space: pre-line; }
.spec { display: grid; grid-template-columns: 8em minmax(0, 1fr); gap: 4px 16px; margin: 16px 0; padding: 12px 16px; background: #fff; border: 1px solid #ddd; border-radius: 6px; max-width: 560px; }
.spec dt { font-weight: bold; }
.spec dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.card.wide { overflow-wrap: anywhere; }
.purchase { margin: 24px 0; }
.purchase label { display: inline-block; margin: 0 8px 0 0; }

/* ---- 公開側：カート・チェックアウト・注文 ---- */
.cart-table td { vertical-align: top; }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 4px 24px; max-width: 360px; margin: 16px 0 16px auto; }
.totals dt, .totals dd { margin: 0; }
.totals dd { text-align: right; }
.totals .grand { font-weight: bold; font-size: 1.2rem; }
.cart-actions { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 16px; }
.order-number { font-size: 1.4rem; letter-spacing: 0.05em; }


