:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #d9dee8;
  --primary: #176b87;
  --primary-strong: #10546b;
  --danger: #7a2e2a;
  --success-bg: #e8f7ee;
  --success-text: #166534;
  --error-bg: #fff1f0;
  --error-text: #b42318;
  --shadow: 0 16px 40px rgba(30, 41, 59, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, "Microsoft YaHei", sans-serif;
  line-height: 1.55;
}

a {
  color: var(--primary);
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  white-space: nowrap;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  font-size: 14px;
}

.container {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 22px 16px 48px;
}

.narrow {
  width: min(720px, 100%);
}

.page-title,
.admin-head {
  margin: 0 0 18px;
}

.announcement {
  display: grid;
  gap: 6px;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid #b9d7e3;
  border-radius: 8px;
  background: #eef8fb;
  color: #18465a;
}

.announcement p {
  margin: 0;
}

.announcement small {
  color: #476779;
}

.page-title h1,
.admin-head h1,
.panel h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
}

.page-title p,
.admin-head p,
.muted {
  margin: 8px 0 0;
  color: var(--muted);
}

.product-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

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

.product-card {
  overflow: hidden;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 46px rgba(30, 41, 59, 0.12);
}

.product-media {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 8px 8px 0 0;
  background: #e9edf3;
}

.product-media img,
.detail-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-body {
  padding: 14px;
}

.product-body h2,
.panel h2 {
  margin: 0;
  font-size: 19px;
  line-height: 1.3;
}

.product-body h2 a {
  color: var(--text);
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.price {
  color: #b54708;
  font-size: 20px;
}

.price.big {
  margin: 12px 0;
  font-size: 30px;
}

.stock,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #edf2f7;
  color: #344054;
  font-size: 13px;
}

.badge.accent {
  background: #e8f7ee;
  color: #166534;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  text-align: center;
}

.button-primary {
  background: var(--primary);
  color: #fff;
}

.button-primary:hover {
  background: var(--primary-strong);
}

.button-secondary {
  background: #fff;
  border-color: var(--line);
  color: var(--text);
}

.button-danger {
  background: var(--danger);
  color: #fff;
}

.compact {
  min-height: 36px;
  padding: 7px 12px;
}

.full {
  width: 100%;
  margin-top: 12px;
}

.detail-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.detail-media {
  min-height: 220px;
  overflow: hidden;
  background: #e9edf3;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.detail-info {
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.description {
  white-space: pre-wrap;
}

.content-block {
  margin-top: 18px;
}

.content-block h2 {
  margin: 0 0 8px;
  font-size: 17px;
}

.content-block p {
  margin: 0;
  color: #344054;
  white-space: pre-wrap;
}

.panel {
  padding: 18px;
}

.form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: #344054;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid #c9d2df;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.captcha-row {
  display: grid;
  grid-template-columns: 1fr 150px;
  gap: 10px;
  align-items: center;
}

.captcha-row img {
  width: 150px;
  height: 56px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.notice {
  padding: 10px 12px;
  border: 1px solid #f1c27d;
  border-radius: 8px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 14px;
}

.product-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
  color: var(--muted);
  font-size: 14px;
}

.product-stats span {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.product-stats strong {
  color: var(--text);
}

.qr-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin: 16px 0;
}

.qr-box {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.qr-box img,
.preview-box img {
  width: min(260px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.preview-box {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.flash-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.flash {
  padding: 11px 13px;
  border-radius: 8px;
  font-weight: 700;
}

.flash-success {
  background: var(--success-bg);
  color: var(--success-text);
}

.flash-error {
  background: var(--error-bg);
  color: var(--error-text);
}

.empty {
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  text-align: center;
}

.image-placeholder {
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 180px;
  place-items: center;
  color: #516173;
  font-weight: 800;
  background:
    linear-gradient(135deg, rgba(23, 107, 135, 0.12), rgba(178, 112, 25, 0.12)),
    #eef2f7;
}

.image-placeholder.large {
  min-height: 260px;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px 16px;
}

.auth-card {
  width: min(420px, 100%);
}

.admin-head {
  display: grid;
  gap: 12px;
}

.admin-actions,
.action-row,
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.inline-panel {
  margin: 18px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.stat {
  padding: 14px;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.stat strong {
  display: block;
  margin-top: 4px;
  font-size: 28px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: #475467;
  font-size: 13px;
}

code,
.secret-box {
  font-family: Consolas, "Courier New", monospace;
}

.secret-box {
  overflow-x: auto;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  white-space: pre-wrap;
}

.detail-list {
  display: grid;
  gap: 0;
  margin: 14px 0;
}

.detail-list div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.detail-list dt {
  color: var(--muted);
}

.detail-list dd {
  margin: 0;
  word-break: break-word;
}

.stack {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.split-layout {
  display: grid;
  gap: 16px;
}

.inline-form {
  display: inline;
  margin: 0;
}

.link-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
}

.danger {
  color: var(--danger);
}

.table-actions {
  white-space: nowrap;
}

.selection-cell {
  width: 42px;
  text-align: center;
}

.selection-cell input {
  width: auto;
  min-height: 0;
}

.list-actions {
  margin: 14px 0;
}

.danger-zone {
  margin-top: 16px;
  border-color: #efb4ae;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-footer {
  padding: 26px 16px 34px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

@media (min-width: 720px) {
  .site-header {
    padding: 16px 28px;
  }

  .container {
    padding: 32px 24px 64px;
  }

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

  .detail-layout {
    grid-template-columns: 1.05fr 0.95fr;
    align-items: start;
  }

  .admin-head {
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }

  .split-layout {
    grid-template-columns: 360px 1fr;
    align-items: start;
  }

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

@media (max-width: 520px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav {
    width: 100%;
    justify-content: space-between;
  }

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

  .detail-list div {
    grid-template-columns: 1fr;
    gap: 3px;
  }
}
