﻿:root {
  color-scheme: light dark;
  --bg: #edf1f6;
  --surface: #ffffff;
  --surface-soft: #f6f8fb;
  --ink: #18202a;
  --muted: #667281;
  --line: #dce3eb;
  --sidebar: #111b2b;
  --sidebar-muted: #93a4bb;
  --accent: #e63b48;
  --accent-soft: #fff0f1;
  --success: #138a59;
  --success-soft: #e9f8f1;
  --warning: #a56300;
  --warning-soft: #fff6df;
  --info: #2469c8;
  --info-soft: #edf5ff;
  --shadow: 0 18px 50px rgba(23, 38, 58, .12);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1118;
    --surface: #151b24;
    --surface-soft: #10161e;
    --ink: #edf3fa;
    --muted: #94a2b3;
    --line: #26303c;
    --sidebar: #080d14;
    --accent-soft: #35171b;
    --success: #49cf91;
    --success-soft: #123326;
    --warning: #f2b652;
    --warning-soft: #342811;
    --info: #78aeff;
    --info-soft: #14263e;
    --shadow: 0 18px 50px rgba(0, 0, 0, .38);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 20px 14px;
  background: var(--sidebar);
  color: #f6f9fc;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 7px; }
.brand-mark {
  display: grid; width: 36px; height: 36px; place-items: center;
  border-radius: 10px; background: var(--accent); color: #fff; font-weight: 700;
}
.brand strong, .brand span { display: block; }
.brand strong { font-size: 14px; }
.brand span { color: var(--sidebar-muted); font-size: 11px; }
.nav { display: grid; gap: 5px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; min-height: 40px;
  padding: 8px 10px; border: 0; border-radius: 9px;
  background: transparent; color: var(--sidebar-muted); text-align: left;
}
.nav-item:hover, .nav-item:focus-visible { background: rgba(255, 255, 255, .07); color: #fff; outline: none; }
.nav-item.active { background: rgba(230, 59, 72, .16); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav-item span { width: 18px; text-align: center; }
.store-card {
  margin-top: auto; padding: 12px; border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 12px; background: rgba(255, 255, 255, .04);
}
.store-card span, .store-card strong, .store-card small { display: block; }
.store-card span { color: var(--sidebar-muted); font-size: 11px; }
.store-card strong { margin-top: 3px; font-size: 13px; font-weight: 500; }
.store-card small { margin-top: 6px; color: var(--sidebar-muted); font-size: 10px; }

.main { min-width: 0; background: var(--bg); }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 72px; padding: 14px 22px; border-bottom: 1px solid var(--line); background: var(--surface);
}
.kicker { color: var(--muted); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
h1 { margin: 2px 0 0; font-size: 19px; letter-spacing: -.02em; }
h2, h3, p { margin-top: 0; }
h2 { margin-bottom: 4px; font-size: 15px; }
h3 { margin-bottom: 4px; font-size: 13px; }
.top-actions { display: flex; align-items: center; gap: 9px; }
.avatar {
  display: grid; width: 34px; height: 34px; place-items: center;
  border-radius: 50%; background: var(--sidebar); color: #fff; font-size: 12px; font-weight: 600;
}
.view-root { display: grid; gap: 16px; padding: 20px 22px 28px; }
.loading { padding: 60px; color: var(--muted); text-align: center; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metric, .panel, .table-card {
  min-width: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
}
.metric { padding: 15px 16px; }
.metric span, .metric strong, .metric small { display: block; }
.metric span { color: var(--muted); font-size: 12px; }
.metric strong { margin-top: 5px; font-size: 26px; letter-spacing: -.05em; }
.metric small { margin-top: 4px; color: var(--muted); font-size: 11px; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .85fr); gap: 16px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.panel-head p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
.panel-body { padding: 14px 16px; }

.button {
  min-height: 36px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface); color: var(--ink); font-size: 12px; font-weight: 500;
}
.button.primary { border-color: var(--accent); background: var(--accent); color: #fff; }
.button.danger { border-color: var(--warning); color: var(--warning); }
.button:hover { filter: brightness(.97); }
.button:disabled { cursor: not-allowed; opacity: .55; }
.status-chip, .badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface-soft);
  color: var(--muted); font-size: 11px; white-space: nowrap;
}
.status-chip.live, .badge.done, .badge.online { border-color: color-mix(in srgb, var(--success) 34%, transparent); background: var(--success-soft); color: var(--success); }
.status-chip.error, .badge.failed, .badge.offline { border-color: color-mix(in srgb, var(--accent) 34%, transparent); background: var(--accent-soft); color: var(--accent); }
.badge.wait { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.badge.info { background: var(--info-soft); color: var(--info); border-color: transparent; }

.table-wrap { overflow-x: auto; padding: 2px 8px 8px; }
table { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 12px; }
th, td { padding: 10px 9px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-weight: 500; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-soft); }
.empty { padding: 32px; color: var(--muted); text-align: center; }

.scan-box {
  display: grid; gap: 12px; padding: 14px; border: 1px dashed color-mix(in srgb, var(--accent) 55%, var(--line));
  border-radius: 12px; background: linear-gradient(135deg, var(--accent-soft), var(--surface-soft)); text-align: center;
}
.scan-box strong, .scan-box span { display: block; }
.scan-box span { margin-top: 4px; color: var(--muted); font-size: 11px; }
.form-row { display: grid; gap: 6px; }
.form-row label { color: var(--muted); font-size: 11px; }
.form-row input, .form-row select {
  width: 100%; min-height: 38px; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 9px; background: var(--surface-soft); color: var(--ink);
}
.result-list { display: grid; gap: 8px; margin-top: 12px; }
.result-row { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 7px; border-bottom: 1px solid var(--line); font-size: 11px; }
.result-row:last-child { padding-bottom: 0; border-bottom: 0; }
.result-row span:first-child { color: var(--muted); }
.result-row strong { max-width: 64%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.node-list { display: grid; }
.node-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); font-size: 12px; }
.node-row:last-child { border-bottom: 0; }
.node-row small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
.node-status { color: var(--success); font-size: 11px; }
.node-status.offline, .node-status.wait { color: var(--warning); }
.node-status.failed { color: var(--accent); }

.section-title { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.progress { height: 7px; overflow: hidden; border-radius: 999px; background: var(--surface-soft); }
.progress > span { display: block; height: 100%; background: var(--accent); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.inline-note { color: var(--muted); font-size: 11px; }
.toast {
  position: fixed; right: 22px; bottom: 22px; z-index: 20; max-width: 320px; padding: 11px 13px;
  border: 1px solid var(--success); border-radius: 10px; background: var(--surface); color: var(--success);
  box-shadow: var(--shadow); opacity: 0; transform: translateY(8px); transition: .18s ease; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: var(--accent); color: var(--accent); }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 76px minmax(0, 1fr); }
  .brand > div:last-child, .store-card, .nav-item:not(.active)::after { display: none; }
  .brand { padding: 0; }
  .nav-item { justify-content: center; }
  .nav-item span { width: auto; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .app-shell { display: block; }
  .sidebar { flex-direction: row; align-items: center; overflow-x: auto; padding: 10px; }
  .brand { flex: 0 0 auto; }
  .nav { display: flex; flex: 0 0 auto; }
  .nav-item { min-width: 44px; }
  .topbar { align-items: flex-start; flex-direction: column; padding: 14px; }
  .view-root { padding: 14px; }
  .metrics { grid-template-columns: 1fr 1fr; }
}

.finance-deduction { color: var(--warning); }


/* OMS dashboard theme */
.app-shell {
  grid-template-columns: 176px minmax(0, 1fr);
  background: #f0f2f5;
}

.sidebar {
  gap: 0;
  padding: 0;
  border-right: 1px solid #e5e8ee;
  background: #ffffff;
  color: #33363c;
}

.brand {
  height: 48px;
  padding: 0 16px;
  background: #07183e;
  color: #ffffff;
}

.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  background: #ffffff;
  color: #07183e;
  font-size: 14px;
}

.brand strong {
  font-size: 15px;
  font-weight: 600;
}

.brand span {
  color: rgba(255, 255, 255, .62);
  font-size: 10px;
}

.nav {
  gap: 0;
  padding: 8px 0;
}

.nav-item {
  min-height: 36px;
  padding: 0 18px;
  border-radius: 0;
  background: transparent;
  color: #0b1019;
  font-size: 12px;
}

.nav-item:hover,
.nav-item:focus-visible {
  background: #f5f7fa;
  color: #171b22;
}

.nav-item.active {
  background: #eef4ff;
  color: #1664d9;
  box-shadow: inset 3px 0 0 #1664d9;
}

.nav-item span {
  color: currentColor;
}

.store-card {
  margin: 0 10px 12px;
  border-color: #e5e8ee;
  background: #f7f9fc;
  color: #33363c;
}

.store-card span,
.store-card small {
  color: #7d8794;
}

.store-card strong {
  color: #1d2430;
}

.main {
  background: #f0f2f5;
}

.topbar {
  min-height: 48px;
  padding: 0 20px;
  border-bottom: 0;
  background: #07183d;
  color: rgba(255, 255, 255, .9);
}

.kicker {
  color: rgba(255, 255, 255, .56);
  font-size: 10px;
}

.topbar h1 {
  margin-top: 0;
  color: #ffffff;
  font-size: 16px;
  font-weight: 500;
}

.topbar .top-actions {
  color: rgba(255, 255, 255, .82);
}

.topbar .status-chip {
  border-color: rgba(255, 255, 255, .18);
  background: rgba(255, 255, 255, .08);
  color: rgba(255, 255, 255, .82);
}

.topbar .status-chip.live {
  border-color: rgba(73, 207, 145, .4);
  background: rgba(73, 207, 145, .12);
  color: #7ce8b2;
}

.topbar .button {
  border-color: rgba(255, 255, 255, .18);
  background: rgba(255, 255, 255, .09);
  color: #ffffff;
}

.topbar .avatar {
  background: #ffffff;
  color: #07183d;
}

.view-root {
  gap: 16px;
  padding: 20px;
  background: #f0f2f5;
}

.metric,
.panel,
.table-card {
  border: 0;
  border-radius: 4px;
  box-shadow: none;
}

.metric {
  padding: 16px 18px;
}

.panel-head {
  min-height: 57px;
  padding: 14px 18px;
  border-bottom: 1px solid #edf0f4;
}

.panel-head h2 {
  color: #1d2430;
  font-size: 14px;
}

.panel-head p {
  color: #8a94a3;
}

.dashboard-summary {
  display: grid;
  grid-template-columns: 1.05fr repeat(5, minmax(0, 1fr)) 1.35fr;
  gap: 1px;
  overflow: hidden;
  border-radius: 4px;
  background: #edf0f4;
}

.summary-card {
  min-width: 0;
  padding: 18px;
  background: #ffffff;
}

.summary-card span,
.summary-card strong,
.summary-card small {
  display: block;
}

.summary-card span {
  color: #7d8794;
  font-size: 12px;
}

.summary-card strong {
  margin-top: 6px;
  color: #202631;
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -.04em;
}

.summary-card small {
  margin-top: 4px;
  color: #9aa3af;
  font-size: 10px;
}

.summary-card.primary-summary strong {
  color: #1664d9;
}

.summary-card.fund-summary strong {
  color: #138a59;
  font-size: 18px;
}

.dashboard-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(300px, .72fr);
  gap: 16px;
  align-items: stretch;
}

.dashboard-chart {
  min-height: 390px;
}

.chart-head {
  align-items: center;
}

.chart-tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  border-radius: 4px;
  background: #f3f5f8;
}

.chart-tab {
  min-width: 52px;
  min-height: 28px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #6f7987;
  font-size: 11px;
}

.chart-tab.active {
  background: #ffffff;
  color: #1664d9;
  box-shadow: 0 1px 4px rgba(21, 37, 68, .1);
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  padding: 14px 20px 4px;
  color: #6f7987;
  font-size: 11px;
}

.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
}

.legend-dot.order { background: #1664d9; }
.legend-dot.ship { background: #42b883; }
.legend-dot.print { background: #f0a833; }

.chart-area {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  height: 270px;
  padding: 12px 20px 20px 8px;
}

.chart-y-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2px 6px 22px 0;
  color: #9aa3af;
  font-size: 10px;
  text-align: right;
}

.chart-bars {
  display: grid;
  grid-template-columns: repeat(12, minmax(18px, 1fr));
  align-items: end;
  gap: 12px;
  padding: 0 4px;
  border-bottom: 1px solid #e9edf2;
  background: repeating-linear-gradient(to bottom, #f4f6f9 0, #f4f6f9 1px, transparent 1px, transparent 25%);
}

.chart-column {
  display: grid;
  grid-template-rows: minmax(0, 1fr) 20px;
  align-items: end;
  height: 100%;
  min-width: 0;
}

.chart-bar {
  width: 60%;
  min-width: 7px;
  max-width: 22px;
  min-height: 4px;
  margin: 0 auto;
  border-radius: 2px 2px 0 0;
  background: linear-gradient(180deg, #4f8df0, #1664d9);
  transition: height .25s ease;
}

.chart-column span {
  overflow: hidden;
  color: #9aa3af;
  font-size: 9px;
  text-align: center;
  white-space: nowrap;
}

.dashboard-bottom {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.dashboard-small-card {
  min-height: 280px;
}

.notice-empty {
  display: grid;
  min-height: 220px;
  place-items: center;
}

.stock-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 16px 18px 8px;
}

.stock-summary > div,
.asset-lines > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 4px;
  background: #f7f9fc;
  font-size: 12px;
}

.stock-summary span,
.asset-lines span {
  color: #7d8794;
}

.stock-bars {
  display: grid;
  gap: 12px;
  padding: 10px 18px 18px;
}

.stock-bar {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 10px;
  font-size: 11px;
}

.stock-bar span {
  overflow: hidden;
  color: #515b68;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-bar > div {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #eef1f5;
}

.stock-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: #1664d9;
}

.asset-main {
  padding: 26px 18px 18px;
  text-align: center;
}

.asset-main span,
.asset-main strong,
.asset-main small {
  display: block;
}

.asset-main span {
  color: #8a94a3;
  font-size: 11px;
}

.asset-main strong {
  margin-top: 5px;
  color: #138a59;
  font-size: 34px;
  font-weight: 500;
  letter-spacing: -.05em;
}

.asset-main small {
  margin-top: 5px;
  color: #9aa3af;
}

.asset-lines {
  display: grid;
  gap: 8px;
  padding: 0 18px 18px;
}

.analytics-number {
  display: block;
  color: #1664d9;
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -.04em;
}

@media (max-width: 1180px) {
  .dashboard-summary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .dashboard-main-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .dashboard-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-bottom {
    grid-template-columns: 1fr;
  }

  .chart-bars {
    gap: 5px;
  }

  .chart-column span {
    display: none;
  }
}

@media (max-width: 620px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid #e5e8ee;
  }

  .topbar {
    min-height: 64px;
    padding: 10px 14px;
  }
}
