* { box-sizing: border-box; }
body {
  margin: 0; font-family: "Microsoft YaHei", Arial, sans-serif; font-size: 14px;
  color: #1F2329; background: #F7F8FA;
}
.hidden { display: none !important; }
.muted { color: #646A73; font-size: 13px; }
.err { color: #EF4444; font-size: 13px; min-height: 18px; }
.spacer { flex: 1; }

/* 登录 */
.login-mask {
  position: fixed; inset: 0;
  background:
    radial-gradient(1200px 600px at 50% -10%, #EAF1FB 0%, rgba(234,241,251,0) 60%),
    linear-gradient(180deg, #F7F9FC 0%, #EDF1F7 100%);
  display: flex; align-items: center; justify-content: center;
}
.login-box {
  width: 360px; background: #fff; padding: 36px 30px 26px; border-radius: 16px;
  border: 1px solid #E8EBF0; box-shadow: 0 18px 48px rgba(23,43,77,.10), 0 2px 6px rgba(23,43,77,.04);
}
.login-logo { height: 48px; width: auto; display: block; margin: 0 auto 16px; }
.login-box h1 { font-size: 21px; margin: 0 0 6px; text-align: center; letter-spacing: 1.5px; }
.login-sub { margin: 0 0 24px; text-align: center; color: #8F959E; font-size: 12px; letter-spacing: 1.2px; }
.login-box input { height: 42px; margin-bottom: 14px; padding: 0 12px; border-radius: 8px; font-size: 14px; background: #FBFCFE; }
.login-box button.primary {
  width: 100%; height: 42px; border-radius: 8px; font-size: 15px; font-weight: 600; letter-spacing: 2px;
  margin-top: 4px; background: #2F6BFF; box-shadow: 0 6px 16px rgba(47,107,255,.22);
}
.login-box button.primary:hover { background: #2560EE; }
.login-foot { margin: 18px 0 0; text-align: center; color: #B4B9C2; font-size: 11px; letter-spacing: .5px; }
.login-box input {
  width: 100%; height: 38px; margin-bottom: 12px; padding: 0 10px;
  border: 1px solid #E5E6EB; border-radius: 6px; outline: none;
}
.login-box input:focus { border-color: #409EFF; }
.hint { color: #8F959E; font-size: 12px; line-height: 1.6; }

/* 布局 */
.app { display: flex; min-height: 100vh; }
.side {
  width: 190px; background: #fff; border-right: 1px solid #E5E6EB;
  padding: 16px 0; position: fixed; top: 0; bottom: 0;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px 16px; border-bottom: 1px solid #F0F1F3; margin-bottom: 8px;
}
.brand img { height: 26px; width: auto; display: block; }
.brand .bt { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand .bt b { font-size: 16px; font-weight: 700; letter-spacing: .5px; color: #1F2329; }
.brand .bt span { font-size: 9px; color: #8F959E; letter-spacing: 1.3px; margin-top: 2px; white-space: nowrap; }
.side nav { display: flex; flex-direction: column; }
.side nav a {
  padding: 10px 18px; color: #646A73; text-decoration: none;
  border-left: 3px solid transparent; font-size: 14px;
}
.side nav a:hover { background: #F2F7FF; }
.side nav a.active { background: #EAF4FF; color: #409EFF; border-left-color: #409EFF; font-weight: bold; }
.main { margin-left: 190px; flex: 1; min-width: 0; }
.top {
  height: 56px; background: #fff; border-bottom: 1px solid #E5E6EB;
  display: flex; align-items: center; gap: 10px; padding: 0 20px;
  position: sticky; top: 0; z-index: 5;
}
.top select { min-width: 320px; height: 32px; border: 1px solid #E5E6EB; border-radius: 6px; padding: 0 8px; }
.view { padding: 20px 24px 40px; }

/* 通用 */
h2.page-title { font-size: 20px; margin: 0 0 4px; }
.page-sub { color: #646A73; font-size: 13px; margin-bottom: 16px; }
.card {
  background: #fff; border: 1px solid #E5E6EB; border-radius: 10px;
  padding: 16px; margin-bottom: 16px;
}
.card h3 { font-size: 14px; margin: 0 0 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
button {
  height: 32px; padding: 0 14px; border: none; border-radius: 6px;
  background: #409EFF; color: #fff; cursor: pointer; font-size: 13px;
}
button:hover { background: #337ECC; }
button.ghost { background: #fff; color: #1F2329; border: 1px solid #E5E6EB; }
button.ghost:hover { border-color: #409EFF; color: #409EFF; background: #fff; }
button.danger { background: #EF4444; }
button.danger:hover { background: #D93636; }
button:disabled { background: #C9CDD4; cursor: not-allowed; }
input, select, textarea {
  height: 32px; padding: 0 8px; border: 1px solid #E5E6EB; border-radius: 6px;
  font-size: 13px; outline: none; background: #fff;
}
input:focus, select:focus, textarea:focus { border-color: #409EFF; }
input.invalid { border-color: #EF4444; background: #FFF5F5; }

table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: 8px 10px; border-bottom: 1px solid #F0F1F3; text-align: left; font-size: 13px; }
th { background: #FAFBFC; color: #646A73; font-weight: normal; white-space: nowrap; }
tr:hover td { background: #FAFCFF; }
td.num, th.num { text-align: right; }
.table-wrap { border: 1px solid #E5E6EB; border-radius: 8px; overflow: auto; max-height: 56vh; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; }
.tag.blue { background: #EAF4FF; color: #409EFF; }
.tag.green { background: #E8F8EF; color: #22A05A; }
.tag.orange { background: #FFF4E5; color: #D97706; }
.tag.red { background: #FEECEC; color: #D93636; }
.tag.gray { background: #F2F3F5; color: #646A73; }

.kpis { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.kpi { flex: 1; min-width: 160px; background: #fff; border: 1px solid #E5E6EB; border-radius: 10px; padding: 14px 16px; }
.kpi .n { font-size: 24px; font-weight: bold; margin-top: 6px; }
.kpi .l { color: #646A73; font-size: 13px; }

/* 收料行 */
.grid-in td { padding: 6px; }
.grid-in input { width: 100%; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: #1F2329; color: #fff; padding: 10px 16px; border-radius: 8px;
  display: flex; gap: 12px; align-items: center; z-index: 50; font-size: 13px;
}
.toast button { height: 26px; padding: 0 10px; background: #409EFF; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; z-index: 40; }
.modal-box { background: #fff; border-radius: 10px; padding: 20px; width: 720px; max-width: 92vw; max-height: 86vh; overflow: auto; }
.modal-box h3 { margin: 0 0 14px; }

/* tabs */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tabs button { background: #fff; color: #646A73; border: 1px solid #E5E6EB; }
.tabs button.active { background: #EAF4FF; color: #409EFF; border-color: #409EFF; }

/* 打印 */
@media print {
  .side, .top, .no-print, button { display: none !important; }
  .main { margin: 0; }
  .view { padding: 0; }
  body { background: #fff; }
  table { font-size: 12px; }
  .card { border: none; padding: 0; }
}
