:root {
  --ink: #211d18;
  --ink-soft: #51473b;
  --muted: #786f60;
  --paper: #f5efe1;
  --paper-deep: #eadcc2;
  --panel: #fff8ea;
  --line: #cdbb9a;
  --jade: #2f7565;
  --jade-dark: #1f5148;
  --cinnabar: #ad2f1f;
  --gold: #b48946;
  --danger: #a72d21;
  --warn: #b8872d;
  --shadow: 0 28px 70px rgba(50, 38, 22, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 14% 4%, rgba(173, 47, 31, 0.12), transparent 24%),
    radial-gradient(circle at 86% 12%, rgba(47, 117, 101, 0.12), transparent 26%),
    linear-gradient(90deg, rgba(84, 65, 39, 0.045) 1px, transparent 1px),
    linear-gradient(0deg, rgba(84, 65, 39, 0.04) 1px, transparent 1px),
    var(--paper);
  background-size: auto, auto, 36px 36px, 36px 36px, auto;
  font-family: "Songti SC", "STSong", "Noto Serif SC", "PingFang SC", serif;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(120deg, rgba(255, 255, 255, 0.34), transparent 22%, rgba(80, 62, 38, 0.05) 48%, transparent 72%),
    repeating-linear-gradient(95deg, rgba(61, 47, 30, 0.025) 0 1px, transparent 1px 7px);
  mix-blend-mode: multiply;
}

button,
select {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 58px;
}

.topbar {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto minmax(260px, 320px);
  align-items: end;
  gap: 24px;
  margin-bottom: 30px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(113, 91, 54, 0.24);
}

.topbar::after {
  position: absolute;
  right: 0;
  bottom: -2px;
  width: min(420px, 45vw);
  height: 3px;
  content: "";
  background: linear-gradient(90deg, transparent, var(--cinnabar), var(--gold));
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--jade);
  font-family: "Avenir Next", "PingFang SC", sans-serif;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(34px, 4.4vw, 64px);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: 0;
}

.seal {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  color: #fff7e6;
  background: var(--cinnabar);
  border: 2px solid #8f2519;
  box-shadow: inset 0 0 0 4px rgba(255, 248, 232, 0.18), 0 12px 28px rgba(116, 38, 27, 0.22);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.05;
}

.picker {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-family: "Avenir Next", "PingFang SC", sans-serif;
  font-size: 13px;
  font-weight: 800;
}

.picker select {
  width: 100%;
  height: 46px;
  padding: 0 38px 0 14px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 2px;
  background: linear-gradient(180deg, #fff9ec, #f4ead6);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.42);
}

.product-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(360px, 0.96fr);
  gap: 20px;
  min-height: 580px;
}

.visual-panel {
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  min-height: 580px;
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(255, 248, 232, 0.88), rgba(232, 213, 179, 0.78)),
    radial-gradient(circle at 52% 52%, rgba(255, 250, 238, 0.98), rgba(219, 194, 151, 0.62) 72%);
  box-shadow: var(--shadow);
}

.visual-panel::before,
.visual-panel::after {
  position: absolute;
  content: "";
  pointer-events: none;
}

.visual-panel::before {
  inset: 24px;
  border: 1px solid rgba(95, 74, 42, 0.2);
  box-shadow: inset 0 0 0 8px rgba(255, 248, 232, 0.24);
}

.visual-panel::after {
  right: -54px;
  bottom: -52px;
  width: 220px;
  height: 220px;
  border: 1px solid rgba(173, 47, 31, 0.22);
  transform: rotate(14deg);
}

.brush-mark {
  position: absolute;
  top: 19%;
  left: 12%;
  width: 62%;
  height: 52%;
  background:
    radial-gradient(ellipse at 28% 44%, rgba(33, 29, 24, 0.13), transparent 55%),
    radial-gradient(ellipse at 62% 50%, rgba(47, 117, 101, 0.11), transparent 58%);
  filter: blur(1px);
  transform: rotate(-9deg);
}

.visual-panel img {
  position: relative;
  z-index: 1;
  width: min(82%, 520px);
  max-height: 480px;
  object-fit: contain;
  filter: drop-shadow(0 30px 32px rgba(38, 29, 17, 0.28));
}

.image-fallback {
  display: none;
  z-index: 1;
  color: var(--muted);
  font-weight: 800;
}

.availability {
  position: absolute;
  z-index: 2;
  top: 24px;
  left: 24px;
  padding: 9px 12px;
  color: #fff7e6;
  background: var(--jade-dark);
  border: 1px solid rgba(255, 248, 232, 0.32);
  font-family: "Avenir Next", "PingFang SC", sans-serif;
  font-size: 13px;
  font-weight: 800;
}

.availability.risk {
  background: var(--danger);
}

.availability.warn {
  color: var(--ink);
  background: #dcb45b;
}

.detail-panel,
.metric,
.flow-panel,
.factory-panel,
.catalog-band {
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 249, 235, 0.96), rgba(247, 237, 217, 0.92)),
    var(--panel);
}

.detail-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(26px, 4vw, 48px);
  box-shadow: var(--shadow);
}

.detail-panel::after {
  position: absolute;
  right: 26px;
  top: 26px;
  width: 44px;
  height: 136px;
  border-right: 2px solid rgba(173, 47, 31, 0.34);
  border-top: 2px solid rgba(173, 47, 31, 0.34);
  content: "";
}

.category-line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 28px;
  padding-right: 50px;
}

.category-line span {
  padding: 8px 11px;
  border: 1px solid rgba(47, 117, 101, 0.38);
  color: var(--jade-dark);
  background: rgba(232, 244, 235, 0.5);
  font-family: "Avenir Next", "PingFang SC", sans-serif;
  font-size: 13px;
  font-weight: 800;
}

h2 {
  max-width: 9ch;
  margin-bottom: 12px;
  font-size: clamp(50px, 7vw, 96px);
  font-weight: 700;
  line-height: 0.92;
  letter-spacing: 0;
}

.product-code {
  color: var(--muted);
  font-family: "Avenir Next", "PingFang SC", sans-serif;
  font-weight: 700;
}

.price-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 34px 0;
}

.price-row > div,
.action-strip {
  padding: 18px;
  border: 1px solid rgba(205, 187, 154, 0.88);
  background: rgba(244, 232, 207, 0.72);
}

.label,
.metric span,
.flow-bars span {
  display: block;
  color: var(--muted);
  font-family: "Avenir Next", "PingFang SC", sans-serif;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.price-row strong,
.action-strip strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(22px, 2.2vw, 34px);
}

.inventory-meter {
  margin-top: auto;
}

.meter-copy {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}

.meter-copy span {
  color: var(--muted);
  font-family: "Avenir Next", "PingFang SC", sans-serif;
  font-weight: 800;
}

.meter-copy strong {
  color: var(--jade-dark);
  font-size: clamp(42px, 5vw, 72px);
  line-height: 0.9;
}

.meter-track {
  height: 12px;
  overflow: hidden;
  background: #dfcfb0;
}

.meter-track span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--jade), var(--gold));
  transition: width 400ms ease;
}

.meter-track span.risk {
  background: linear-gradient(90deg, var(--danger), var(--cinnabar));
}

.meter-track span.warn {
  background: linear-gradient(90deg, var(--warn), #d6a84d);
}

.action-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 24px;
}

.action-strip button {
  height: 42px;
  padding: 0 16px;
  border: 1px solid #7c2319;
  color: #fff7e6;
  background: var(--cinnabar);
  cursor: pointer;
  font-family: "Avenir Next", "PingFang SC", sans-serif;
  font-weight: 800;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 20px 0;
}

.metric {
  position: relative;
  min-height: 122px;
  padding: 22px;
}

.metric::after {
  position: absolute;
  right: 16px;
  bottom: 14px;
  width: 36px;
  height: 36px;
  border-right: 1px solid rgba(173, 47, 31, 0.34);
  border-bottom: 1px solid rgba(173, 47, 31, 0.34);
  content: "";
}

.metric strong {
  display: block;
  margin-top: 14px;
  font-size: clamp(28px, 3vw, 46px);
  line-height: 1;
}

.content-grid {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 20px;
}

.flow-panel,
.factory-panel,
.catalog-band {
  padding: 24px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.section-head h3 {
  margin-bottom: 0;
  font-size: clamp(24px, 2vw, 34px);
}

.flow-bars {
  display: grid;
  gap: 18px;
}

.flow-bars div {
  display: grid;
  grid-template-columns: 52px 1fr minmax(64px, auto);
  align-items: center;
  gap: 14px;
}

.flow-bars i {
  display: block;
  height: 14px;
  width: 0%;
  background: linear-gradient(90deg, var(--jade), var(--gold));
  transition: width 400ms ease;
}

.flow-bars div:nth-child(2) i {
  background: linear-gradient(90deg, var(--cinnabar), #c98245);
}

.flow-bars div:nth-child(3) i {
  background: linear-gradient(90deg, var(--ink), var(--ink-soft));
}

.flow-bars strong {
  text-align: right;
}

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

.factory-row {
  display: grid;
  grid-template-columns: 1fr repeat(3, minmax(74px, auto));
  gap: 12px;
  align-items: center;
  padding: 14px;
  background: rgba(246, 234, 210, 0.76);
  border-left: 5px solid var(--jade);
}

.factory-row.risk {
  border-left-color: var(--danger);
}

.factory-row.warn {
  border-left-color: var(--warn);
}

.factory-row.active {
  outline: 3px solid rgba(173, 47, 31, 0.18);
  background: rgba(255, 247, 230, 0.96);
}

.factory-row b {
  font-size: 17px;
}

.factory-row span {
  color: var(--muted);
  font-family: "Avenir Next", "PingFang SC", sans-serif;
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

.factory-row strong {
  display: block;
  color: var(--ink);
  font-family: "Songti SC", "STSong", serif;
  font-size: 18px;
}

.catalog-band {
  margin-top: 20px;
}

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

.catalog button {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 78px;
  padding: 10px;
  text-align: left;
  border: 1px solid rgba(205, 187, 154, 0.9);
  background: rgba(246, 234, 210, 0.72);
  cursor: pointer;
}

.catalog button.active {
  outline: 3px solid rgba(173, 47, 31, 0.18);
  border-color: var(--cinnabar);
}

.catalog img {
  width: 54px;
  height: 54px;
  object-fit: cover;
  background: #ddcba8;
}

.catalog b,
.catalog span {
  display: block;
}

.catalog span {
  margin-top: 4px;
  color: var(--muted);
  font-family: "Avenir Next", "PingFang SC", sans-serif;
  font-size: 12px;
  font-weight: 800;
}

@media (max-width: 880px) {
  .topbar {
    grid-template-columns: 1fr auto;
    align-items: end;
  }

  .picker {
    grid-column: 1 / -1;
  }

  .action-strip,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .product-stage,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .visual-panel {
    min-height: 400px;
  }

  .detail-panel {
    min-height: 520px;
  }

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

@media (max-width: 560px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
  }

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

  .seal {
    position: absolute;
    top: 6px;
    right: 0;
    width: 48px;
    height: 48px;
    font-size: 16px;
  }

  .price-row,
  .insight-grid {
    grid-template-columns: 1fr;
  }

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

  .factory-row b {
    grid-column: 1 / -1;
  }
}
