/* ERP 极简 UI 样式 */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 14px; color: #222; background: #f5f6f8; }

/* 登录页 */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 100%); }
.login-box { background: #fff; padding: 40px; border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,.2); width: 360px; }
.login-box h1 { margin: 0 0 8px; font-size: 22px; color: #1e3a5f; }
.login-box .sub { color: #888; margin-bottom: 24px; font-size: 13px; }
.login-box input { width: 100%; padding: 10px 12px; margin-bottom: 12px; border: 1px solid #ddd; border-radius: 4px; font-size: 14px; }
.login-box button { width: 100%; padding: 10px; background: #1e3a5f; color: #fff; border: none; border-radius: 4px; font-size: 15px; cursor: pointer; }
.login-box button:hover { background: #2c5282; }
.login-box .err { color: #d33; font-size: 13px; margin-top: 8px; min-height: 18px; }

/* 主布局 */
.app { display: flex; height: 100vh; }
.sidebar { width: 200px; background: #1e3a5f; color: #cdd5e0; flex-shrink: 0; display: flex; flex-direction: column; }
.sidebar .logo { padding: 18px 16px; font-size: 16px; font-weight: 600; color: #fff; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar .logo span { color: #7eb8e9; font-size: 12px; font-weight: 400; display: block; margin-top: 2px; }
.sidebar nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.sidebar nav a { display: block; padding: 10px 16px; color: #cdd5e0; text-decoration: none; border-left: 3px solid transparent; cursor: pointer; }
.sidebar nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.sidebar nav a.active { background: rgba(255,255,255,.08); border-left-color: #7eb8e9; color: #fff; }
.sidebar nav .section { padding: 12px 16px 4px; font-size: 11px; color: #7889a0; letter-spacing: 1px; }
.sidebar .user { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; }
.sidebar .user a { color: #7eb8e9; cursor: pointer; }

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar { padding: 12px 24px; background: #fff; border-bottom: 1px solid #e5e7eb; display: flex; justify-content: space-between; align-items: center; }
.topbar h2 { margin: 0; font-size: 17px; color: #333; }
.content { flex: 1; overflow: auto; padding: 20px 24px; }

/* 通用组件 */
.card { background: #fff; border-radius: 6px; padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.04); margin-bottom: 16px; }
.card h3 { margin: 0 0 12px; font-size: 15px; color: #333; }

.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar input, .toolbar select { padding: 6px 10px; border: 1px solid #ddd; border-radius: 4px; font-size: 13px; }
.toolbar input { min-width: 200px; }

.btn { padding: 6px 14px; border: 1px solid #1e3a5f; background: #1e3a5f; color: #fff; border-radius: 4px; cursor: pointer; font-size: 13px; }
.btn:hover { background: #2c5282; border-color: #2c5282; }
.btn.ghost { background: #fff; color: #1e3a5f; }
.btn.ghost:hover { background: #f0f4fa; }
.btn.danger { background: #c53030; border-color: #c53030; }
.btn.danger:hover { background: #9b2828; }
.btn.small { padding: 4px 10px; font-size: 12px; }

table { width: 100%; border-collapse: collapse; background: #fff; }
table th, table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid #eef0f3; font-size: 13px; }
table th { background: #f7f8fa; color: #555; font-weight: 600; font-size: 12px; }
table tbody tr:hover { background: #fafbfc; }
table .num { text-align: right; font-variant-numeric: tabular-nums; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; }
.tag.draft { background: #f0f0f0; color: #666; }
.tag.confirmed { background: #e3f2fd; color: #1976d2; }
.tag.received, .tag.shipped { background: #e8f5e9; color: #388e3c; }
.tag.cancelled { background: #fde7e9; color: #c62828; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi { background: #fff; padding: 14px 16px; border-radius: 6px; box-shadow: 0 1px 3px rgba(0,0,0,.04); border-left: 3px solid #1e3a5f; }
.kpi .label { color: #888; font-size: 12px; }
.kpi .value { font-size: 22px; font-weight: 600; color: #222; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 11px; color: #999; margin-top: 4px; }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal { background: #fff; border-radius: 6px; min-width: 480px; max-width: 90vw; max-height: 90vh; display: flex; flex-direction: column; }
.modal-header { padding: 14px 18px; border-bottom: 1px solid #e5e7eb; display: flex; justify-content: space-between; }
.modal-header h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 16px 18px; overflow: auto; }
.modal-footer { padding: 12px 18px; border-top: 1px solid #e5e7eb; display: flex; justify-content: flex-end; gap: 8px; }
.modal-mask .modal { width: 720px; }
.modal-mask .modal.lg { width: 960px; }

.form-row { display: flex; gap: 12px; margin-bottom: 10px; }
.form-row > .field { flex: 1; }
.field label { display: block; color: #555; font-size: 12px; margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; padding: 6px 10px; border: 1px solid #ddd; border-radius: 4px; font-size: 13px; }
.field textarea { min-height: 60px; resize: vertical; }

.empty { text-align: center; color: #aaa; padding: 30px; font-size: 13px; }
.toast { position: fixed; top: 16px; right: 16px; padding: 10px 16px; border-radius: 4px; color: #fff; z-index: 2000; font-size: 13px; box-shadow: 0 4px 12px rgba(0,0,0,.15); }
.toast.ok { background: #2e7d32; }
.toast.err { background: #c53030; }
