/* ============ 电脑版样式 ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background: #f3f5f7; color: #333; font-size: 14px;
}

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px; background: #1f2733; color: #c9d1d9;
  display: flex; flex-direction: column;
  position: fixed; top: 0; bottom: 0; left: 0;
}
.logo { padding: 22px 20px; font-size: 18px; font-weight: 700; color: #fff; border-bottom: 1px solid #2c3644; }
.sidebar nav { flex: 1; padding: 10px 0; }
.sidebar nav a {
  display: block; padding: 13px 22px; color: #aeb8c4;
  cursor: pointer; text-decoration: none; font-size: 14px;
}
.sidebar nav a:hover { background: #28323f; color: #fff; }
.sidebar nav a.active { background: #2563eb; color: #fff; }
.side-foot { padding: 16px 20px; border-top: 1px solid #2c3644; }
.user-info { color: #c9d1d9; font-size: 13px; margin-bottom: 12px; }
.user-info b { color: #fff; }
.side-foot a { color: #8fa3bf; text-decoration: none; font-size: 13px; display: block; margin-bottom: 10px; }
.side-foot a:hover { color: #fff; }
.btn-logout {
  width: 100%; background: #28323f; border: none; color: #c9d1d9;
  border-radius: 6px; padding: 8px 12px; font-size: 13px; cursor: pointer; margin-bottom: 10px;
}
.btn-logout:hover { background: #374151; color: #fff; }
.btn-reset {
  background: none; border: 1px solid #4b5563; color: #9ca3af;
  border-radius: 6px; padding: 6px 12px; font-size: 12px; cursor: pointer;
}
.btn-reset:hover { border-color: #dc2626; color: #fca5a5; }

.main { margin-left: 220px; flex: 1; padding: 0 28px 50px; min-width: 0; }
.topbar { padding: 20px 0; border-bottom: 1px solid #e5e9ef; margin-bottom: 22px; }
.topbar h1 { font-size: 20px; }

/* ---------- 卡片与统计 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat-card {
  background: #fff; border-radius: 12px; padding: 18px 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.stat-card .t { color: #6b7280; font-size: 13px; margin-bottom: 8px; }
.stat-card .v { font-size: 26px; font-weight: 700; }
.stat-card .v.red { color: #dc2626; }
.stat-card .v.blue { color: #2563eb; }
.stat-card .v.orange { color: #ea580c; }
.stat-card .v.green { color: #16a34a; }

.card {
  background: #fff; border-radius: 12px; padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06); margin-bottom: 20px;
}
.card h3 { font-size: 15px; margin-bottom: 14px; color: #1f2937; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.card-head h3 { margin-bottom: 0; }

/* ---------- 表格 ---------- */
table.tbl { width: 100%; border-collapse: collapse; }
table.tbl th, table.tbl td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #eef1f5; }
table.tbl th { color: #6b7280; font-weight: 500; font-size: 13px; background: #f9fafb; }
table.tbl tr:hover td { background: #f8fafc; }
table.tbl td.r, table.tbl th.r { text-align: right; }
td .ops { white-space: nowrap; }
.low-stock { color: #dc2626; font-weight: 700; }

/* ---------- 工具条 / 表单 ---------- */
.toolbar { display: flex; gap: 12px; margin-bottom: 16px; align-items: center; flex-wrap: wrap; }
.toolbar select {
  padding: 8px 12px; border: 1px solid #d9dee5; border-radius: 8px; font-size: 14px; background: #fff;
}
.inline-form {
  display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px;
  padding: 14px; background: #f8fafc; border-radius: 10px;
}
.inline-form input, .inline-form select {
  padding: 8px 10px; border: 1px solid #d9dee5; border-radius: 6px; font-size: 13px;
}
.inline-form input { width: 130px; }

.quick-actions { display: flex; gap: 10px; margin-bottom: 20px; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  display: none; position: fixed; inset: 0; background: rgba(15,23,42,.45);
  align-items: center; justify-content: center; z-index: 100;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 12px; width: 560px; max-width: 94vw;
  max-height: 88vh; display: flex; flex-direction: column;
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid #eef1f5; font-size: 16px; font-weight: 600;
}
.modal-head button { background: none; border: none; font-size: 22px; cursor: pointer; color: #6b7280; }
.modal-body { padding: 20px; overflow-y: auto; }
.detail-p { margin-bottom: 10px; color: #4b5563; }
.detail-p b { color: #1f2937; }
.detail-total { text-align: right; font-size: 16px; margin-top: 10px; color: #dc2626; font-weight: 700; }

/* ---------- 打印区域（仅打印时可见） ---------- */
#printArea { display: none; }

@media print {
  .layout, .modal-mask { display: none !important; }
  body { background: #fff; }
  #printArea { display: block; }
}

/* 打印单据样式 */
.p-sheet { font-size: 13px; color: #000; padding: 10px; }
.p-sheet .p-head { text-align: center; margin-bottom: 14px; }
.p-sheet .p-head h2 { font-size: 20px; letter-spacing: 4px; margin-bottom: 4px; }
.p-sheet .p-head .p-sub { font-size: 12px; color: #444; }
.p-sheet .p-info { display: flex; flex-wrap: wrap; margin-bottom: 8px; }
.p-sheet .p-info span { width: 50%; padding: 3px 0; }
.p-sheet .p-fault {
  border: 1px solid #000; padding: 8px 10px; margin: 10px 0; min-height: 34px;
}
.p-sheet h4 { font-size: 14px; margin: 12px 0 6px; }
.p-sheet table.p-tbl { width: 100%; border-collapse: collapse; }
.p-sheet table.p-tbl th, .p-sheet table.p-tbl td {
  border: 1px solid #000; padding: 6px 8px; text-align: left; font-size: 13px;
}
.p-sheet table.p-tbl th { background: #eee; }
.p-sheet table.p-tbl td.r, .p-sheet table.p-tbl th.r { text-align: right; }
.p-sheet .p-total {
  text-align: right; font-size: 17px; font-weight: 700; margin: 12px 0 24px;
}
.p-sheet .p-sign { display: flex; justify-content: space-between; margin-top: 40px; }
.p-sheet .p-sign span { width: 40%; border-top: 1px solid #000; padding-top: 6px; text-align: center; }
.p-sheet .p-foot { text-align: center; font-size: 12px; color: #444; margin-top: 30px; }
