:root {
  color-scheme: light;
  --ink: #18212f;
  --muted: #637083;
  --line: #d9e0e7;
  --soft: #f4f7f9;
  --paper: #ffffff;
  --brand: #0f766e;
  --brand-2: #b42318;
  --accent: #d97706;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: #eef3f6;
}

button,
input,
select {
  font: inherit;
}

button {
  white-space: nowrap;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 16px clamp(16px, 4vw, 48px);
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
}

.brand {
  font-size: 22px;
  font-weight: 700;
}

.subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.tabs,
.metric-tabs,
.account-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.top-language {
  display: flex;
  grid-auto-flow: column;
  grid-template-columns: auto auto;
  gap: 8px;
  align-items: center;
}

.top-language select {
  min-height: 36px;
}

.tab,
.metric,
.primary,
.close {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: 6px;
  padding: 9px 14px;
  cursor: pointer;
}

.tab.active,
.metric.active,
.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

main {
  padding: 22px clamp(16px, 4vw, 48px) 48px;
}

.hero {
  min-height: 0;
  padding: 16px;
  background:
    linear-gradient(rgba(14, 29, 39, 0.76), rgba(14, 29, 39, 0.76)),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.16) 0 2px, transparent 2px 22px),
    linear-gradient(120deg, #0f766e, #1f4e79 58%, #a63d40);
  color: #fff;
  margin-bottom: 22px;
}

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

.video-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
}

.video-card video,
.video-placeholder {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: 230px;
  object-fit: cover;
  background: #111827;
}

.video-placeholder {
  display: grid;
  place-items: center;
}

.video-placeholder span {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  font-size: 24px;
  font-weight: 700;
}

.video-card h3,
.video-card p {
  margin: 0;
}

.video-card div:last-child {
  padding: 10px;
}

.video-card h3 {
  font-size: 15px;
}

.video-card p {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  line-height: 1.45;
}

.view {
  display: none;
}

.active-view {
  display: block;
}

.toolbar,
.panel,
.quotation {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px 160px 130px;
  gap: 14px;
  padding: 16px;
  margin-bottom: 16px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

input,
select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.product-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  display: grid;
}

.product-media,
.detail-media {
  min-height: 170px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  background: linear-gradient(135deg, #116466, #d9a441);
}

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

.product-card:nth-child(2n) .product-media,
.detail-media.alt {
  background: linear-gradient(135deg, #1f4e79, #a63d40);
}

.product-card article {
  padding: 14px;
  min-width: 0;
}

.product-card h3,
.panel h2,
.quotation h2 {
  margin: 0 0 10px;
}

.meta {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  min-width: 0;
  overflow-x: auto;
}

.meta-line {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta-price {
  white-space: nowrap;
}

.card-actions {
  display: flex;
  gap: 8px;
  padding: 0 14px 14px;
  flex-wrap: wrap;
  align-items: center;
}

.card-actions button {
  min-width: 62px;
  flex: 0 0 auto;
}

.price-hidden {
  color: var(--brand-2);
  font-weight: 700;
}

.split,
.admin-layout {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  gap: 18px;
}

.admin-layout {
  grid-template-columns: repeat(2, minmax(280px, 1fr));
}

.panel,
.quotation {
  padding: 18px;
}

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

.compact-form .primary {
  grid-column: 1 / -1;
}

.field-group,
.tier-editor {
  grid-column: 1 / -1;
}

.field-group {
  display: grid;
  grid-template-columns: 90px repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: center;
}

.field-group span {
  color: var(--muted);
  font-size: 13px;
}

.tier-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 8px;
}

.tier-header h3 {
  margin: 0;
}

.tier-editor table {
  width: 100%;
  border-collapse: collapse;
}

.tier-editor th,
.tier-editor td {
  border: 1px solid var(--line);
  padding: 8px;
}

.tier-editor input {
  width: 100%;
}

.upload-box {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px dashed #9aa4af;
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
}

.upload-box.drag-over {
  border-color: var(--brand);
  background: #e8f5f3;
}

.upload-box img,
.upload-box video {
  display: none;
  width: min(100%, 320px);
  max-height: 220px;
  object-fit: contain;
  border-radius: 6px;
  background: #111827;
}

.upload-box.has-media img,
.upload-box.has-media video {
  display: block;
}

.upload-box.has-media img[hidden],
.upload-box.has-media video[hidden] {
  display: none;
}

.tier-actions {
  width: 92px;
}

.quotation table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  background: #fff;
}

.quotation th,
.quotation td {
  border: 1px solid #9aa4af;
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

.quote-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.ranking {
  margin: 16px 0 0;
  padding-left: 24px;
}

.ranking li {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.notice {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.6;
}

.admin-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.admin-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.admin-row video,
.admin-row img {
  width: 120px;
  height: 76px;
  object-fit: cover;
  border-radius: 6px;
  background: #111827;
}

.admin-row label {
  display: flex;
  grid-auto-flow: column;
  gap: 6px;
  align-items: center;
}

.auth-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 16px;
  padding: 18px;
}

dialog {
  width: min(780px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.38);
}

.close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 38px;
  height: 38px;
  padding: 0;
  font-size: 24px;
}

.detail {
  display: grid;
  grid-template-columns: 280px 1fr;
}

.detail-copy {
  padding: 22px;
}

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

.stats-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 14px;
}

.stats-table th,
.stats-table td {
  border: 1px solid var(--line);
  padding: 8px;
  text-align: left;
}

@media (max-width: 820px) {
  .topbar,
  .hero,
  .split,
  .admin-layout,
  .detail,
  .auth-layout {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: start;
  }

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

  .video-showcase {
    grid-template-columns: 1fr;
  }

  .compact-form {
    grid-template-columns: 1fr;
  }

  .field-group {
    grid-template-columns: 1fr;
  }
}
