:root {
  --blue: #0066cc;
  --blue-soft: #e8f2ff;
  --bg: #f4f6f8;
  --ink: #111827;
  --muted: #64748b;
  --line: #e5e7eb;
  --danger: #dc2626;
}

* {
  box-sizing: border-box;
}

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

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

button {
  background: var(--blue);
  border: 0;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  padding: 10px 14px;
}

button.light {
  background: #eef2f7;
  color: var(--ink);
}

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

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

.login-card,
.panel,
.metric-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.login-card {
  display: grid;
  gap: 14px;
  max-width: 420px;
  padding: 32px;
  width: 100%;
}

.login-card p {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  margin: 0;
}

h1,
h2,
h3,
p {
  margin: 0;
}

input,
select,
textarea {
  border: 1px solid #d7dde6;
  border-radius: 8px;
  color: var(--ink);
  padding: 10px 12px;
  width: 100%;
}

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

label {
  color: #334155;
  display: grid;
  font-size: 14px;
  gap: 7px;
  margin-bottom: 14px;
}

.dashboard {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 28px 20px;
}

.sidebar h1 {
  font-size: 25px;
  line-height: 1.25;
}

.sidebar p,
.topbar p,
.row span,
.help-text {
  color: var(--muted);
  line-height: 1.65;
  margin-top: 10px;
}

nav {
  display: grid;
  gap: 8px;
  margin-top: 28px;
}

.nav-item {
  background: transparent;
  color: #334155;
  font-weight: 700;
  justify-content: flex-start;
  text-align: left;
}

.nav-item.active {
  background: var(--blue-soft);
  color: var(--blue);
}

.logout {
  margin-top: 28px;
}

main {
  padding: 28px;
}

.topbar {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 18px;
}

.top-actions,
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.panel {
  margin-bottom: 18px;
  padding: 20px;
}

.narrow-panel {
  max-width: 780px;
}

.overview-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}

.metric-card {
  padding: 20px;
}

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

.metric-card strong {
  display: block;
  font-size: 30px;
  margin-top: 10px;
}

.metric-card p {
  color: var(--muted);
  line-height: 1.5;
  margin-top: 6px;
}

.inline {
  display: flex;
  gap: 8px;
}

.inline button {
  flex: 0 0 auto;
}

.category-list {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.pill {
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  padding: 10px;
}

.pill button {
  background: transparent;
  color: var(--danger);
  padding: 4px;
}

.product-tools {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(280px, 1fr) 240px;
}

.form-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
}

.form-head h4 {
  margin: 0;
}

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

.about-block {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

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

.form-grid .wide,
.form-grid button {
  grid-column: 1 / -1;
}

.list {
  max-width: 1080px;
}

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

.row img {
  background: #f8fafc;
  border-radius: 8px;
  height: 72px;
  object-fit: contain;
  width: 72px;
}

.row strong,
.row span {
  display: block;
}

.empty {
  color: var(--muted);
  padding: 30px 0;
  text-align: center;
}

.collection-map {
  display: grid;
  gap: 10px 16px;
  grid-template-columns: 140px 1fr;
}

.collection-map span {
  background: var(--blue-soft);
  border-radius: 8px;
  color: var(--blue);
  font-weight: 800;
  padding: 10px 12px;
}

.collection-map p {
  align-self: center;
  color: #334155;
  margin: 0;
}

.upload-input {
  background: #f8fafc;
  cursor: pointer;
}

.logs-output {
  background: #0f172a;
  border-radius: 8px;
  color: #e5e7eb;
  line-height: 1.7;
  min-height: 320px;
  overflow: auto;
  padding: 16px;
  white-space: pre-wrap;
}

small {
  color: var(--muted);
  line-height: 1.5;
}

@media (max-width: 1024px) {
  .dashboard {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-bottom: 1px solid var(--line);
    border-right: 0;
    gap: 20px;
  }

  nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

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

@media (max-width: 720px) {
  main,
  .sidebar {
    padding: 18px;
  }

  nav,
  .topbar,
  .product-tools,
  .form-grid,
  .row,
  .collection-map {
    display: grid;
    grid-template-columns: 1fr;
  }

  .topbar {
    gap: 14px;
  }

  .row {
    align-items: stretch;
  }
}
