/* ============ 云仓 WMS · 设计系统 ============ */
:root {
  --bg: #f4f6fb;
  --card: #fff;
  --text: #1f2937;
  --muted: #8a94a6;
  --line: #e9edf4;
  --primary: #4f46e5;
  --primary-2: #6366f1;
  --primary-soft: #eef0ff;
  --in: #059669;
  --in-soft: #e7f8f1;
  --out: #ea580c;
  --out-soft: #fff1e8;
  --danger: #e11d48;
  --warn: #d97706;
  --side: #0f172a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 4px 16px rgba(16,24,40,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
.ic { width: 18px; height: 18px; flex: none; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.r { text-align: right; }
.nowrap { white-space: nowrap; }
.mono { font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.danger, .danger-text { color: var(--danger) !important; }
.warn { color: var(--warn); }
.c-in, .num.in { color: var(--in); }
.c-out, .num.out { color: var(--out); }
mark { background: #fde68a; color: inherit; border-radius: 3px; padding: 0 1px; }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex: none; background: linear-gradient(180deg, #0f172a 0%, #172036 100%);
  color: #cbd5e1; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px 26px; }
.logo {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, #818cf8, #4f46e5); color: #fff; font-weight: 700; font-size: 18px;
  box-shadow: 0 6px 16px rgba(79,70,229,.45);
}
.logo.big { width: 64px; height: 64px; font-size: 30px; border-radius: 18px; }
.brand-name { color: #fff; font-weight: 700; font-size: 16px; letter-spacing: .5px; }
.brand-sub { font-size: 12px; color: #7c8aa5; }
.sidebar nav { flex: 1; padding: 0 12px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; margin-bottom: 4px; border-radius: 10px;
  color: #aab4c8; transition: .15s;
}
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar nav a.active { background: linear-gradient(90deg, rgba(99,102,241,.95), rgba(79,70,229,.85)); color: #fff; box-shadow: 0 6px 18px rgba(79,70,229,.35); }
.side-foot { padding: 16px 20px; font-size: 12px; color: #55627c; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 68px; display: flex; align-items: center; gap: 16px; padding: 0 28px;
  background: rgba(255,255,255,.85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 19px; margin: 0; font-weight: 650; }
.menu-btn { display: none; border: 0; background: none; font-size: 22px; cursor: pointer; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user-menu { position: relative; display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 6px; border-radius: 12px; cursor: pointer; margin-left: 8px; }
.user-menu:hover { background: #f3f4f8; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 700; }
.user-info { display: flex; flex-direction: column; line-height: 1.25; }
.user-info small { color: var(--muted); font-size: 12px; }
.dropdown {
  position: absolute; right: 0; top: 100%; min-width: 150px; background: #fff; border-radius: 12px; box-shadow: 0 12px 32px rgba(16,24,40,.16);
  padding: 6px; display: none; border: 1px solid var(--line);
}
.user-menu:hover .dropdown { display: block; }
.dropdown a { display: flex; align-items: center; gap: 8px; padding: 9px 12px; color: var(--text); border-radius: 8px; }
.dropdown a:hover { background: #f4f5fa; }
.content { padding: 24px 28px 40px; max-width: 1600px; width: 100%; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 16px;
  border-radius: 10px; border: 1px solid transparent; font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap; transition: .15s;
}
.btn .ic { width: 16px; height: 16px; }
.btn-primary { background: linear-gradient(135deg, var(--primary-2), var(--primary)); color: #fff; box-shadow: 0 4px 12px rgba(79,70,229,.28); }
.btn-primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn-ghost { background: #fff; border-color: #dfe3ec; color: var(--text); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-in { background: var(--in-soft); color: var(--in); }
.btn-in:hover { background: var(--in); color: #fff; }
.btn-out { background: var(--out-soft); color: var(--out); }
.btn-out:hover { background: var(--out); color: #fff; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-xs { height: 26px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; height: 44px; font-size: 15px; }
.act { background: none; border: 0; padding: 2px 6px; font: inherit; font-size: 13px; color: var(--primary); cursor: pointer; border-radius: 6px; }
.act:hover { background: var(--primary-soft); }
.act.in { color: var(--in); } .act.out { color: var(--out); }
form.inline { display: inline; }

/* ---------- 卡片 & 统计 ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-head h2 { font-size: 16px; margin: 0; display: flex; align-items: center; gap: 8px; font-weight: 650; }
.link { font-size: 13px; display: inline-flex; align-items: center; gap: 4px; }
.link .ic { width: 15px; height: 15px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 20px; }
.stats.mini { grid-template-columns: repeat(3, 1fr); }
.stat { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; display: flex; gap: 16px; align-items: center; }
.stat small { color: var(--muted); display: block; }
.stat b { font-size: 28px; font-weight: 700; display: block; line-height: 1.25; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.stats.mini .stat b { font-size: 22px; }
.stat em { font-style: normal; font-size: 12px; color: var(--muted); }
.stat-ic { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; }
.stat-ic .ic { width: 26px; height: 26px; }
.c1 { background: #eef0ff; color: #4f46e5; } .c2 { background: var(--in-soft); color: var(--in); }
.c3 { background: var(--out-soft); color: var(--out); } .c4 { background: #fff1f3; color: var(--danger); }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; }
.grid-2 > .card { margin-bottom: 20px; }

/* 图表 */
.legend { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-left: 8px; }
.lg-in { background: #34d399; } .lg-out { background: #fb923c; }
.chart { display: flex; align-items: flex-end; gap: 6px; height: 230px; padding-top: 10px; }
.bar-group { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.bars { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 3px; border-bottom: 1px solid var(--line); }
.bar { width: 38%; max-width: 14px; min-height: 2px; border-radius: 4px 4px 0 0; transition: .3s; }
.bar.in { background: linear-gradient(180deg, #6ee7b7, #10b981); }
.bar.out { background: linear-gradient(180deg, #fdba74, #f97316); }
.bar-group:hover .bar { filter: brightness(.92); }
.bar-group span { font-size: 11px; color: var(--muted); margin-top: 6px; }
.rank { list-style: none; margin: 0; padding: 0; }
.rank li { display: flex; gap: 12px; align-items: center; padding: 10px 0; }
.rank .no { width: 24px; height: 24px; border-radius: 8px; background: #f1f3f8; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--muted); }
.rank .n1 { background: #fef3c7; color: #b45309; } .rank .n2 { background: #e0e7ff; color: #4338ca; } .rank .n3 { background: #ffedd5; color: #c2410c; }
.rk { flex: 1; } .rk-t { display: flex; justify-content: space-between; font-size: 13px; }
.rk-bar { height: 6px; background: #f1f3f8; border-radius: 6px; margin-top: 6px; overflow: hidden; }
.rk-bar i { display: block; height: 100%; background: linear-gradient(90deg, #a5b4fc, #6366f1); border-radius: 6px; }

/* ---------- 工具栏 & 表格 ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }
.search { position: relative; flex: 1 1 220px; max-width: 440px; min-width: 200px; }
.search .ic { position: absolute; left: 12px; top: 10px; color: var(--muted); }
.search input { padding-left: 38px !important; width: 100%; }
input, select, textarea {
  height: 38px; border: 1px solid #dfe3ec; border-radius: 10px; padding: 0 12px; font: inherit; color: var(--text); background: #fff; outline: none; transition: .15s;
}
textarea { height: auto; padding: 8px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--primary-2); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
input[type=checkbox], input[type=radio] { height: auto; accent-color: var(--primary); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.table { width: 100%; border-collapse: collapse; }
.table th { background: #f8f9fc; color: #64748b; font-weight: 600; font-size: 13px; text-align: left; padding: 12px 14px; white-space: nowrap; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 14px; border-bottom: 1px solid #f0f2f7; vertical-align: middle; }
.table th.r, .table td.r { text-align: right; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: #fafbff; }
.table tbody tr:last-child td { border-bottom: 0; }
.table.compact td, .table.compact th { padding: 9px 10px; }
.card > .table.compact { border: 0; }
.table .sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.table .ck { width: 36px; }
.ellipsis { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
tr.voided td { opacity: .5; } tr.voided td:first-child, tr.voided td:nth-child(2) { opacity: 1; }
tr.voided .num { text-decoration: line-through; }
.table-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; gap: 10px; }
.empty { text-align: center; color: var(--muted); padding: 48px 0 !important; }
.empty.sm { padding: 24px 0 !important; }
.tag { display: inline-block; padding: 1px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.tag-in { background: var(--in-soft); color: var(--in); }
.tag-out { background: var(--out-soft); color: var(--out); }
.tag-warn { background: #fef3c7; color: #b45309; }
.tag-void { background: #f1f3f8; color: #64748b; }
.chip { display: inline-block; padding: 1px 8px; background: #f1f3f8; color: #475569; border-radius: 6px; font-size: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.dot.ok { background: #10b981; } .dot.off { background: #cbd5e1; }

/* 分页 */
.pager { display: flex; align-items: center; gap: 14px; margin-left: auto; font-size: 13px; }
.pages { display: flex; gap: 4px; }
.pages a, .pages span { min-width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; padding: 0 8px; color: var(--text); }
.pages a:hover { background: var(--primary-soft); color: var(--primary); }
.pages a.active { background: var(--primary); color: #fff; }
.pages .disabled { color: #cbd5e1; }

/* ---------- 提示 ---------- */
.toast { padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; font-weight: 500; transition: .4s; border: 1px solid; }
.toast-success { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.toast-error { background: #fff1f2; color: #be123c; border-color: #fecdd3; }
.toast-warn { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.banner { background: var(--primary-soft); color: #3730a3; padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; }
.banner a { margin-left: 10px; }

/* ---------- 弹窗 ---------- */
dialog.modal { border: 0; border-radius: 18px; padding: 0; width: min(460px, 94vw); box-shadow: 0 24px 64px rgba(15,23,42,.28); color: var(--text); }
dialog.modal.wide { width: min(760px, 94vw); }
dialog.modal.xwide { width: min(1000px, 96vw); }
dialog::backdrop { background: rgba(15,23,42,.45); backdrop-filter: blur(3px); }
dialog[open] { animation: pop .18s ease-out; }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 20px 22px; max-height: 70vh; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); background: #fafbfd; }
.x { border: 0; background: none; font-size: 22px; color: var(--muted); cursor: pointer; width: 32px; height: 32px; border-radius: 8px; line-height: 1; }
.x:hover { background: #f1f3f8; color: var(--text); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 13px; color: #475569; font-weight: 500; }
.field input, .field select, .field textarea { width: 100%; }
.grid-form { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; }
.grid-form.three { grid-template-columns: 1fr 1fr 1.4fr; }
.grid-form .full { grid-column: 1 / -1; }
.seg { display: inline-flex; background: #f1f3f8; padding: 4px; border-radius: 12px; margin-bottom: 18px; }
.seg button { border: 0; background: none; padding: 8px 28px; border-radius: 9px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.on[data-t=in] { background: #fff; color: var(--in); box-shadow: var(--shadow); }
.seg button.on[data-t=out] { background: #fff; color: var(--out); box-shadow: var(--shadow); }

/* 明细行 */
.table.lines { border: 1px solid var(--line); border-radius: 12px; border-collapse: separate; border-spacing: 0; overflow: visible; }
.table.lines td { padding: 8px 10px; }
.table.lines input { width: 100%; height: 36px; }
.table.lines tr.over .qty { border-color: var(--danger); background: #fff5f6; }
.lines-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.lines-foot b { font-size: 16px; color: var(--primary); }
.picker { position: relative; }
.pk-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(16,24,40,.16); z-index: 50; max-height: 300px; overflow: auto; display: none; }
.pk-list.show { display: block; }
.pk-item { padding: 9px 12px; cursor: pointer; border-bottom: 1px solid #f4f5f9; }
.pk-item:hover, .pk-item.cur { background: var(--primary-soft); }
.pk-empty { padding: 14px; color: var(--muted); text-align: center; }

/* ---------- 导入 ---------- */
.import-card .tips { margin: 0 0 16px; padding-left: 18px; color: #64748b; font-size: 13px; }
.import-card .tips li { margin-bottom: 4px; }
.drop { display: grid; place-items: center; height: 120px; border: 2px dashed #cdd3f5; border-radius: 14px; background: #fafaff; color: #6366f1; cursor: pointer; position: relative; transition: .15s; margin-bottom: 14px; font-weight: 500; }
.drop:hover { background: var(--primary-soft); border-color: var(--primary-2); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; height: 100%; }
.opts { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 16px; font-size: 13px; color: #475569; }
.opts label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.result.ok { border-left: 4px solid var(--in); } .result.partial { border-left: 4px solid var(--warn); } .result.fail { border-left: 4px solid var(--danger); }
.result-nums { display: flex; gap: 40px; margin-bottom: 12px; }
.result-nums b { font-size: 28px; display: block; }
.result-nums small { color: var(--muted); }

/* ---------- 登录页 ---------- */
.login-page { display: flex; min-height: 100vh; background: #fff; }
.login-art { flex: 1.1; background: radial-gradient(circle at 20% 20%, #6366f1 0, transparent 45%), radial-gradient(circle at 80% 80%, #0ea5e9 0, transparent 40%), #0f172a; color: #e2e8f0; display: grid; place-items: center; padding: 40px; }
.art-inner { max-width: 420px; }
.art-inner h2 { font-size: 34px; margin: 22px 0 6px; color: #fff; }
.art-inner p { font-size: 17px; color: #a5b4fc; margin: 0 0 28px; }
.art-inner ul { list-style: none; padding: 0; margin: 0; }
.art-inner li { padding: 10px 0 10px 30px; position: relative; color: #cbd5e1; }
.art-inner li::before { content: "✓"; position: absolute; left: 0; top: 9px; width: 20px; height: 20px; border-radius: 50%; background: rgba(129,140,248,.25); color: #a5b4fc; display: grid; place-items: center; font-size: 12px; }
.login-box { flex: 1; display: grid; place-items: center; padding: 40px; }
.login-card { width: 100%; max-width: 380px; }
.login-card h3 { font-size: 26px; margin: 0; }
.login-card > p { margin: 4px 0 28px; }
.login-card .btn-block { margin-top: 10px; margin-bottom: 18px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1200px) { .stats { grid-template-columns: repeat(2, 1fr); } .grid-2 { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .sidebar { position: fixed; left: -240px; z-index: 100; transition: .25s; }
  .sidebar.open { left: 0; box-shadow: 0 0 0 100vmax rgba(15,23,42,.4); }
  .menu-btn { display: block; }
  .user-info, .top-actions .btn .ic { display: none; }
  .content { padding: 16px; } .topbar { padding: 0 16px; }
  .stats, .stats.mini, .grid-form, .grid-form.three { grid-template-columns: 1fr; }
  .login-art { display: none; }
}
@media print { .sidebar, .topbar, .toolbar, .table-foot .btn { display: none !important; } .card { box-shadow: none; } }
