:root {
  --ink: #17202a;
  --muted: #667085;
  --line: #d7dee8;
  --paper: #ffffff;
  --wash: #f4f7fb;
  --navy: #102a43;
  --blue: #1d5fa7;
  --blue-deep: #154f8d;
  --gold: #b9892f;
  --green: #0f766e;
  --danger: #b42318;
  --shadow: 0 18px 40px rgba(16, 42, 67, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--wash);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

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

button,
input,
textarea {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 0 clamp(20px, 5vw, 72px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: white;
  background: var(--navy);
  border: 3px solid var(--gold);
  border-radius: 6px;
  letter-spacing: 0;
}

.brand-name {
  font-size: 1.22rem;
}

.top-nav {
  display: flex;
  gap: 10px;
  align-items: center;
}

.top-nav a,
.top-nav .nav-button {
  padding: 10px 13px;
  color: var(--muted);
  background: transparent;
  border-radius: 6px;
  font-weight: 700;
  min-height: auto;
}

.top-nav a:hover,
.top-nav .nav-button:hover {
  color: var(--blue);
  background: #e8f1fb;
}

.hero-band {
  background:
    linear-gradient(120deg, rgba(16, 42, 67, 0.96), rgba(29, 95, 167, 0.92)),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 16px);
  color: white;
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.72fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: center;
  max-width: 1180px;
  min-height: 470px;
  margin: 0 auto;
  padding: clamp(56px, 8vw, 88px) 24px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-copy h1,
.admin-heading h1 {
  margin: 0;
  font-size: clamp(2.35rem, 6vw, 4.8rem);
  line-height: 1.02;
  letter-spacing: 0;
}

.intro,
.admin-heading p {
  max-width: 720px;
  margin: 22px 0 0;
  color: rgba(255, 255, 255, 0.8);
  font-size: clamp(1rem, 2vw, 1.2rem);
  line-height: 1.8;
}

.search-panel {
  padding: 30px;
  color: var(--ink);
  background: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.search-panel label {
  display: block;
  margin-bottom: 14px;
  color: var(--navy);
  font-size: 1.02rem;
  font-weight: 800;
}

.search-row {
  display: flex;
  gap: 10px;
}

.search-row input,
.field-grid input,
.field-grid textarea,
.auth-form input {
  width: 100%;
  min-width: 0;
  color: var(--ink);
  background: white;
  border: 1px solid #b9c6d6;
  border-radius: 6px;
  outline: none;
}

.search-row input {
  min-height: 56px;
  padding: 0 17px;
  font-size: 1.1rem;
}

.search-row input:focus,
.field-grid input:focus,
.field-grid textarea:focus,
.auth-form input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(29, 95, 167, 0.14);
}

button {
  min-height: 44px;
  padding: 0 18px;
  color: white;
  background: var(--blue);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 800;
}

button:hover {
  background: var(--blue-deep);
}

button:disabled {
  cursor: progress;
  opacity: 0.7;
}

.secondary-button {
  color: var(--blue);
  background: #e8f1fb;
}

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

.search-row button {
  min-width: 112px;
}

.hint {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.result-band {
  padding: clamp(34px, 5vw, 68px) 24px 76px;
}

.result-inner {
  max-width: 1180px;
  margin: 0 auto;
}

.status-message {
  color: var(--muted);
  background: white;
  border: 1px dashed #b9c6d6;
  border-radius: 8px;
  padding: 26px;
  text-align: center;
}

.status-message.error {
  color: var(--danger);
  border-color: #f1a7a0;
  background: #fff7f6;
}

.product-result {
  display: grid;
  gap: 24px;
}

.hidden {
  display: none !important;
}

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

.image-frame {
  margin: 0;
  overflow: hidden;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(16, 42, 67, 0.08);
}

.image-frame img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: contain;
  background: #edf2f7;
}

.image-frame figcaption {
  padding: 14px 16px;
  color: var(--navy);
  border-top: 1px solid var(--line);
  font-weight: 800;
}

.detail-strip {
  background: white;
  border-top: 4px solid var(--gold);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(16, 42, 67, 0.08);
}

.detail-strip dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
}

.detail-strip div {
  min-width: 0;
  padding: 22px;
  border-right: 1px solid var(--line);
}

.detail-strip div:last-child {
  border-right: 0;
}

dt {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

dd {
  margin: 8px 0 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 1.1rem;
  font-weight: 850;
}

.result-notes {
  margin: 0;
  padding: 0 22px 22px;
  color: var(--muted);
  line-height: 1.7;
}

.auth-main {
  display: grid;
  place-items: start center;
  min-height: calc(100vh - 72px);
  padding: clamp(44px, 8vw, 84px) 24px;
}

.auth-panel {
  width: min(100%, 470px);
  padding: 30px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(16, 42, 67, 0.08);
}

.auth-panel h1 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  line-height: 1.08;
}

.auth-copy {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.auth-form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.auth-form label {
  display: grid;
  gap: 8px;
  color: var(--navy);
  font-weight: 800;
}

.auth-form input {
  min-height: 52px;
  padding: 0 14px;
}

.auth-form input:read-only {
  color: var(--muted);
  background: #f3f6fa;
}

.auth-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.admin-main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 44px 24px 72px;
}

.admin-heading {
  padding-bottom: 28px;
}

.admin-heading h1 {
  color: var(--navy);
  font-size: clamp(2rem, 4vw, 3.4rem);
}

.admin-heading p {
  color: var(--muted);
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
  gap: 24px;
  align-items: start;
}

.admin-form,
.product-list-panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(16, 42, 67, 0.08);
}

.admin-form {
  padding: 24px;
}

.form-title-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 22px;
}

.form-title-row h2 {
  margin: 0 0 6px;
  color: var(--navy);
  font-size: 1.2rem;
}

.form-title-row p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.ghost-button {
  min-height: 38px;
  padding: 0 14px;
  color: var(--blue);
  background: #eef6ff;
  border: 1px solid #bdd8ff;
}

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

.field-grid label {
  display: grid;
  gap: 8px;
  color: var(--navy);
  font-weight: 800;
}

.field-grid label:last-child {
  grid-column: 1 / -1;
}

.field-grid input,
.field-grid textarea {
  padding: 12px 13px;
}

.field-grid input[readonly] {
  color: var(--muted);
  background: #f4f7fb;
}

.field-grid textarea {
  resize: vertical;
}

.upload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 22px;
}

.upload-box {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 16px;
  border: 1px dashed #aab7c7;
  border-radius: 8px;
  color: var(--navy);
  font-weight: 800;
}

.upload-box input {
  max-width: 100%;
  color: var(--muted);
}

.upload-box img {
  display: none;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: contain;
  background: #edf2f7;
  border-radius: 6px;
}

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

.admin-actions {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-top: 22px;
}

.secondary-link {
  color: var(--blue);
  font-weight: 800;
}

.form-status {
  min-height: 24px;
  margin: 14px 0 0;
  color: var(--green);
  font-weight: 700;
}

.form-status.error {
  color: var(--danger);
}

.product-list-panel {
  padding: 18px;
}

.panel-title-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.panel-title-row h2 {
  margin: 0;
  color: var(--navy);
  font-size: 1.18rem;
}

.panel-title-row button {
  min-height: 36px;
  padding: 0 12px;
}

.product-list {
  display: grid;
  gap: 12px;
}

.list-item {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.list-item.is-active {
  border-color: var(--blue);
  background: #f2f8ff;
}

.list-item img {
  width: 64px;
  height: 82px;
  object-fit: cover;
  border-radius: 6px;
  background: #edf2f7;
}

.list-item strong,
.list-item span {
  display: block;
  overflow-wrap: anywhere;
}

.list-item strong {
  margin-bottom: 4px;
}

.list-item span {
  color: var(--muted);
  font-size: 0.9rem;
}

.list-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.list-item-actions button,
.list-item-actions a {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  color: var(--blue);
  font-size: 0.85rem;
  font-weight: 800;
  background: #eef6ff;
  border: 1px solid #bdd8ff;
  border-radius: 6px;
}

.list-item-actions .danger-button {
  color: var(--danger);
  background: #fff4f3;
  border-color: #ffc9c3;
}

@media (max-width: 900px) {
  .hero-inner,
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .hero-inner {
    min-height: auto;
  }

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

  .detail-strip div:nth-child(2) {
    border-right: 0;
  }

  .detail-strip div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 640px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .top-nav {
    width: 100%;
  }

  .top-nav a,
  .top-nav .nav-button {
    flex: 1;
    text-align: center;
    background: #eef3f8;
  }

  .search-row,
  .admin-actions,
  .auth-actions,
  .form-title-row {
    flex-direction: column;
    align-items: stretch;
  }

  .search-row button {
    width: 100%;
  }

  .image-grid,
  .field-grid,
  .upload-grid,
  .detail-strip dl {
    grid-template-columns: 1fr;
  }

  .detail-strip div,
  .detail-strip div:nth-child(2) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .detail-strip div:last-child {
    border-bottom: 0;
  }
}
