:root {
  --ink: #20201d;
  --muted: #6e6a63;
  --line: #e1ded8;
  --paper: #f8f6f1;
  --panel: #ffffff;
  --charcoal: #313638;
  --green: #4d6f5b;
  --terracotta: #b75f3b;
  --gold: #c89b54;
  --shadow: 0 18px 45px rgba(36, 31, 25, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

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

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

button {
  cursor: pointer;
}

.site-header {
  min-height: 100vh;
  background: #efebe3;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(20px, 5vw, 72px);
  background: rgba(248, 246, 241, 0.88);
  border-bottom: 1px solid rgba(32, 32, 29, 0.08);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #fff;
  background: var(--charcoal);
  border-radius: 8px;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand small,
.nav-links,
.eyebrow,
.product-info span,
.dialog-category,
.panel-heading span,
.admin-product span,
.category-row small {
  color: var(--muted);
  font-size: 13px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 18px;
}

.nav-links a,
.ghost-button,
.text-button {
  border: 0;
  background: transparent;
  color: var(--charcoal);
}

.hero {
  display: grid;
  grid-template-columns: minmax(320px, 0.88fr) minmax(320px, 1.12fr);
  gap: clamp(24px, 5vw, 72px);
  align-items: center;
  padding: clamp(28px, 6vw, 74px) clamp(20px, 5vw, 72px) 52px;
}

.hero-copy {
  max-width: 620px;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.hero h1,
.admin-title h1 {
  margin: 0;
  font-size: clamp(42px, 7vw, 86px);
  line-height: 0.98;
}

.hero p,
.admin-title p,
.section-heading p {
  color: var(--muted);
  font-size: 18px;
  line-height: 1.8;
}

.primary-action,
.primary-button,
.inline-form button,
.tool-buttons button,
.import-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 20px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--green);
  font-weight: 700;
}

.hero-photo {
  min-height: min(70vh, 680px);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0) 58%, rgba(0, 0, 0, 0.25)),
    url("./catalog-images/yidaxuan-2024-p13.jpg")
      center / cover;
  box-shadow: var(--shadow);
}

.intro-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
}

.intro-strip div {
  display: grid;
  gap: 8px;
  min-height: 132px;
  align-content: center;
  padding: 28px clamp(20px, 5vw, 72px);
  background: #fff;
}

.intro-strip span,
.product-info p,
.dialog-content p {
  color: var(--muted);
  line-height: 1.7;
}

.catalog-shell,
.admin-layout {
  padding: 72px clamp(20px, 5vw, 72px);
}

.section-heading {
  max-width: 720px;
  margin-bottom: 28px;
}

.section-heading h2,
.panel h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 46px);
}

.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 28px;
}

.category-tabs button {
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--charcoal);
  background: #fff;
}

.category-tabs .is-active {
  color: #fff;
  border-color: var(--charcoal);
  background: var(--charcoal);
}

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

.product-card {
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(32, 32, 29, 0.08);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(36, 31, 25, 0.08);
}

.product-thumb {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: #ddd;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.product-thumb img,
.admin-product img,
.upload-box img,
.dialog-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-thumb img {
  display: block;
  transition: transform 0.45s ease;
}

.product-card:hover .product-thumb img {
  transform: scale(1.04);
}

.product-info {
  padding: 18px;
}

.product-info h3 {
  margin: 8px 0 6px;
  font-size: 22px;
}

.product-info p {
  min-height: 48px;
  margin: 0 0 12px;
}

.product-info strong,
.dialog-content dd:nth-child(odd) {
  color: var(--terracotta);
  font-size: 20px;
}

.empty-state {
  display: grid;
  gap: 10px;
  justify-items: start;
  padding: 30px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.empty-state a {
  color: var(--terracotta);
  font-weight: 800;
}

.product-dialog {
  width: min(980px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.product-dialog::backdrop {
  background: rgba(24, 25, 24, 0.58);
}

.product-dialog[open] {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
}

.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
}

.icon-button {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: rgba(0, 0, 0, 0.62);
  font-size: 24px;
  line-height: 1;
}

.dialog-media {
  min-height: 520px;
  background: #ddd;
}

.dialog-content {
  padding: 36px;
}

.dialog-content h3 {
  margin: 8px 0 20px;
  font-size: 34px;
}

.dialog-content dl {
  display: grid;
  gap: 14px;
  margin: 0 0 22px;
}

.dialog-content dl div {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.dialog-content dt {
  color: var(--muted);
}

.dialog-content dd {
  margin: 0;
  font-weight: 800;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 28px clamp(20px, 5vw, 72px);
  color: var(--muted);
  background: #fff;
  border-top: 1px solid var(--line);
}

.footer a {
  color: var(--green);
  font-weight: 800;
}

.admin-mini {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  color: #fff;
  background: rgba(49, 54, 56, 0.72);
  box-shadow: 0 12px 26px rgba(24, 25, 24, 0.2);
  backdrop-filter: blur(12px);
}

.admin-page {
  background: #f3f1ec;
}

.admin-header {
  background:
    linear-gradient(90deg, rgba(32, 32, 29, 0.84), rgba(32, 32, 29, 0.2)),
    url("https://images.unsplash.com/photo-1618220179428-22790b461013?auto=format&fit=crop&w=1600&q=90")
      center / cover;
  color: #fff;
}

.admin-header .topbar {
  color: var(--ink);
}

.admin-title {
  max-width: 760px;
  padding: 72px clamp(20px, 5vw, 72px) 92px;
}

.admin-title p,
.admin-title .eyebrow {
  color: rgba(255, 255, 255, 0.78);
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.75fr) minmax(420px, 1.25fr);
  gap: 22px;
}

.panel {
  padding: 24px;
  background: #fff;
  border: 1px solid rgba(32, 32, 29, 0.08);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(36, 31, 25, 0.08);
}

.product-editor,
.product-list-panel {
  grid-row: span 2;
}

.panel-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel h2 {
  font-size: 24px;
}

.inline-form,
.form-row,
.form-actions,
.tool-buttons {
  display: flex;
  gap: 12px;
}

.inline-form input,
.product-form input,
.product-form select,
.product-form textarea,
.data-tools textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
  color: var(--ink);
  outline: 0;
}

.inline-form input,
.product-form input,
.product-form select {
  min-height: 46px;
  padding: 0 14px;
}

.product-form textarea,
.data-tools textarea {
  padding: 12px 14px;
  resize: vertical;
}

.category-manager,
.product-form,
.admin-products,
.data-tools {
  display: grid;
  gap: 14px;
}

.category-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch span {
  display: block;
  width: 48px;
  height: 28px;
  padding: 3px;
  border-radius: 99px;
  background: #d7d2ca;
}

.switch span::before {
  display: block;
  width: 22px;
  height: 22px;
  content: "";
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s ease;
}

.switch input:checked + span {
  background: var(--green);
}

.switch input:checked + span::before {
  transform: translateX(20px);
}

.product-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.form-row label {
  flex: 1;
}

.upload-box {
  min-height: 210px;
  padding: 16px;
  border: 1px dashed #b8b1a6;
  border-radius: 8px;
  background: #fbfaf7;
}

.upload-box input {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
}

.upload-box img {
  display: none;
  height: 220px;
  border-radius: 8px;
}

.upload-box img.has-image {
  display: block;
}

.ghost-button,
.text-button,
.row-actions button {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.text-button,
.row-actions button:last-child {
  color: #a3452f;
}

.admin-product {
  display: grid;
  grid-template-columns: 116px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-product img {
  height: 88px;
  border-radius: 8px;
  background: #ddd;
}

.admin-product h3,
.admin-product p {
  margin: 5px 0;
}

.row-actions {
  display: grid;
  gap: 8px;
}

.import-button {
  position: relative;
  overflow: hidden;
  background: var(--gold);
}

.import-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.login-page {
  min-height: 100vh;
  background: #ebe7de;
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(360px, 0.82fr) minmax(420px, 1.18fr);
  min-height: 100vh;
}

.login-panel {
  display: grid;
  align-content: center;
  gap: 30px;
  padding: clamp(28px, 6vw, 76px);
  background: #fff;
}

.login-copy h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.05;
}

.login-copy p {
  color: var(--muted);
  line-height: 1.8;
}

.login-form {
  display: grid;
  gap: 16px;
}

.login-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.login-form input {
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
  outline: 0;
}

.login-error {
  margin: 0;
  color: #a3452f;
  font-weight: 700;
}

.login-visual {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.32)),
    url("https://images.unsplash.com/photo-1618220179428-22790b461013?auto=format&fit=crop&w=1600&q=90")
      center / cover;
}

@media (max-width: 980px) {
  .hero,
  .admin-layout,
  .product-dialog[open],
  .login-shell {
    grid-template-columns: 1fr;
  }

  .hero-photo {
    min-height: 420px;
  }

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

  .product-editor,
  .product-list-panel {
    grid-row: auto;
  }

  .dialog-media {
    min-height: 360px;
  }

  .login-visual {
    min-height: 340px;
    order: -1;
  }
}

@media (max-width: 680px) {
  .topbar,
  .footer,
  .intro-strip,
  .form-row,
  .form-actions,
  .inline-form,
  .tool-buttons {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar,
  .footer {
    position: static;
  }

  .nav-links,
  .intro-strip {
    display: grid;
    grid-template-columns: 1fr;
  }

  .hero h1,
  .admin-title h1 {
    font-size: 42px;
  }

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

  .category-row,
  .admin-product {
    grid-template-columns: 1fr;
  }

  .admin-product img {
    width: 100%;
    height: 180px;
  }
}
