:root {
  color-scheme: light;
  --bg: #f3f6f7;
  --panel: #ffffff;
  --ink: #202a33;
  --muted: #66737f;
  --line: #d9e1e6;
  --nav: #080722;
  --nav-soft: #171634;
  --blue: #1174d8;
  --green: #1f8a70;
  --amber: #b56b18;
  --red: #c2413b;
  --cyan-soft: #e8f4ff;
  --green-soft: #e8f5ef;
  --amber-soft: #fff2df;
  --red-soft: #fae9e7;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
}

button,
input {
  font: inherit;
}

.sidebar {
  min-height: 100vh;
  padding: 18px;
  background: var(--nav);
  color: #eef5f8;
  position: sticky;
  top: 0;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-bottom: 20px;
  border-bottom: 1px solid #272747;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--blue);
  font-weight: 800;
}

.brand span,
.api-card span,
.api-card p {
  display: block;
  color: #aeb8c8;
  font-size: 12px;
  margin: 4px 0 0;
}

.side-nav {
  display: grid;
  gap: 6px;
  margin: 18px 0;
}

.nav-item {
  border: 0;
  border-radius: 8px;
  color: #d6dbe4;
  background: transparent;
  text-align: left;
  padding: 11px 12px;
  cursor: pointer;
}

.nav-item.active,
.nav-item:hover {
  background: var(--nav-soft);
  color: #ffffff;
}

.nav-item:focus-visible,
.icon-button:focus-visible,
.primary-button:focus-visible,
.search-box input:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.api-card {
  border: 1px solid #28294b;
  border-radius: 8px;
  padding: 14px;
  background: #10102c;
}

.api-card strong {
  display: block;
  margin-top: 6px;
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.topbar,
.panel-header,
.notice,
.actions,
.movement-item,
.module-item {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.eyebrow {
  color: var(--blue);
  font-weight: 700;
  margin: 0 0 6px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.18;
}

h2 {
  font-size: 18px;
}

.actions {
  gap: 10px;
}

.icon-button,
.primary-button {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}

.icon-button {
  width: 42px;
  font-size: 22px;
}

.primary-button {
  padding: 0 14px;
  background: var(--blue);
  border-color: var(--blue);
  color: white;
  font-weight: 700;
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.notice {
  justify-content: space-between;
  gap: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 14px;
}

.sync-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.sync-result.warning {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: #f1d2a9;
}

.sync-result.success {
  color: var(--green);
  background: var(--green-soft);
  border-color: #b9dfcd;
}

.sync-result span {
  color: var(--ink);
  font-size: 13px;
}

.notice span,
.panel-header p,
.module-item span,
.movement-item span,
.alert-item p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 5px;
}

.notice-status {
  font-weight: 700;
  text-align: right;
}

.ok-text {
  color: var(--green);
}

.warn-text {
  color: var(--amber);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

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

.kpi-card {
  padding: 15px;
}

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

.kpi-card strong {
  display: block;
  font-size: 25px;
  margin: 8px 0 5px;
}

.kpi-card em {
  font-style: normal;
  font-size: 13px;
}

.ok {
  color: var(--green);
}

.warn {
  color: var(--amber);
}

.bad {
  color: var(--red);
}

.info {
  color: var(--blue);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.65fr);
  gap: 14px;
}

.inventory-panel {
  grid-row: span 3;
}

.panel {
  overflow: hidden;
}

.panel-header {
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-header.compact {
  align-items: flex-start;
}

.search-box {
  display: grid;
  gap: 6px;
  min-width: 220px;
  color: var(--muted);
  font-size: 12px;
}

.search-box input {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1960px;
  font-size: 13px;
}

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

th {
  color: var(--muted);
  font-size: 12px;
  background: #f8fafb;
  position: sticky;
  top: 0;
  z-index: 1;
}

.sellable-head,
.sellable-number {
  color: #ff1f1f;
  font-weight: 800;
}

.check-cell,
.num-cell {
  text-align: center;
}

.sku-tag {
  display: inline-flex;
  align-items: center;
  max-width: 210px;
  min-height: 22px;
  border-radius: 4px;
  padding: 3px 7px;
  color: #ffffff;
  background: var(--blue);
  font-size: 12px;
  font-weight: 800;
  white-space: normal;
  word-break: break-word;
}

.sku-tag.danger {
  background: #ff1010;
}

.product-image,
.no-image {
  width: 92px;
  height: 72px;
  border-radius: 4px;
}

.product-image {
  object-fit: cover;
  border: 1px solid var(--line);
}

.no-image {
  display: grid;
  place-items: center;
  color: #b9b9b9;
  background: #f3f3f3;
  border: 1px solid #eeeeee;
  font-weight: 800;
  transform: rotate(-8deg);
}

.product-info {
  min-width: 280px;
  max-width: 360px;
  white-space: normal;
  line-height: 1.55;
}

.product-info p {
  margin: 0 0 2px;
}

.warehouse-cell {
  min-width: 130px;
  max-width: 170px;
  white-space: normal;
  line-height: 1.5;
}

.muted-cell {
  color: var(--muted);
}

.link-number {
  color: var(--blue);
  font-weight: 700;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  height: 26px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 700;
}

.badge.ok {
  background: var(--green-soft);
}

.badge.warn {
  background: var(--amber-soft);
}

.badge.bad {
  background: var(--red-soft);
}

.badge.info {
  background: var(--cyan-soft);
}

.alert-list,
.timeline,
.module-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.alert-item {
  border-left: 3px solid var(--amber);
  background: #fffaf2;
  border-radius: 8px;
  padding: 12px;
}

.alert-item.high {
  border-left-color: var(--red);
  background: #fff7f6;
}

.movement-item,
.module-item {
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.module-item.selected {
  border-color: var(--blue);
  background: var(--cyan-soft);
}

.movement-item time {
  color: var(--blue);
  font-weight: 800;
  min-width: 48px;
}

.movement-item div,
.module-item div {
  display: grid;
  flex: 1;
}

.movement-item b {
  font-size: 15px;
}

.plus {
  color: var(--green);
}

.minus {
  color: var(--red);
}

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

  .sidebar {
    position: static;
    min-height: auto;
  }

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

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

  .topbar,
  .notice,
  .sync-result,
  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .notice-status {
    text-align: left;
  }

  .search-box {
    width: 100%;
  }
}
