:root {
  --blue: #1464c0;
  --blue-dark: #0d4893;
  --blue-soft: #eaf2ff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5eaf1;
  --bg: #f4f7fb;
  --white: #ffffff;
  --green: #16855c;
  --orange: #c56a00;
  --red: #c62828;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
}

.hidden { display: none !important; }

button, input, select { font: inherit; }

button, a.primary-btn {
  border: 0;
  border-radius: 8px;
  padding: 10px 18px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.primary-btn {
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  box-shadow: 0 6px 16px rgba(20, 100, 192, 0.2);
}

.primary-btn:hover { filter: brightness(1.05); }

.ghost-btn {
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
}

.ghost-btn:hover { border-color: var(--blue); color: var(--blue); }

.error-text { min-height: 20px; color: var(--red); font-size: 13px; margin-top: 10px; }

/* 登录 */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at top left, #dcecff, transparent 45%), #eef3f9;
}

.login-card {
  width: 380px;
  max-width: calc(100vw - 32px);
  padding: 38px;
  background: var(--white);
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(31, 41, 55, 0.12);
  text-align: center;
}

.login-logo, .brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  color: #fff;
  font-weight: 800;
  font-size: 24px;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
}

.login-card h1 { font-size: 22px; margin: 0 0 6px; }
.login-sub { color: var(--muted); margin: 0 0 24px; }
.login-card input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 12px;
  outline: none;
}
.login-card input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(20, 100, 192, 0.12); }
.login-card button { width: 100%; height: 44px; margin-top: 16px; font-weight: 600; }

/* 主布局 */
.topbar {
  height: 72px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
}

.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark { margin: 0; width: 42px; height: 42px; border-radius: 12px; font-size: 20px; }
.brand h1 { font-size: 18px; margin: 0; }
.brand p { font-size: 12px; color: var(--muted); margin: 4px 0 0; }

.main { max-width: 1480px; margin: 0 auto; padding: 24px 32px 48px; }

.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: 0 4px 18px rgba(31, 41, 55, 0.04);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}
.panel-head.compact { margin-bottom: 12px; }
.panel-head h2 { font-size: 17px; margin: 0 0 4px; }
.panel-head p { color: var(--muted); font-size: 13px; margin: 0; }

.filters {
  display: grid;
  grid-template-columns: 1.5fr 1.4fr 1fr 0.8fr;
  gap: 16px;
}
.filters label { display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--muted); }
.filters input, .filters select {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  outline: none;
  background: #fff;
  color: var(--text);
}
.filters input:focus, .filters select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(20,100,192,.1); }
.date-range { display: flex; align-items: center; gap: 8px; }
.date-range em { font-style: normal; color: var(--muted); }
.date-range input { flex: 1; min-width: 0; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; background: #f8fafc; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #f7faff; }
tbody tr.selected { background: var(--blue-soft); }
.empty { text-align: center; color: var(--muted); padding: 32px; cursor: default; }
.tag { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: 12px; background: #eef2f7; color: var(--muted); }
.tag.green { background: #e8f7f0; color: var(--green); }
.tag.orange { background: #fff3e3; color: var(--orange); }
.tag.red { background: #fdecec; color: var(--red); }
.tag.blue { background: var(--blue-soft); color: var(--blue); }

.pager { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 16px; font-size: 13px; color: var(--muted); }

/* 详情 */
.detail-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.meta-card { background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.meta-card span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 5px; }
.meta-card strong { font-size: 14px; word-break: break-all; }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.product-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #fff; }
.product-card .image-box {
  height: 150px;
  border-radius: 8px;
  background: #f4f7fb;
  display: grid;
  place-items: center;
  overflow: hidden;
  margin-bottom: 12px;
}
.product-card img { width: 100%; height: 100%; object-fit: contain; }
.no-image { color: #9aa3af; font-size: 13px; }
.product-card h3 { font-size: 14px; margin: 0 0 8px; }
.product-card p { margin: 3px 0; font-size: 12px; color: var(--muted); }
.product-card .price { color: var(--red); font-weight: 700; font-size: 15px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  background: #111827;
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 99;
  box-shadow: 0 10px 30px rgba(0,0,0,.2);
}

@media (max-width: 900px) {
  .filters { grid-template-columns: 1fr 1fr; }
  .topbar { padding: 0 18px; }
  .main { padding: 18px; }
}
