/* 派送跟踪 - 全局样式 */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
	font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
	font-size: 14px; color: #333; background: #f5f6fa;
	-webkit-font-smoothing: antialiased;
}
#app { height: 100%; }
.page {
	display: flex; flex-direction: column; min-height: 100vh;
	/* 底部留出 tabbar 高度 + iPhone 安全区 */
	padding-bottom: calc(70px + env(safe-area-inset-bottom));
}
.page.no-tabbar { padding-bottom: 0; }
.page-head {
	position: sticky; top: 0; z-index: 10;
	background: #1a73e8; color: #fff;
	padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top));
	font-size: 17px; font-weight: 600;
	display: flex; align-items: center; justify-content: space-between;
}
.page-head .back { font-size: 22px; line-height: 1; padding: 0 8px 0 0; color: #fff; background: none; border: none; }
.page-head .lock {
	background: rgba(255,255,255,.18); color: #fff; border: none; border-radius: 14px;
	font-size: 12px; padding: 4px 10px; margin-left: 8px;
}
.page-body { flex: 1; padding: 12px; }

/* 卡片 */
.card { background: #fff; border-radius: 10px; padding: 12px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }

/* 表单 */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: #666; margin-bottom: 4px; }
.field input, .field select, .field textarea {
	width: 100%; border: 1px solid #ddd; border-radius: 8px; padding: 10px 12px;
	font-size: 15px; background: #fafbfc; outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: #1a73e8; background: #fff; }
.btn {
	display: block; width: 100%; border: none; border-radius: 10px; padding: 12px;
	font-size: 16px; font-weight: 600; background: #1a73e8; color: #fff; text-align: center;
}
.btn:active { opacity: .85; }
.btn.plain { background: #fff; color: #1a73e8; border: 1px solid #1a73e8; }
.btn.mini { display: inline-block; width: auto; padding: 6px 14px; font-size: 13px; border-radius: 8px; font-weight: 400; }
.btn.danger { background: #e53935; }
.btn[disabled] { opacity: .5; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

/* 悬浮添加按钮 (需避开 tabbar + iPhone 底部安全区) */
.fab {
	position: fixed; right: 16px;
	bottom: calc(76px + env(safe-area-inset-bottom));
	width: auto; padding: 12px 20px; border-radius: 24px;
	box-shadow: 0 4px 12px rgba(26,115,232,.4);
	z-index: 15;
}

/* 标签页 */
.tabs { display: flex; background: #fff; border-radius: 10px; overflow: hidden; margin-bottom: 10px; }
.tabs span { flex: 1; text-align: center; padding: 10px 0; font-size: 14px; color: #666; position: relative; cursor: pointer; }
.tabs span.on { color: #1a73e8; font-weight: 600; }
.tabs span.on::after { content: ''; position: absolute; left: 25%; right: 25%; bottom: 4px; height: 3px; border-radius: 2px; background: #1a73e8; }

/* 筛选条 */
.filters { display: flex; gap: 8px; margin-bottom: 10px; }
.filters input, .filters select {
	flex: 1; min-width: 0; border: 1px solid #ddd; border-radius: 8px; padding: 8px 10px;
	font-size: 13px; background: #fff; outline: none;
}
.filters .btn.mini { flex: none; }

/* 派送单 树形列表 */
.bill-card { background: #fff; border-radius: 10px; margin-bottom: 10px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.bill-card .head { padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; }
.bill-card .head .no { font-weight: 600; font-size: 15px; }
.bill-card .head .date { color: #999; font-size: 12px; }
.bill-card .info { padding: 0 12px 8px; color: #666; font-size: 13px; display: flex; justify-content: space-between; align-items: center; }
.status-tag { font-size: 12px; padding: 2px 8px; border-radius: 10px; flex: none; }
.status-0 { background: #fff3e0; color: #ef6c00; }
.status-1 { background: #e3f2fd; color: #1565c0; }
.status-2 { background: #e8f5e9; color: #2e7d32; }
.status-3 { background: #eceff1; color: #546e7a; }
.steps { border-top: 1px solid #f0f0f0; }
.step {
	display: flex; align-items: center; padding: 8px 12px; gap: 8px;
	border-bottom: 1px solid #f7f7f7; font-size: 13px;
}
.step:last-child { border-bottom: none; }
.step .sn { width: 22px; height: 22px; border-radius: 50%; background: #f0f2f5; color: #666; font-size: 12px; display: flex; align-items: center; justify-content: center; flex: none; }
.step .sn.done { background: #1a73e8; color: #fff; }
.step .sn.done2 { background: #2e7d32; color: #fff; }
.step .who { flex: 1; color: #666; }
.step .who b { color: #333; font-weight: 500; }
.step .ops { display: flex; gap: 6px; }

/* 空状态 */
.empty { text-align: center; color: #999; padding: 60px 0; font-size: 14px; }

/* 底部菜单栏 */
.tabbar {
	position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
	background: #fff; display: flex; align-items: flex-end; justify-content: space-around;
	padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
	box-shadow: 0 -1px 6px rgba(0,0,0,.06);
}
.tabbar .tab { flex: 1; text-align: center; font-size: 12px; color: #999; background: none; border: none; padding: 4px 0; }
.tabbar .tab.on { color: #1a73e8; }
.tabbar .tab .ic { font-size: 22px; line-height: 1.2; }
.tabbar .scan-btn {
	flex: none; width: 62px; margin-top: -28px;
}
.tabbar .scan-btn button {
	width: 58px; height: 58px; border-radius: 50%; border: 4px solid #fff;
	background: linear-gradient(135deg, #1a73e8, #42a5f5); color: #fff; font-size: 26px;
	box-shadow: 0 3px 10px rgba(26,115,232,.4);
}

/* 列表行 */
.list-row {
	background: #fff; border-radius: 10px; padding: 12px; margin-bottom: 10px;
	display: flex; align-items: center; justify-content: space-between; gap: 10px;
	box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.list-row .main { flex: 1; min-width: 0; }
.list-row .main .t1 { font-size: 15px; font-weight: 500; margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .main .t2 { font-size: 12px; color: #999; }
.list-row .act { flex: none; }

/* 弹窗 */
.mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; display: flex; align-items: flex-end; }
.dialog {
	width: 100%; background: #fff; border-radius: 16px 16px 0 0; padding: 16px;
	max-height: 82vh; overflow-y: auto;
	padding-bottom: calc(16px + env(safe-area-inset-bottom));
}
.dialog h3 { margin-bottom: 14px; font-size: 16px; }

/* Toast */
.toast {
	position: fixed; top: 40%; left: 50%; transform: translate(-50%,-50%); z-index: 99;
	background: rgba(0,0,0,.75); color: #fff; padding: 10px 20px; border-radius: 8px; font-size: 14px;
	max-width: 80vw; text-align: center;
}

/* 扫码页 */
.scan-wrap { position: relative; height: 100vh; background: #000; }
.scan-wrap video { width: 100%; height: 100%; object-fit: cover; }
.scan-wrap canvas { display: none; }
.scan-mask {
	position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
	pointer-events: none;
}
.scan-box { width: 240px; height: 240px; position: relative; }
.scan-box i { position: absolute; width: 32px; height: 32px; border: 4px solid #1a73e8; }
.scan-box i:nth-child(1) { top: 0; left: 0; border-right: none; border-bottom: none; }
.scan-box i:nth-child(2) { top: 0; right: 0; border-left: none; border-bottom: none; }
.scan-box i:nth-child(3) { bottom: 0; left: 0; border-right: none; border-top: none; }
.scan-box i:nth-child(4) { bottom: 0; right: 0; border-left: none; border-top: none; }
.scan-tip { position: absolute; top: calc(env(safe-area-inset-top) + 16px); width: 100%; text-align: center; color: #fff; font-size: 14px; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.scan-actions {
	position: absolute; bottom: calc(24px + env(safe-area-inset-bottom)); left: 0; right: 0;
	display: flex; gap: 12px; padding: 0 24px;
}
.scan-actions .btn { background: rgba(255,255,255,.92); color: #333; }

/* 打印 */
@media print {
	body * { visibility: hidden; }
	#print-area, #print-area * { visibility: visible; }
	#print-area { position: absolute; left: 0; top: 0; width: 100%; }
	.print-client {
		width: 220px; border: 1px dashed #999; padding: 8px; font-size: 12px;
	}
	.print-step { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid #eee; page-break-inside: avoid; }
	.print-step img { width: 72px; height: 72px; }
}
.print-only { display: none; }
@media print { .print-only { display: block; } }
