:root {
  color-scheme: light;
  --ink: #20252b;
  --muted: #68727d;
  --line: #dbe1e5;
  --panel: #ffffff;
  --canvas: #f3f6f6;
  --accent: #0c7667;
  --accent-dark: #07564c;
  --danger: #b33b31;
  --radius: 6px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 14px/1.55 "Microsoft YaHei UI", "Segoe UI", sans-serif;
}
h1, h2, p { margin: 0; }
h1 { font-size: 24px; letter-spacing: 0; }
h2 { font-size: 19px; }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--accent);
  font: 700 18px/1 "Segoe UI", sans-serif;
}
.brand-mark.small { width: 30px; height: 30px; border-radius: 6px; font-size: 12px; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-panel {
  width: min(420px, 100%);
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
.login-heading { margin: 20px 0 26px; }
.login-heading h1 { margin-bottom: 6px; }
.login-heading p, .muted { color: var(--muted); }
.stack { display: grid; gap: 16px; }
label { display: grid; gap: 6px; }
label span { font-weight: 600; }
input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 11px;
  background: #fff;
  color: var(--ink);
}
input:focus { outline: 2px solid rgba(12, 118, 103, .22); border-color: var(--accent); }
.primary-button, .secondary-button, .danger-button {
  min-height: 38px;
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-weight: 650;
}
.primary-button { background: var(--accent); color: #fff; }
.primary-button:hover { background: var(--accent-dark); }
.secondary-button { background: #fff; color: var(--ink); border-color: var(--line); }
.danger-button { background: #fff; color: var(--danger); border-color: #e4bbb7; }
.text-button, .icon-button { background: transparent; border: 0; color: var(--muted); padding: 4px 8px; }
.form-error { color: var(--danger); font-size: 13px; }

.topbar {
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.topbar-brand, .topbar-account { display: flex; align-items: center; gap: 12px; font-weight: 650; }
.topbar-account { color: var(--muted); font-weight: 500; }

.workspace { min-height: calc(100vh - 62px); display: grid; grid-template-columns: 220px minmax(0, 1fr); }
.section-rail { padding: 20px 14px; border-right: 1px solid var(--line); background: #f8fafa; }
#nav { display: grid; gap: 4px; }
.nav-item {
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  text-align: left;
}
.nav-item:hover { background: #e9f0ef; color: var(--ink); }
.nav-item.active { background: #dcecea; color: var(--accent-dark); font-weight: 700; }
.rail-note {
  margin-top: 28px;
  padding: 14px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}
.rail-note strong { color: var(--ink); }

.content { min-width: 0; padding: 28px 32px 48px; }
.view { max-width: 1280px; margin: 0 auto; }
.view-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 24px; }
.eyebrow { color: var(--accent); font-size: 12px; font-weight: 750; letter-spacing: .04em; margin-bottom: 4px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat {
  min-height: 112px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
.stat span { color: var(--muted); font-size: 12px; }
.stat strong { display: block; margin-top: 14px; font-size: 27px; line-height: 1; }
.info-band {
  margin-top: 18px;
  padding: 18px;
  border-left: 3px solid var(--accent);
  background: #eaf2f0;
}
.info-band .label { color: var(--accent-dark); font-weight: 700; }
.info-band p { margin-top: 7px; color: var(--muted); }

.product-list { display: grid; gap: 14px; }
.product-card {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
.cover { width: 120px; aspect-ratio: 1; border-radius: 6px; object-fit: cover; background: #e5ebeb; }
.product-body { min-width: 0; }
.product-title { display: flex; align-items: start; justify-content: space-between; gap: 14px; }
.product-title h3 { margin: 0; font-size: 17px; }
.product-meta { margin-top: 5px; color: var(--muted); font-size: 12px; word-break: break-word; }
.version-list { margin-top: 14px; display: grid; gap: 8px; }
.version-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-top: 1px solid var(--line);
}
.version-row:first-child { border-top: 0; }
.version-id { min-width: 0; flex: 1; }
.version-id strong { display: block; }
.version-id small { color: var(--muted); }
.price-input { width: 100px; min-height: 34px; }
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #eef2f2;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.badge.active { background: #dcefe9; color: var(--accent-dark); }
.badge.retired, .badge.delisted { background: #f6e8e6; color: var(--danger); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { padding: 11px 13px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 12px; font-weight: 650; background: #f8fafa; }
td { font-size: 13px; }
tr:last-child td { border-bottom: 0; }

dialog { border: 0; padding: 0; background: transparent; }
dialog::backdrop { background: rgba(20, 27, 30, .48); }
.dialog-card {
  width: min(540px, calc(100vw - 32px));
  padding: 24px;
  border-radius: 8px;
  background: var(--panel);
}
.dialog-heading { display: flex; align-items: center; justify-content: space-between; }
.dialog-actions { display: flex; justify-content: end; gap: 8px; }
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 420px;
  padding: 11px 14px;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  box-shadow: 0 8px 28px rgba(15, 24, 28, .18);
}
.toast.error { background: var(--danger); }

@media (max-width: 760px) {
  .workspace { grid-template-columns: 1fr; }
  .section-rail { border-right: 0; border-bottom: 1px solid var(--line); }
  #nav { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .nav-item { text-align: center; padding-inline: 4px; }
  .rail-note { display: none; }
  .content { padding: 20px 16px 36px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product-card { grid-template-columns: 1fr; }
  .cover { width: 100%; aspect-ratio: 16 / 7; }
  .version-row { flex-wrap: wrap; }
}
