* {
  box-sizing: border-box;
}

:root {
  --background: #f3f3f3;
  --card: #ffffff;
  --text: #111111;
  --muted: #666666;
  --line: #dddddd;
  --available-bg: #e5f5e9;
  --available-text: #17652a;
  --sold-out: #171717;
  --danger: #c90000;
}

body {
  margin: 0;
  padding: 18px;
  background: var(--background);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Yu Gothic", Meiryo, sans-serif;
}

.container {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}

h1 {
  margin: 0 0 8px;
  font-size: 30px;
  line-height: 1.35;
  letter-spacing: 0.02em;
}

.page-subtitle {
  margin: 0 0 18px;
  font-size: 23px;
}

.admin-label {
  display: inline-block;
  margin-bottom: 8px;
  padding: 5px 10px;
  border-radius: 5px;
  background: #111;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.sticky-area {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 10px 0 12px;
  background: var(--background);
}

.button {
  width: 100%;
  min-height: 50px;
  padding: 12px 16px;
  border: 2px solid #111;
  border-radius: 9px;
  background: #fff;
  color: #111;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.button:disabled {
  opacity: 0.65;
  cursor: wait;
}

.toolbar {
  display: flex;
  gap: 10px;
}

.toolbar .button {
  flex: 1;
}

.updated-time,
.message {
  min-height: 21px;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.message {
  color: #111;
  font-weight: 700;
}

.product {
  margin: 16px 0;
  padding: 18px;
  border-radius: 12px;
  background: var(--card);
  box-shadow: 0 2px 9px rgba(0, 0, 0, 0.08);
}

.product h2 {
  margin: 0 0 12px;
  font-size: 20px;
  line-height: 1.45;
}

.status-row,
.inventory-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.status-row:first-of-type,
.inventory-row:first-of-type {
  border-top: 0;
}

.item-name {
  flex: 1;
  font-weight: 700;
}

.status {
  display: inline-block;
  min-width: 82px;
  padding: 7px 11px;
  border-radius: 999px;
  text-align: center;
  font-weight: 800;
}

.status.available {
  background: var(--available-bg);
  color: var(--available-text);
}

.status.sold-out {
  background: var(--sold-out);
  color: #fff;
}

.status-text {
  width: 58px;
  text-align: center;
  font-size: 14px;
  font-weight: 800;
}

.status-text.available {
  color: var(--available-text);
}

.status-text.sold-out {
  color: var(--danger);
}

.switch {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: 64px;
  height: 36px;
}

.switch input {
  width: 0;
  height: 0;
  opacity: 0;
}

.slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #b8b8b8;
  cursor: pointer;
  transition: 0.18s;
}

.slider::before {
  position: absolute;
  bottom: 4px;
  left: 4px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  content: "";
  transition: 0.18s;
}

.switch input:checked + .slider {
  background: var(--danger);
}

.switch input:checked + .slider::before {
  transform: translateX(28px);
}

.switch input:disabled + .slider {
  opacity: 0.55;
  cursor: wait;
}

.error-box {
  margin: 14px 0;
  padding: 12px;
  border: 1px solid #d00000;
  border-radius: 8px;
  background: #fff1f1;
  color: #9a0000;
  line-height: 1.6;
}

.note {
  margin: 20px 0;
  padding: 14px;
  border-radius: 8px;
  background: #fff6ce;
  font-size: 14px;
  line-height: 1.7;
}

.hidden {
  display: none !important;
}

@media (max-width: 520px) {
  body {
    padding: 14px;
  }

  h1 {
    font-size: 23px;
  }

  .page-subtitle {
    font-size: 20px;
  }

  .product {
    padding: 15px;
  }

  .product h2 {
    font-size: 18px;
  }

  .toolbar {
    flex-direction: column;
  }
}
