* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: "Microsoft YaHei", "Segoe UI", sans-serif; background: #f0f2f5; color: #333; font-size: 14px; }

/* ===== 布局 ===== */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 200px; background: #1d2b3a; color: #cfd8e3; flex-shrink: 0; }
.sidebar .logo { padding: 20px 16px; font-size: 18px; font-weight: bold; color: #fff; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar .logo span { color: #4a9ef5; }
.sidebar a { display: block; padding: 13px 20px; color: #cfd8e3; text-decoration: none; border-left: 3px solid transparent; }
.sidebar a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar a.active { background: rgba(74,158,245,.15); color: #4a9ef5; border-left-color: #4a9ef5; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { height: 56px; background: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.topbar .user-info { color: #666; }
.topbar .user-info a { color: #e74c3c; text-decoration: none; margin-left: 12px; }
.content { padding: 20px 24px; flex: 1; }

/* ===== 通用组件 ===== */
.card { background: #fff; border-radius: 6px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.05); margin-bottom: 16px; }
.card h3 { font-size: 16px; margin-bottom: 16px; }
.btn { display: inline-block; padding: 7px 16px; border: 1px solid #dcdfe6; border-radius: 4px; background: #fff; color: #606266; cursor: pointer; text-decoration: none; font-size: 13px; line-height: 1.4; }
.btn:hover { color: #4a9ef5; border-color: #c6e2ff; background: #ecf5ff; }
.btn-primary { background: #4a9ef5; border-color: #4a9ef5; color: #fff; }
.btn-primary:hover { background: #3a8ee6; color: #fff; }
.btn-danger { color: #f56c6c; border-color: #fbc4c4; }
.btn-danger:hover { background: #fef0f0; color: #f56c6c; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #ebeef5; font-size: 13px; }
th { background: #fafbfc; color: #666; font-weight: 600; white-space: nowrap; }
tr:hover td { background: #f5f7fa; }

.tag { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 12px; }
.tag-blue { background: #ecf5ff; color: #4a9ef5; }
.tag-green { background: #f0f9eb; color: #67c23a; }
.tag-orange { background: #fdf6ec; color: #e6a23c; }
.tag-gray { background: #f4f4f5; color: #909399; }
.tag-red { background: #fef0f0; color: #f56c6c; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 6px; color: #666; font-size: 13px; }
.form-group label .req { color: #f56c6c; margin-right: 2px; }
.form-group input[type=text], .form-group input[type=password], .form-group input[type=number],
.form-group input[type=date], .form-group input[type=datetime-local], .form-group select, .form-group textarea {
    width: 100%; max-width: 420px; padding: 8px 10px; border: 1px solid #dcdfe6; border-radius: 4px; font-size: 13px;
}
.form-group textarea { max-width: 520px; height: 70px; }
.form-actions { margin-top: 18px; }

.filter-bar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.filter-bar input, .filter-bar select { padding: 7px 10px; border: 1px solid #dcdfe6; border-radius: 4px; font-size: 13px; }

/* 统计卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { background: #fff; border-radius: 6px; padding: 18px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.stat-card .num { font-size: 26px; font-weight: bold; color: #303133; margin-top: 6px; }
.stat-card .label { color: #909399; font-size: 13px; }
.stat-card.blue .num { color: #4a9ef5; }
.stat-card.green .num { color: #67c23a; }
.stat-card.orange .num { color: #e6a23c; }

/* 简易趋势条形图 */
.trend-chart { display: flex; align-items: flex-end; gap: 12px; height: 160px; padding-top: 20px; }
.trend-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.trend-item .bar { width: 60%; background: linear-gradient(180deg, #6ec1ff, #4a9ef5); border-radius: 3px 3px 0 0; min-height: 2px; transition: height .3s; }
.trend-item .val { font-size: 12px; color: #666; }
.trend-item .day { font-size: 12px; color: #909399; }

/* 分页 */
.pager { margin-top: 16px; display: flex; gap: 8px; align-items: center; color: #666; flex-wrap: wrap; }
.pager a { padding: 5px 12px; border: 1px solid #dcdfe6; border-radius: 4px; text-decoration: none; color: #606266; font-size: 13px; }
.pager a.disabled { color: #c0c4cc; pointer-events: none; }
.pager .cur { background: #4a9ef5; color: #fff; border-color: #4a9ef5; }
.pager a.active { background: #4a9ef5; color: #fff; border-color: #4a9ef5; }
.pager select { padding: 4px 6px; border: 1px solid #dcdfe6; border-radius: 4px; color: #606266; font-size: 13px; }
.pager span.ellipsis { color: #909399; padding: 0 2px; }

/* ===== 登录页 ===== */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1d2b3a 0%, #2c4a6e 100%); }
.login-box { background: #fff; border-radius: 8px; padding: 36px 40px; width: 380px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.login-box h2 { text-align: center; margin-bottom: 6px; color: #1d2b3a; }
.login-box .sub { text-align: center; color: #909399; font-size: 13px; margin-bottom: 24px; }
.login-box .error-msg { background: #fef0f0; color: #f56c6c; border-radius: 4px; padding: 8px 12px; margin-bottom: 14px; font-size: 13px; }
.login-box .btn-primary { width: 100%; padding: 10px; font-size: 15px; }

/* ===== H5 溯源页 ===== */
.trace-page { max-width: 640px; margin: 0 auto; background: #f6f8fa; min-height: 100vh; }
.trace-header { background: linear-gradient(135deg, #1d8ce6 0%, #4a9ef5 100%); color: #fff; padding: 24px 20px; text-align: center; }
.trace-header .verdict { font-size: 20px; font-weight: bold; margin-bottom: 6px; }
.trace-header .code { font-size: 13px; opacity: .85; letter-spacing: 1px; }
.trace-section { background: #fff; border-radius: 8px; margin: 12px; padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.trace-section h4 { font-size: 15px; color: #1d2b3a; margin-bottom: 12px; padding-left: 8px; border-left: 3px solid #4a9ef5; }
.info-row { display: flex; padding: 7px 0; border-bottom: 1px dashed #eee; font-size: 14px; }
.info-row:last-child { border-bottom: none; }
.info-row .k { width: 90px; color: #909399; flex-shrink: 0; }
.info-row .v { flex: 1; color: #333; word-break: break-all; }
.trace-fail { text-align: center; padding: 60px 30px; }
.trace-fail .icon { font-size: 60px; color: #f56c6c; margin-bottom: 16px; }
.trace-fail h2 { color: #f56c6c; margin-bottom: 10px; }
.trace-fail p { color: #909399; line-height: 1.8; }
.badge-first { display: inline-block; background: #f0f9eb; color: #67c23a; border: 1px solid #c2e7b0; border-radius: 4px; padding: 3px 10px; font-size: 12px; margin-top: 8px; }
.timeline { padding-left: 4px; }
.timeline .tl-item { display: flex; gap: 12px; padding-bottom: 18px; position: relative; }
.timeline .tl-item::before { content: ""; position: absolute; left: 5px; top: 16px; bottom: 0; width: 2px; background: #e4e7ed; }
.timeline .tl-item:last-child::before { display: none; }
.timeline .dot { width: 12px; height: 12px; border-radius: 50%; background: #4a9ef5; flex-shrink: 0; margin-top: 4px; }
.timeline .dot.done { background: #67c23a; }
.timeline .tl-title { font-weight: bold; font-size: 14px; }
.timeline .tl-desc { color: #909399; font-size: 13px; margin-top: 3px; }
.trace-footer { text-align: center; color: #c0c4cc; font-size: 12px; padding: 16px 0 30px; }
.report-img { max-width: 100%; border-radius: 4px; border: 1px solid #ebeef5; margin-top: 6px; }
.report-link { display: inline-block; color: #4a9ef5; font-size: 14px; font-weight: bold; border: 1px solid #b3d8ff; background: #ecf5ff; border-radius: 4px; padding: 8px 14px; margin-top: 6px; text-decoration: none; }
.report-link:active { background: #d9ecff; }

/* ---------- 图片上传组件（批次图样/质检报告） ---------- */
.img-upload { border:1px dashed #c0c4cc; border-radius:6px; padding:12px; }
.upload-preview { max-width:220px; max-height:220px; border-radius:4px; display:block; margin-bottom:8px; border:1px solid #e4e7ed; }
.upload-placeholder { color:#909399; font-size:13px; padding:24px 0; text-align:center; background:#fafafa; border-radius:4px; margin-bottom:8px; cursor:pointer; }
.upload-btns { display:flex; gap:8px; margin-bottom:6px; }
.upload-btns .btn { padding:4px 12px; font-size:12px; }
.btn-danger { background:#f56c6c; color:#fff; border:none; border-radius:4px; cursor:pointer; }
.btn-danger:hover { background:#e64242; }
.upload-tip { color:#909399; font-size:12px; }

/* ---------- 报表中心 ---------- */
.report-tabs { display:flex; gap:0; margin-bottom:16px; border-bottom:2px solid #e4e7ed; }
.report-tabs a { padding:8px 20px; font-size:14px; color:#606266; text-decoration:none; border-bottom:2px solid transparent; margin-bottom:-2px; }
.report-tabs a.active { color:#4a9ef5; border-bottom-color:#4a9ef5; font-weight:bold; }
.report-summary { display:flex; gap:16px; margin-bottom:16px; flex-wrap:wrap; }
.summary-card { flex:1; min-width:140px; background:#f5f7fa; border-radius:6px; padding:12px 16px; }
.summary-card .num { font-size:22px; font-weight:bold; color:#303133; }
.summary-card .lbl { font-size:12px; color:#909399; margin-top:4px; }
