:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --line: #d9dee7;
  --text: #172033;
  --muted: #667085;
  --blue: #246bfe;
  --blue-soft: #eaf1ff;
  --green: #137a4b;
  --green-soft: #e7f6ee;
  --amber: #a15c00;
  --amber-soft: #fff3df;
  --red: #bd2b2b;
  --red-soft: #fff0f0;
  --shadow: 0 8px 28px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 8px;
  min-height: 36px;
  padding: 0 14px;
  cursor: pointer;
}

button:hover {
  border-color: #aeb8c8;
}

button.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}

.sidebar {
  background: #101828;
  color: white;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 4px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #ffffff;
  color: #101828;
  font-weight: 800;
}

.brand h1,
.topbar h2,
.side-section h2 {
  margin: 0;
  letter-spacing: 0;
}

.brand h1 {
  font-size: 17px;
}

.brand p,
.side-section p {
  margin: 2px 0 0;
  color: #cbd5e1;
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  border: 0;
  color: #d6deea;
  background: transparent;
}

.nav-item.active,
.nav-item:hover {
  background: #263247;
  color: white;
}

.side-section {
  padding: 14px;
  border: 1px solid #344054;
  border-radius: 8px;
}

.side-section h2 {
  font-size: 13px;
  margin-bottom: 8px;
}

.side-section a {
  color: #a8c7ff;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.app {
  min-width: 0;
  padding: 20px;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 16px;
}

.topbar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  box-shadow: var(--shadow);
}

.topbar h2 {
  font-size: 20px;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
}

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.metric-label {
  color: var(--muted);
  display: block;
  font-size: 12px;
}

.metric-value {
  display: block;
  margin-top: 4px;
  font-size: 22px;
}

.toolbar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(240px, 1.4fr) repeat(3, minmax(160px, 1fr));
  gap: 10px;
}

.toolbar label {
  display: grid;
  gap: 5px;
}

.toolbar span {
  color: var(--muted);
  font-size: 12px;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 36px;
  padding: 8px 10px;
  background: white;
  color: var(--text);
  width: 100%;
}

.content {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 16px;
}

.table-wrap,
.detail {
  min-height: 0;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f9fafb;
  color: #475467;
  font-size: 12px;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.active {
  background: #f8fbff;
}

.product-name {
  font-weight: 700;
  margin-bottom: 4px;
}

.meta {
  color: var(--muted);
  font-size: 12px;
  max-width: 360px;
  overflow-wrap: anywhere;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  margin: 0 4px 4px 0;
  background: #eef2f6;
  color: #334155;
  white-space: nowrap;
}

.pill.blue {
  background: var(--blue-soft);
  color: #1347b8;
}

.pill.green {
  background: var(--green-soft);
  color: var(--green);
}

.pill.amber {
  background: var(--amber-soft);
  color: var(--amber);
}

.pill.red {
  background: var(--red-soft);
  color: var(--red);
}

.image-cell {
  width: 64px;
  height: 64px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  background: #f8fafc;
}

.image-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail {
  padding: 14px;
}

.detail h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

.detail-grid {
  display: grid;
  gap: 10px;
}

.field {
  display: grid;
  gap: 4px;
}

.field label {
  font-size: 12px;
  color: var(--muted);
}

.detail textarea {
  min-height: 78px;
  resize: vertical;
}

.detail-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: #f8fafc;
  margin-bottom: 12px;
}

.detail-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.empty-detail {
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.row-actions {
  display: grid;
  gap: 6px;
}

.small-button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

@media (max-width: 1120px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

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

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

  .detail {
    min-height: 420px;
  }
}
