:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --line: #d8dde5;
  --text: #172033;
  --muted: #697386;
  --accent: #175cd3;
  --red-bg: #fde7e7;
  --red-text: #9f1239;
  --yellow-bg: #fff3c4;
  --yellow-text: #854d0e;
  --green-bg: #dcfce7;
  --green-text: #166534;
  --info-bg: #e8f1ff;
  --info-text: #174ea6;
}

* {
  box-sizing: border-box;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 24px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

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

nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

nav a,
.pagination a,
button {
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--line);
  background: #ffffff;
  padding: 7px 10px;
  border-radius: 6px;
  font: inherit;
}

nav a.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.page {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px;
}

.section {
  margin-bottom: 22px;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

h1,
h2 {
  margin: 0;
  font-size: 20px;
}

h2 {
  font-size: 16px;
}

.section-title span,
.subtle,
.muted {
  color: var(--muted);
}

.notice {
  background: var(--info-bg);
  color: var(--info-text);
  border: 1px solid #bfdbfe;
  padding: 12px 14px;
  border-radius: 6px;
  margin-bottom: 14px;
  line-height: 1.6;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.cards.compact {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

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

.metric span {
  display: block;
  color: var(--muted);
  margin-bottom: 9px;
}

.metric strong {
  font-size: 20px;
  word-break: break-word;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.table-wrap.wide table {
  min-width: 1500px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
}

th,
td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  white-space: nowrap;
}

th {
  color: #344054;
  background: #f9fafb;
  font-weight: 650;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  margin-right: 4px;
}

.risk-red {
  background: var(--red-bg);
  color: var(--red-text);
}

.risk-yellow {
  background: var(--yellow-bg);
  color: var(--yellow-text);
}

.risk-green {
  background: var(--green-bg);
  color: var(--green-text);
}

.risk-muted {
  background: #eef2f6;
  color: #475467;
}

.risk-overstock {
  background: #e0f2fe;
  color: #075985;
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  align-items: end;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 9px;
  font: inherit;
  color: var(--text);
  background: #ffffff;
}

button {
  cursor: pointer;
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}

.pagination {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.auth-panel {
  max-width: 520px;
  margin: 72px auto 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  line-height: 1.7;
}

.primary-link {
  display: inline-flex;
  align-items: center;
  color: #ffffff;
  background: var(--accent);
  text-decoration: none;
  border-radius: 6px;
  padding: 9px 13px;
  margin-top: 8px;
}

@media (max-width: 720px) {
  .topbar,
  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .page {
    padding: 16px;
  }
}
