:root {
  --paper: #f3f1ed;
  --surface: #fbfaf8;
  --ink: #20201f;
  --muted: #74716c;
  --line: #d9d5ce;
  --line-strong: #c3beb5;
  --red: #9f241d;
  --red-dark: #7c1813;
  --red-soft: #f3dfdc;
  --green: #3b6752;
  --shadow: 0 20px 60px rgba(36, 31, 27, .08);
  font-family: Inter, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--paper); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 14px; font-size: 12px; font-weight: 750; letter-spacing: .16em; }
.eyebrow.accent { color: var(--red); }
.login-logo { width: min(330px, 100%); height: auto; display: block; object-fit: contain; }
.wordmark-logo { width: 154px; height: 46px; display: block; object-fit: contain; }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 1.1fr) minmax(400px, .9fr); }
.login-brand { padding: clamp(44px, 7vw, 96px); color: #f7f3ed; background: #292927; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-brand::after { content: ""; position: absolute; width: 56vw; height: 1px; background: rgba(255,255,255,.14); right: -8vw; bottom: 28%; transform: rotate(-23deg); box-shadow: 0 68px rgba(255,255,255,.08), 0 -68px rgba(255,255,255,.08); }
.login-brand h1 { max-width: 600px; margin: 0; font-family: Georgia, "Songti SC", serif; font-size: clamp(44px, 6vw, 84px); line-height: 1.08; font-weight: 500; }
.login-intro { max-width: 520px; margin-top: 28px; color: #bbb7b0; font-size: 17px; line-height: 1.8; }
.brand-foot { color: #8f8b85; font-size: 11px; letter-spacing: .16em; }
.login-panel { display: grid; place-items: center; padding: 40px; background: var(--surface); }
.login-form { width: min(390px, 100%); display: grid; gap: 24px; }
.login-form h2, .password-dialog h2 { margin: 0 0 8px; font-size: 30px; }
label { display: grid; gap: 9px; font-size: 13px; font-weight: 650; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 2px; color: var(--ink); background: #fff; outline: none; transition: border .15s, box-shadow .15s; }
input, select { min-height: 48px; padding: 0 14px; }
textarea { min-height: 104px; padding: 13px 14px; resize: vertical; line-height: 1.6; }
input:focus, select:focus, textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(159,36,29,.09); }
.primary-button { min-height: 50px; border: 0; border-radius: 2px; padding: 0 20px; color: white; background: var(--red); font-weight: 700; }
.primary-button:hover { background: var(--red-dark); }
.primary-button:disabled { opacity: .55; cursor: wait; }
.form-error { min-height: 20px; margin: -10px 0 0; color: var(--red); font-size: 13px; }

.app-shell { min-height: 100vh; }
.topbar { height: 72px; padding: 0 clamp(20px, 5vw, 72px); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(251,250,248,.94); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(14px); }
.wordmark { display: flex; align-items: center; color: inherit; text-decoration: none; }
.user-area { display: flex; align-items: center; gap: 20px; }
.user-copy { text-align: right; font-size: 13px; }
.user-copy b, .user-copy span { display: block; }
.user-copy span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.text-button { padding: 8px 0; border: 0; color: var(--red); background: transparent; }
.catalog-page, .detail-page { width: min(1480px, calc(100% - 40px)); margin: 0 auto; padding: 54px 0 80px; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 30px; margin-bottom: 34px; }
.page-heading h1 { margin: 0; font-family: Georgia, "Songti SC", serif; font-weight: 500; font-size: clamp(34px, 5vw, 58px); }
.page-heading p:not(.eyebrow) { color: var(--muted); }
.heading-note { padding-bottom: 8px; color: var(--muted); font-size: 12px; }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--green); }
.stats-grid { display: grid; grid-template-columns: repeat(5, 1fr); border: 1px solid var(--line-strong); background: var(--surface); }
.stat { min-height: 112px; padding: 20px; border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }
.stat b { display: block; margin-top: 12px; font-family: Georgia, serif; font-size: 30px; font-weight: 500; }
.stat span { color: var(--muted); font-size: 12px; }
.catalog-toolbar { display: grid; grid-template-columns: 1fr 220px; gap: 12px; margin-top: 26px; }
.search-box { position: relative; }
.search-box input { padding-left: 44px; }
.search-symbol { position: absolute; left: 16px; top: 11px; z-index: 1; color: var(--muted); font-size: 23px; }
.filter-row { min-height: 70px; display: flex; align-items: center; gap: 18px; border-bottom: 1px solid var(--line); }
.filter-row > span { flex: 0 0 auto; color: var(--muted); font-size: 12px; }
.filter-chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.filter-chip { white-space: nowrap; min-height: 34px; padding: 0 13px; border: 1px solid var(--line); border-radius: 20px; background: transparent; color: var(--muted); font-size: 12px; }
.filter-chip.active { color: white; border-color: var(--red); background: var(--red); }
.list-head { display: flex; justify-content: space-between; padding: 26px 0 14px; color: var(--muted); font-size: 12px; }
.list-head p { margin: 0; color: var(--ink); font-weight: 650; }
.product-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; border: 1px solid var(--line); background: var(--line); }
.product-card { min-width: 0; border: 0; padding: 0; color: inherit; text-align: left; background: var(--surface); }
.product-card:hover .product-image img { transform: scale(1.025); }
.product-image { aspect-ratio: 1.18; overflow: hidden; background: #e5e2dd; }
.product-image img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s ease; }
.image-fallback { width: 100%; height: 100%; display: grid; place-items: center; color: #9b9790; font-family: Georgia, serif; font-size: 32px; }
.product-copy { padding: 18px; }
.product-line { display: flex; justify-content: space-between; gap: 10px; align-items: start; }
.product-sku { color: var(--red); font-size: 12px; font-weight: 750; letter-spacing: .04em; }
.progress-number { font-family: Georgia, serif; font-size: 17px; }
.product-copy h3 { margin: 8px 0 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
.product-category { min-height: 18px; margin: 0; overflow: hidden; color: var(--muted); font-size: 11px; white-space: nowrap; text-overflow: ellipsis; }
.progress-track { height: 3px; margin-top: 16px; background: #ddd9d2; }
.progress-track i { display: block; height: 100%; background: var(--red); }
.missing-copy { margin: 10px 0 0; min-height: 18px; color: var(--muted); font-size: 11px; }
.load-more { display: block; min-width: 180px; min-height: 44px; margin: 30px auto 0; border: 1px solid var(--line-strong); background: transparent; }
.empty-state { grid-column: 1 / -1; padding: 80px 20px; text-align: center; background: var(--surface); color: var(--muted); }

.detail-back { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 26px; border: 0; padding: 0; background: transparent; color: var(--red); }
.detail-layout { display: grid; grid-template-columns: minmax(300px, .8fr) minmax(500px, 1.2fr); gap: clamp(30px, 5vw, 76px); }
.detail-media { position: sticky; top: 104px; align-self: start; }
.detail-main-image { aspect-ratio: 1.12; overflow: hidden; background: #e5e2dd; }
.detail-main-image img { width: 100%; height: 100%; object-fit: cover; }
.detail-gallery { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; margin-top: 10px; }
.gallery-thumb { aspect-ratio: 1; overflow: hidden; padding: 0; border: 1px solid var(--line); background: #e5e2dd; }
.gallery-thumb.active { border: 2px solid var(--red); }
.gallery-thumb img { width: 100%; height: 100%; display: block; object-fit: cover; }
.detail-identity { padding: 22px 0; border-bottom: 1px solid var(--line); }
.detail-identity h1 { margin: 8px 0; font-family: Georgia, "Songti SC", serif; font-size: clamp(30px, 4vw, 50px); font-weight: 500; }
.detail-summary { color: var(--muted); line-height: 1.7; }
.progress-summary { margin: 22px 0 30px; padding: 18px; border-left: 3px solid var(--red); background: var(--surface); }
.progress-summary b { font-family: Georgia, serif; font-size: 26px; }
.progress-summary span { margin-left: 10px; color: var(--muted); font-size: 12px; }
.spec-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.field-with-unit { position: relative; }
.field-with-unit input { padding-right: 46px; }
.field-with-unit i { position: absolute; right: 14px; top: 16px; color: var(--muted); font-size: 12px; font-style: normal; }
.span-2 { grid-column: span 2; }
.save-bar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line); }
.save-bar p { margin: 0; color: var(--muted); font-size: 12px; }
.history { margin-top: 52px; border-top: 1px solid var(--line-strong); }
.history h2 { margin: 28px 0 18px; font-size: 18px; }
.history-item { display: grid; grid-template-columns: 150px 1fr; gap: 24px; padding: 17px 0; border-top: 1px solid var(--line); font-size: 12px; }
.history-item time, .history-item span { color: var(--muted); }
.history-item p { margin: 5px 0 0; }

.password-dialog { width: min(450px, calc(100% - 32px)); border: 0; border-radius: 3px; padding: 0; box-shadow: var(--shadow); }
.password-dialog::backdrop { background: rgba(25,24,22,.68); backdrop-filter: blur(5px); }
.password-dialog form { display: grid; gap: 20px; padding: 34px; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 28px; transform: translate(-50%, 20px); min-width: 220px; max-width: calc(100% - 32px); padding: 13px 18px; border-radius: 3px; color: white; background: #292927; text-align: center; font-size: 13px; opacity: 0; pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.skeleton { min-height: 350px; background: linear-gradient(100deg, #efede9 25%, #f8f7f4 37%, #efede9 63%); background-size: 400% 100%; animation: shine 1.2s infinite; }
@keyframes shine { to { background-position-x: -400%; } }

@media (max-width: 1050px) {
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .stat:nth-child(3) { border-right: 0; }
  .stat:nth-child(n+4) { border-top: 1px solid var(--line); }
  .detail-layout { grid-template-columns: 1fr; }
  .detail-media { position: static; display: grid; grid-template-columns: minmax(260px, .7fr) 1fr; gap: 28px; }
}

@media (max-width: 760px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { min-height: 38vh; padding: 34px 24px; }
  .login-brand h1 { font-size: 42px; }
  .login-intro { margin-bottom: 0; font-size: 14px; }
  .brand-foot { display: none; }
  .login-panel { min-height: 62vh; padding: 38px 24px; place-items: start center; }
  .topbar { height: 64px; padding: 0 16px; }
  .wordmark-logo { width: 124px; height: 40px; }
  .user-copy span { display: none; }
  .user-area { gap: 12px; }
  .catalog-page, .detail-page { width: calc(100% - 28px); padding: 34px 0 60px; }
  .page-heading { display: block; margin-bottom: 24px; }
  .page-heading h1 { font-size: 38px; }
  .heading-note { margin-top: 18px; }
  .stats-grid { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; }
  .stat { min-width: 145px; scroll-snap-align: start; border-top: 0 !important; }
  .catalog-toolbar { grid-template-columns: 1fr; }
  .filter-row { display: block; padding: 16px 0; }
  .filter-row > span { display: block; margin-bottom: 10px; }
  .list-head span { display: none; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product-copy { padding: 13px; }
  .product-copy h3 { font-size: 14px; }
  .missing-copy { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .detail-media { display: block; }
  .detail-gallery { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .detail-identity { padding-bottom: 0; border-bottom: 0; }
  .spec-form { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .save-bar { align-items: stretch; flex-direction: column; }
  .save-bar .primary-button { width: 100%; }
  .history-item { grid-template-columns: 1fr; gap: 7px; }
}

@media (max-width: 410px) {
  .product-grid { grid-template-columns: 1fr; }
  .product-image { aspect-ratio: 1.5; }
}
