:root {
  /* 星栈智造 · 工业工作台语义 Token */
  --floor-canvas: #f5f7fa;
  --bench-surface: #ffffff;
  --inset-control: #f2f4f8;
  --steel-ink: #182230;
  --graphite-sub: #475467;
  --slate-meta: #667085;
  --muted-line: rgba(24, 34, 48, 0.09);
  --soft-line: rgba(24, 34, 48, 0.05);

  --cobalt-act: #165dff;
  --cobalt-hover: #0e42d2;
  --cobalt-tint: #eef4ff;

  --pass-green: #009a44;
  --pass-tint: #ecfdf3;
  --warn-amber: #dc6803;
  --warn-tint: #fffaeb;
  --alert-red: #d92d20;
  --alert-tint: #fef3f2;

  /* 车间暗色大屏 Token */
  --screen-bg: #0b1220;
  --screen-card: #121c30;
  --screen-line: rgba(255, 255, 255, 0.09);

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --shadow-card: 0 0 0 1px rgba(24, 34, 48, 0.06), 0 1px 2px -1px rgba(24, 34, 48, 0.05), 0 3px 8px rgba(24, 34, 48, 0.03);
  --shadow-float: 0 18px 44px rgba(11, 18, 32, 0.18), 0 0 0 1px rgba(24, 34, 48, 0.06);

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --font-sans: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--steel-ink);
  background: var(--floor-canvas);
  -webkit-font-smoothing: antialiased;
}

button, input, select { font-family: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* ==================== App Shell ==================== */
.app-shell {
  display: grid;
  grid-template-columns: 224px 1fr;
  min-height: 100vh;
}

/* 同底色静谧侧边栏（避免割裂感） */
.sidebar {
  background: var(--bench-surface);
  border-right: 1px solid var(--muted-line);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: sticky;
  top: 0;
  height: 100vh;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 16px;
  border-bottom: 1px solid var(--soft-line);
  margin-bottom: 14px;
}

.brand-cube {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--cobalt-act);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
}

.brand-title {
  font-size: 15.5px;
  font-weight: 800;
  line-height: 1.2;
}

.brand-tag {
  font-size: 11px;
  color: var(--slate-meta);
}

.nav-group-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--slate-meta);
  letter-spacing: 0.6px;
  padding: 8px 10px 6px;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-btn {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--graphite-sub);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  font-weight: 600;
  transition: background-color 0.15s var(--ease-out), color 0.15s var(--ease-out);
}

.nav-btn-left {
  display: flex;
  align-items: center;
  gap: 9px;
}

.nav-btn:hover {
  background: var(--inset-control);
  color: var(--steel-ink);
}

.nav-btn.active {
  background: var(--cobalt-tint);
  color: var(--cobalt-act);
}

.nav-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 99px;
  font-variant-numeric: tabular-nums;
}
.nav-badge.red { background: var(--alert-tint); color: var(--alert-red); }
.nav-badge.blue { background: var(--cobalt-tint); color: var(--cobalt-act); }

.side-foot {
  border-top: 1px solid var(--soft-line);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.side-demo-card {
  background: var(--floor-canvas);
  border: 1px solid var(--muted-line);
  border-radius: var(--radius-sm);
  padding: 10px;
  font-size: 12px;
  color: var(--graphite-sub);
}

.side-demo-card strong {
  display: block;
  color: var(--steel-ink);
  margin-bottom: 3px;
}

/* ==================== Main Area & Topbar ==================== */
.main-area {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: 60px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--muted-line);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 60;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-title {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.live-dot-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 99px;
  background: var(--pass-tint);
  color: var(--pass-green);
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--pass-green);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: transform 0.12s var(--ease-out), background-color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--cobalt-act);
  color: #fff;
}
.btn-primary:hover { background: var(--cobalt-hover); }

.btn-dark {
  background: #121c30;
  color: #fff;
}
.btn-dark:hover { background: #1e2d4d; }

.btn-soft {
  background: var(--cobalt-tint);
  color: var(--cobalt-act);
}
.btn-soft:hover { background: #dce8ff; }

.btn-outline {
  background: #fff;
  color: var(--steel-ink);
  border-color: var(--muted-line);
}
.btn-outline:hover { border-color: var(--cobalt-act); color: var(--cobalt-act); }

.btn-sm {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

/* Workspace Body */
.workspace {
  padding: 20px 24px 36px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 1440px;
  width: 100%;
}

/* Demo Guided Banner */
.demo-guide {
  background: linear-gradient(90deg, #eef4ff 0%, #f5f9ff 100%);
  border: 1px solid #d4e3ff;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.demo-guide-text {
  font-size: 13px;
  color: var(--graphite-sub);
}
.demo-guide-text strong { color: var(--cobalt-act); }

/* ==================== Cards & KPIs ==================== */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.kpi-card {
  background: var(--bench-surface);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
}

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--slate-meta);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--steel-ink);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  margin: 6px 0 4px;
  letter-spacing: -0.02em;
}

.kpi-value.blue { color: var(--cobalt-act); }
.kpi-value.green { color: var(--pass-green); }
.kpi-value.amber { color: var(--warn-amber); }
.kpi-value.red { color: var(--alert-red); }

.kpi-meta {
  font-size: 12px;
  color: var(--slate-meta);
}

.panel-card {
  background: var(--bench-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.panel-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--soft-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.panel-title {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
}

.panel-sub {
  font-size: 12px;
  color: var(--slate-meta);
}

.panel-body {
  padding: 16px 18px;
}

.grid-2-asym {
  display: grid;
  grid-template-columns: 1.45fr 0.85fr;
  gap: 16px;
  align-items: start;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

/* ==================== Tables & Controls ==================== */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 18px;
  border-bottom: 1px solid var(--soft-line);
}

.filter-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-pill {
  border: 1px solid var(--muted-line);
  background: #fff;
  color: var(--graphite-sub);
  border-radius: 6px;
  padding: 5px 11px;
  font-size: 12.5px;
  font-weight: 600;
}

.filter-pill.active {
  background: var(--steel-ink);
  border-color: var(--steel-ink);
  color: #fff;
}

.input-ctrl {
  height: 34px;
  border: 1px solid var(--muted-line);
  background: var(--inset-control);
  border-radius: var(--radius-xs);
  padding: 0 11px;
  font-size: 13px;
  color: var(--steel-ink);
  outline: none;
  transition: border-color 0.15s, background-color 0.15s;
}

.input-ctrl:focus {
  background: #fff;
  border-color: var(--cobalt-act);
  box-shadow: 0 0 0 3px rgba(22, 93, 255, 0.12);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.data-table th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--slate-meta);
  background: #fafbfd;
  padding: 10px 14px;
  border-bottom: 1px solid var(--muted-line);
  white-space: nowrap;
}

table.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--soft-line);
  vertical-align: middle;
}

table.data-table tbody tr:hover {
  background: #f9fbff;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}

.tag-blue { background: var(--cobalt-tint); color: var(--cobalt-act); }
.tag-green { background: var(--pass-tint); color: var(--pass-green); }
.tag-amber { background: var(--warn-tint); color: var(--warn-amber); }
.tag-red { background: var(--alert-tint); color: var(--alert-red); }
.tag-gray { background: var(--inset-control); color: var(--graphite-sub); }

/* Routing Pipeline Chips inside Work Order Rows */
.route-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.route-chip {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--inset-control);
  color: var(--graphite-sub);
  font-variant-numeric: tabular-nums;
}
.route-chip.done { background: var(--pass-tint); color: var(--pass-green); font-weight: 600; }
.route-chip.active { background: var(--cobalt-tint); color: var(--cobalt-act); font-weight: 700; }

.prog-wrap {
  min-width: 105px;
}
.prog-head {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 700;
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}
.prog-bar {
  height: 6px;
  background: #e9edf4;
  border-radius: 99px;
  overflow: hidden;
}
.prog-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--cobalt-act);
  transition: width 0.25s var(--ease-out);
}
.prog-fill.done { background: var(--pass-green); }
.prog-fill.low { background: var(--alert-red); }
.prog-fill.warn { background: var(--warn-amber); }

/* Activity Feed */
.feed-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.feed-item {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--floor-canvas);
  border: 1px solid var(--soft-line);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

/* Traceability Chain */
.trace-chain {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 14px;
}

.trace-node {
  background: var(--floor-canvas);
  border: 1px solid var(--muted-line);
  border-radius: var(--radius-sm);
  padding: 14px;
  position: relative;
}

.trace-step-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--cobalt-act);
  margin-bottom: 6px;
}

.trace-node h4 {
  margin: 0 0 4px;
  font-size: 14px;
}

.trace-node p {
  margin: 0;
  font-size: 12.5px;
  color: var(--graphite-sub);
}

/* Machine Cards */
.machine-card {
  background: var(--bench-surface);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ==================== Signature: 手机微信扫码报工模拟器抽屉 ==================== */
.phone-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 18, 32, 0.36);
  backdrop-filter: blur(2px);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease-out);
}
.phone-drawer-backdrop.open { opacity: 1; pointer-events: auto; }

.phone-drawer {
  position: fixed;
  top: 16px;
  right: 16px;
  bottom: 16px;
  width: 390px;
  max-width: calc(100vw - 32px);
  background: #111827;
  border-radius: 30px;
  padding: 12px;
  box-shadow: 0 28px 64px rgba(11, 18, 32, 0.35);
  z-index: 210;
  transform: translateX(115%);
  transition: transform 0.26s var(--ease-out);
  display: flex;
  flex-direction: column;
}
.phone-drawer.open { transform: translateX(0); }

.phone-screen {
  flex: 1;
  background: #f5f7fa;
  border-radius: 22px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.wx-nav {
  background: var(--cobalt-act);
  color: #fff;
  padding: 14px 16px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wx-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wx-card {
  background: #fff;
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.wx-field {
  margin-bottom: 10px;
}
.wx-field:last-child { margin-bottom: 0; }
.wx-field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--graphite-sub);
  margin-bottom: 5px;
}
.wx-field select, .wx-field input {
  width: 100%;
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--muted-line);
  background: var(--inset-control);
  padding: 0 10px;
  font-size: 13.5px;
  color: var(--steel-ink);
}

.wx-wage-box {
  background: var(--cobalt-tint);
  border: 1px solid #cadbff;
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.wx-submit {
  width: 100%;
  height: 44px;
  border: none;
  border-radius: 10px;
  background: var(--cobalt-act);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
}
.wx-submit:hover { background: var(--cobalt-hover); }

/* ==================== Signature: 车间数字可视化大屏 Overlay ==================== */
.bigscreen-overlay {
  position: fixed;
  inset: 0;
  background: var(--screen-bg);
  color: #eef3ff;
  z-index: 300;
  display: none;
  flex-direction: column;
  overflow-y: auto;
}
.bigscreen-overlay.open { display: flex; }

.bs-header {
  height: 64px;
  padding: 0 28px;
  border-bottom: 1px solid var(--screen-line);
  background: rgba(18, 28, 48, 0.9);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.bs-body {
  flex: 1;
  padding: 20px 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.bs-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.bs-card {
  background: var(--screen-card);
  border: 1px solid var(--screen-line);
  border-radius: 12px;
  padding: 16px 18px;
}

.bs-grid {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 16px;
}

.bs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.bs-table th {
  text-align: left;
  color: #8ea4c8;
  font-size: 11.5px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--screen-line);
}
.bs-table td {
  padding: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* ==================== Standard Modal ==================== */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(11, 18, 32, 0.45);
  backdrop-filter: blur(3px);
  z-index: 250;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-bg.open { display: flex; }

.modal-box {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-float);
  overflow: hidden;
}

.modal-hd {
  padding: 16px 20px;
  border-bottom: 1px solid var(--soft-line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-bd {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-ft {
  padding: 12px 20px;
  border-top: 1px solid var(--soft-line);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: #fafbfd;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--graphite-sub);
  margin-bottom: 5px;
}
.form-field input, .form-field select {
  width: 100%;
  height: 36px;
  border: 1px solid var(--muted-line);
  background: var(--inset-control);
  border-radius: 7px;
  padding: 0 10px;
  font-size: 13px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(16px);
  background: var(--steel-ink);
  color: #fff;
  padding: 10px 20px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 400;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: none; border-bottom: 1px solid var(--muted-line); }
  .nav-list { flex-direction: row; flex-wrap: wrap; }
  .nav-btn { width: auto; }
  .kpi-strip, .bs-kpi-row { grid-template-columns: repeat(2, 1fr); }
  .grid-2-asym, .grid-2, .grid-3, .trace-chain, .bs-grid { grid-template-columns: 1fr; }
}
