:root {
  --bg: #f2f3f5;
  --bg-soft: #ffffff;
  --panel: #ffffff;
  --line: #d9dde3;
  --text: #0f1115;
  --muted: #5f6773;
  --accent: #69c9ff;
  --accent-strong: #1d8fcc;
  --header: #111827;
}

body[data-theme="dark"] {
  --bg: #0d1117;
  --bg-soft: #111723;
  --panel: #131a26;
  --line: #273042;
  --text: #f2f5fb;
  --muted: #9aa6ba;
  --accent: #71d2ff;
  --accent-strong: #9ce2ff;
  --header: #060b14;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans JP", sans-serif;
}

a {
  text-decoration: none;
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
}

.global-header {
  background: var(--header);
  color: #f7f8fb;
  border-bottom: 1px solid #1d2534;
}

.header-main {
  max-width: 1600px;
  margin: 0 auto;
  padding: 10px 16px;
  display: grid;
  grid-template-columns: 140px 1fr auto;
  gap: 12px;
  align-items: center;
}

.brand {
  font-size: 1.45rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
}

.brand-logo {
  height: 100px;
  width: auto;
  display: block;
}

.header-search-wrap {
  display: flex;
}

.header-search {
  width: 100%;
  border: 1px solid #2f3a50;
  background: #ffffff;
  color: #111827;
  border-radius: 2px;
  padding: 10px 12px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-link {
  border: 1px solid #2f3a50;
  background: #1a2232;
  color: #f1f4fb;
  padding: 8px 12px;
  border-radius: 2px;
  cursor: pointer;
}

.header-user {
  border: 1px solid #2f3a50;
  padding: 8px 12px;
  border-radius: 2px;
  background: #1a2232;
}

.header-subnav {
  max-width: 1600px;
  margin: 0 auto;
  padding: 8px 16px 10px;
  display: flex;
  gap: 18px;
  font-size: 0.9rem;
  color: #d0d6e3;
}

.store-layout {
  max-width: 1600px;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
}

.sidebar {
  display: grid;
  gap: 16px;
  align-content: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 14px;
}

.panel h2 {
  margin: 0 0 10px;
  font-size: 1.05rem;
}

.stack {
  display: grid;
  gap: 10px;
}

.kv {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--bg-soft);
}

.kv span {
  color: var(--muted);
  font-size: 0.82rem;
}

.order-row {
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 10px;
  background: var(--bg-soft);
}

.order-row p {
  margin: 0;
}

.order-item {
  font-weight: 700;
  margin-bottom: 4px;
}

.order-date,
.order-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.content {
  min-width: 0;
}

.content-head {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 14px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.content-head h1 {
  margin: 0;
  font-size: 1.55rem;
}

.content-head p {
  margin: 0;
  color: var(--muted);
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.product-image-wrap {
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--bg-soft);
}

.product-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.catalog-toolbar {
  margin-bottom: 12px;
}

.catalog-toolbar-row {
  display: grid;
  grid-template-columns: 1.5fr repeat(2, minmax(140px, 1fr)) auto;
  gap: 10px;
  align-items: end;
}

.catalog-filter {
  display: grid;
  gap: 6px;
}

.catalog-filter span {
  color: var(--muted);
  font-size: 0.82rem;
}

.product-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.product-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 12px;
  display: grid;
  gap: 9px;
}

.product-meta {
  display: flex;
}

.category {
  display: inline-block;
  font-size: 0.78rem;
  color: var(--accent-strong);
  border: 1px solid var(--accent);
  border-radius: 2px;
  padding: 2px 6px;
}

.product-card h4 {
  margin: 0;
  font-size: 1rem;
}

.description {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  min-height: 52px;
}

.price {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 900;
  color: #c93115;
}

.primary {
  border: 1px solid #b6a00a;
  background: #ffd814;
  color: #1f2937;
  border-radius: 20px;
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 700;
}

.primary-button {
  border: 1px solid #b6a00a;
  background: #ffd814;
  color: #1f2937;
  border-radius: 20px;
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 700;
}

.text-button {
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  border-radius: 2px;
  padding: 6px 10px;
  cursor: pointer;
}

.modal {
  border: 0;
  padding: 0;
  background: transparent;
}

.modal::backdrop {
  background: rgba(2, 8, 20, 0.65);
}

.modal-panel {
  width: min(480px, calc(100vw - 24px));
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 2px;
  padding: 14px;
  display: grid;
  gap: 10px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-head h3 {
  margin: 0;
}

.switch-row {
  display: flex;
  gap: 8px;
}

.switch-chip {
  border: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: 2px;
  padding: 7px 10px;
  cursor: pointer;
}

.switch-chip.active {
  border-color: var(--accent);
  color: var(--accent-strong);
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.92rem;
}

.field-stack {
  display: grid;
  gap: 10px;
}

.required-note {
  color: #d93025;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  border-radius: 2px;
  padding: 10px 11px;
}

.status {
  display: none;
  border: 1px solid var(--accent);
  background: rgba(105, 201, 255, 0.12);
  color: var(--accent-strong);
  border-radius: 2px;
  padding: 9px 10px;
  font-size: 0.9rem;
}

.status.visible {
  display: block;
}

.hidden {
  display: none;
}

.page-shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 18px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.topbar h1 {
  margin: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ghost-button {
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  border-radius: 2px;
  padding: 8px 11px;
  cursor: pointer;
}

.card {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 2px;
  padding: 14px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.hero-badge {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 700;
}

.hero-copy h2 {
  margin: 0 0 8px;
  font-size: 1.4rem;
}

.hero-copy p {
  margin: 0;
  color: var(--muted);
}

.hero-panel {
  width: 260px;
  display: grid;
  gap: 8px;
}

.hero-stat {
  border: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: 2px;
  padding: 10px;
}

.hero-stat span {
  color: var(--muted);
  font-size: 0.82rem;
}

.hero-stat strong {
  display: block;
  margin-top: 4px;
  font-size: 1.3rem;
}

.dual-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.section-head h3 {
  margin: 0;
}

.stack-form {
  display: grid;
  gap: 10px;
}

.full {
  width: 100%;
}

.secondary-button {
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  border-radius: 2px;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 700;
}

.orders-table {
  overflow: auto;
}

.orders-table table {
  width: 100%;
  border-collapse: collapse;
}

.orders-table th,
.orders-table td {
  border-bottom: 1px solid var(--line);
  padding: 9px 8px;
  text-align: left;
}

.orders-table th {
  color: var(--muted);
  font-size: 0.83rem;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-chip-doing {
  background: rgba(255, 216, 20, 0.16);
  color: #9a6a00;
}

.status-chip-done {
  background: rgba(34, 197, 94, 0.14);
  color: #0f7a39;
}

.cart-hero {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.cart-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 10px;
  min-width: min(100%, 320px);
}

.cart-list {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.cart-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--bg-soft);
}

.cart-row h4 {
  margin: 0 0 6px;
}

.cart-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.cart-controls {
  min-width: 180px;
  display: grid;
  gap: 8px;
  justify-items: end;
}

.cart-qty {
  width: 100%;
  display: grid;
  gap: 6px;
}

.cart-qty span {
  color: var(--muted);
  font-size: 0.82rem;
}

.cart-qty input {
  width: 100%;
}

.cart-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.order-actions {
  display: flex;
  justify-content: flex-end;
}

.product-detail {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.product-detail-image-wrap {
  width: min(360px, 100%);
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: 2px;
  overflow: hidden;
  background: var(--bg-soft);
}

.product-detail-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-detail-copy {
  flex: 1;
  min-width: 0;
}

.product-detail-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.product-detail-price {
  font-size: 1.5rem;
  font-weight: 900;
  color: #c93115;
}

.product-detail-panel {
  width: min(320px, 100%);
  display: grid;
  gap: 10px;
}

.admin-item-thumb {
  width: 160px;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--bg-soft);
}

.admin-image-preview {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 2px;
  background: var(--bg-soft);
  color: var(--muted);
  font-size: 0.85rem;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.admin-image-preview.has-image {
  color: transparent;
}

.admin-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.admin-item-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.8rem;
  background: var(--bg-soft);
}

.admin-item-copy {
  flex: 1;
  min-width: 0;
}

.admin-item-list {
  display: grid;
  gap: 10px;
}

.admin-item-row {
  border: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: 2px;
  padding: 10px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.admin-item-row h4,
.admin-item-row p {
  margin: 0;
}

.admin-item-actions {
  display: flex;
  gap: 8px;
}

.status-banner {
  display: none;
  border: 1px solid var(--accent);
  background: rgba(105, 201, 255, 0.12);
  color: var(--accent-strong);
  border-radius: 2px;
  padding: 9px 10px;
  margin-top: 10px;
}

.status-banner.visible {
  display: block;
}

.login-shell {
  max-width: 760px;
}

.login-card {
  max-width: 620px;
}

.cloudpages-note {
  margin: 0 0 12px;
  color: var(--muted);
}

.auth-pending {
  visibility: hidden;
}

@media (max-width: 1000px) {
  .store-layout {
    grid-template-columns: 1fr;
  }

  .header-main {
    grid-template-columns: 1fr;
  }

  .header-actions {
    flex-wrap: wrap;
    width: 100%;
  }

  .header-link,
  .header-user {
    text-align: center;
  }

  .hero {
    flex-direction: column;
  }

  .hero-panel {
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dual-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .page-shell {
    padding: 12px;
  }

  .header-main {
    padding: 10px 12px;
    gap: 10px;
  }

  .brand-logo {
    height: 72px;
  }

  .content-head,
  .topbar,
  .section-head,
  .cart-hero,
  .product-detail,
  .admin-item-row,
  .cart-row {
    flex-direction: column;
    align-items: stretch;
  }

  .catalog-toolbar-row {
    grid-template-columns: 1fr 1fr;
  }

  .catalog-toolbar-row .ghost-button {
    grid-column: 1 / -1;
  }

  .hero-panel,
  .cart-summary {
    width: 100%;
    grid-template-columns: 1fr 1fr;
  }

  .product-detail-image-wrap,
  .product-detail-panel,
  .admin-item-thumb {
    width: 100%;
    max-width: none;
  }

  .cart-controls {
    width: 100%;
    min-width: 0;
    justify-items: stretch;
  }

  .admin-item-actions,
  .cart-actions,
  .topbar-actions,
  .product-actions {
    width: 100%;
    flex-direction: column;
  }

  .admin-item-actions > *,
  .cart-actions > *,
  .topbar-actions > *,
  .product-actions > * {
    width: 100%;
  }

  .content-head h1 {
    font-size: 1.35rem;
  }

  .hero-copy h2 {
    font-size: 1.25rem;
  }

  .product-card h4 {
    font-size: 0.98rem;
  }

  .description {
    min-height: 0;
  }
}

@media (max-width: 560px) {
  .header-main {
    grid-template-columns: 1fr;
  }

  .header-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }

  .header-actions > * {
    width: 100%;
  }

  .catalog-toolbar-row {
    grid-template-columns: 1fr;
  }

  .hero-panel,
  .cart-summary {
    grid-template-columns: 1fr;
  }

  .catalog-grid {
    grid-template-columns: 1fr;
  }

  .product-detail {
    gap: 12px;
  }

  .product-detail-meta {
    align-items: flex-start;
  }

  .cart-row {
    gap: 10px;
  }

  .orders-table table,
  .orders-table thead,
  .orders-table tbody,
  .orders-table tr,
  .orders-table th,
  .orders-table td {
    display: block;
  }

  .orders-table thead {
    position: absolute;
    left: -9999px;
  }

  .orders-table tr {
    border: 1px solid var(--line);
    border-radius: 2px;
    margin-bottom: 10px;
    overflow: hidden;
  }

  .orders-table td {
    border-bottom: 1px solid var(--line);
  }

  .orders-table td:last-child {
    border-bottom: 0;
  }
}
