:root {
  --bg: #f7f3ee;
  --surface: #fffdf9;
  --ink: #2f2a24;
  --muted: #73685e;
  --line: #dfd7cd;
  --accent: #55734f;
  --accent-2: #be6f54;
  --accent-3: #d9a441;
  --shadow: 0 18px 40px rgba(70, 52, 35, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family:
    Inter, "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

button,
input,
select {
  font: inherit;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  padding: 24px clamp(18px, 4vw, 48px) 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(24px, 3vw, 34px);
}

.view-switcher {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.view-switcher button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
}

.view-switcher .is-active {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}

main {
  padding: 0 clamp(18px, 4vw, 48px) 40px;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.hero {
  position: relative;
  min-height: min(54vh, 520px);
  overflow: hidden;
  border-radius: 8px;
  margin-bottom: 24px;
}

.hero img {
  width: 100%;
  height: 100%;
  min-height: min(54vh, 520px);
  object-fit: cover;
  display: block;
}

.hero-copy {
  position: absolute;
  right: clamp(18px, 4vw, 42px);
  bottom: clamp(18px, 4vw, 36px);
  max-width: 460px;
  color: white;
  text-shadow: 0 3px 18px rgba(0, 0, 0, 0.35);
}

.hero-copy p {
  margin-bottom: 10px;
}

.hero-copy h2 {
  margin-bottom: 0;
  font-size: clamp(24px, 4vw, 38px);
  line-height: 1.25;
}

.shop-toolbar {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}

.shop-toolbar label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.shop-toolbar input,
.shop-toolbar select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 12px;
  border-radius: 8px;
}

.catalog-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.product-card,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.product-card {
  overflow: hidden;
}

.product-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}

.product-body {
  padding: 14px;
}

.product-meta,
.panel-heading,
.cart-total,
.order-row,
.stock-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.product-body h3 {
  font-size: 17px;
  margin-bottom: 8px;
}

.product-body p {
  color: var(--muted);
  font-size: 14px;
  min-height: 42px;
}

.product-meta {
  margin-bottom: 12px;
}

.badge {
  padding: 4px 8px;
  background: #ece7df;
  border-radius: 999px;
  font-size: 12px;
}

.primary-button,
.secondary-button {
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 12px 14px;
  cursor: pointer;
}

.primary-button {
  background: var(--ink);
  color: white;
}

.secondary-button {
  background: var(--accent);
  color: white;
}

.purchase-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 8px;
  align-items: end;
}

.purchase-row label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.purchase-row select {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  border-radius: 8px;
  padding: 11px 10px;
}

.cart-panel {
  position: sticky;
  top: 16px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel-heading {
  margin-bottom: 14px;
}

.panel-heading h3 {
  margin-bottom: 0;
}

.panel-heading span {
  color: var(--muted);
  font-size: 13px;
}

.cart-items {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.cart-item {
  display: grid;
  gap: 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.cart-item small {
  color: var(--muted);
}

.cart-total {
  margin-bottom: 14px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric {
  padding: 18px;
}

.metric span {
  color: var(--muted);
  display: block;
  margin-bottom: 8px;
}

.metric strong {
  font-size: 28px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.panel {
  padding: 18px;
}

.stock-row,
.order-row {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.table-panel {
  padding-bottom: 8px;
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  text-align: left;
  padding: 12px 10px;
  border-top: 1px solid var(--line);
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-weight: 500;
  font-size: 13px;
}

.ai-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.ai-card p {
  color: var(--muted);
}

pre {
  min-height: 148px;
  margin: 14px 0 0;
  white-space: pre-wrap;
  background: #f4efe8;
  border-radius: 8px;
  padding: 12px;
  line-height: 1.6;
}

dialog {
  border: 0;
  border-radius: 8px;
  padding: 0;
  max-width: 420px;
  width: calc(100% - 32px);
}

dialog::backdrop {
  background: rgba(20, 16, 12, 0.42);
}

dialog form {
  padding: 18px;
}

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

.dialog-head button {
  border: 0;
  background: transparent;
  font-size: 24px;
  cursor: pointer;
}

@media (max-width: 980px) {
  .catalog-layout,
  .admin-grid,
  .ai-grid {
    grid-template-columns: 1fr;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cart-panel {
    position: fixed;
    top: auto;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 20;
    box-shadow: var(--shadow);
    padding: 14px;
  }

  .cart-panel .panel-heading,
  .cart-panel .cart-items {
    display: none;
  }

  .cart-total {
    margin-bottom: 10px;
  }

  body {
    padding-bottom: 118px;
  }
}

@media (max-width: 700px) {
  .topbar {
    display: grid;
    align-items: start;
  }

  .shop-toolbar,
  .metric-grid,
  .product-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: 360px;
  }

  .hero img {
    min-height: 360px;
  }
}
