/* 页面外壳：顶栏（标题 + 搜索区 + 实时指示）和选中订单后的底部操作条。
   放在各模块样式之后加载，只覆盖顶栏和搜索表单的外观。 */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.topbar {
	--sh-ink: #17201d;
	--sh-ink-soft: #5a6561;
	--sh-line: #dce0da;
	--sh-surface: #ffffff;
	--sh-online: #17794a;
	--sh-offline: #bf2630;
	gap: 14px;
	justify-content: flex-start;
	border-bottom-color: var(--sh-line);
	background: color-mix(in srgb, var(--bg) 86%, transparent);
	-webkit-backdrop-filter: blur(12px);
	backdrop-filter: blur(12px);
	color: var(--sh-ink);
	font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}

/* 标题：桌面端也显示当前页面的名字 */
.topbar .topbar-title { flex: 0 0 auto; }
.topbar .topbar-mobile-title { display: flex; }
.topbar .topbar-mobile-title strong { font-size: 20px; font-weight: 650; white-space: nowrap; }
.topbar .topbar-notification-badge { display: none; }

/* 搜索区：订单页和订货打包页各有一组，切换页面时只显示对应的那组 */
.topbar-tools { display: flex; min-width: 0; flex: 1 1 auto; align-items: center; }
.topbar-tool { display: flex; min-width: 0; flex: 1 1 auto; align-items: center; gap: 10px; }
.topbar-tool[hidden] { display: none; }

.topbar .order-search-toolbar { justify-self: auto; }
.topbar .order-search-tools { flex: 1 1 auto; justify-content: flex-start; gap: 10px; }
.topbar .order-search-form { order: -1; position: relative; max-width: 520px; flex: 1 1 260px; gap: 0; margin: 0; }
.topbar .packing-filter-band { grid-template-columns: none; border: 0; background: none; padding: 0; }
.topbar .packing-search-field { max-width: 520px; flex: 1 1 260px; }
.topbar .packing-filter-field { display: block; flex: 0 1 auto; }

/* 输入框和下拉框：40 高、圆角 10、白底细边 */
.topbar .order-search-form input,
.topbar .packing-search-field input {
	width: 100%;
	min-width: 0;
	height: 40px;
	border: 1px solid var(--sh-line);
	border-radius: 10px;
	outline: none;
	background: var(--sh-surface);
	padding: 0 12px 0 42px;
	color: var(--sh-ink);
	font-family: inherit;
	font-size: 15px;
	box-shadow: none;
}
.topbar .packing-search-field input { padding-right: 38px; }
.topbar .order-search-form input::placeholder,
.topbar .packing-search-field input::placeholder { color: var(--sh-ink-soft); }
.topbar .order-search-form input:hover,
.topbar .packing-search-field input:hover,
.topbar .order-filter-field select:hover,
.topbar .packing-filter-field select:hover { border-color: var(--sh-ink-soft); }
.topbar .order-search-form input:focus,
.topbar .packing-search-field input:focus,
.topbar .order-filter-field select:focus,
.topbar .packing-filter-field select:focus { border-color: var(--sh-ink); box-shadow: 0 0 0 3px rgba(23, 32, 29, 0.1); }

/* 搜索图标在输入框里靠左；订单页的图标同时是提交按钮 */
.topbar .order-search-button {
	position: absolute;
	top: 0;
	left: 0;
	width: 42px;
	height: 40px;
	flex: none;
	border: 0;
	border-radius: 10px;
	background: transparent;
	color: var(--sh-ink-soft);
	font-size: 16px;
}
.topbar .order-search-button:hover { background: transparent; color: var(--sh-ink); }
.topbar .packing-search-field > i { left: 14px; color: var(--sh-ink-soft); font-size: 16px; }
.topbar .packing-search-field button { right: 4px; width: 32px; height: 32px; border-radius: 8px; color: var(--sh-ink-soft); }

.topbar .order-filter-field select,
.topbar .packing-filter-field select {
	width: auto;
	min-width: 112px;
	max-width: 190px;
	height: 40px;
	border: 1px solid var(--sh-line);
	border-radius: 10px;
	outline: none;
	background-color: var(--sh-surface);
	padding: 0 30px 0 12px;
	color: var(--sh-ink);
	font-family: inherit;
	font-size: 15px;
}
.topbar .order-filter-field select.has-value { border-color: var(--sh-ink); background-color: var(--sh-surface); font-weight: 600; }

/* 实时指示（同时是“立即刷新”按钮） */
.live-indicator {
	display: inline-flex;
	height: 40px;
	flex: 0 0 auto;
	align-items: center;
	gap: 6px;
	margin-left: auto;
	border: 0;
	border-radius: 10px;
	background: none;
	padding: 0 8px;
	color: var(--sh-ink-soft);
	cursor: pointer;
	font-family: inherit;
	font-size: 13px;
	white-space: nowrap;
}
.live-indicator:hover { background: rgba(23, 32, 29, 0.06); color: var(--sh-ink); }
.live-indicator .live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sh-online); }
.live-indicator[data-state="offline"] { color: var(--sh-offline); }
.live-indicator[data-state="offline"] .live-dot { background: var(--sh-offline); }
/* 点击刷新时，按钮加载态会把圆点换成转圈图标 */
.live-indicator i.fa-spinner { width: auto; height: auto; border-radius: 0; background: none; font-size: 12px; animation: spin 700ms linear infinite; }
.topbar #push-inbox-open { margin-left: auto; }
.mobile-notifications .topbar .live-indicator { margin-left: 0; }
.mobile-notifications .topbar #refresh-dashboard { width: auto; min-width: 0; height: 40px; min-height: 40px; flex: 0 0 auto; padding: 0 8px; }

/* 订单面板顶部那一行：条数说明，后面跟“建新单” */
.order-table-panel .pagination-bar { gap: 14px; }
.order-list-summary { min-width: 0; }
.order-list-status { display: inline-flex; align-items: center; gap: 12px; margin-left: auto; }
.order-table-panel #create-order { height: 34px; border-radius: 9px; padding: 0 14px; font-size: 14px; }
.order-table-panel #orders-back-to-latest { margin-left: 0; }

/* 选中订单后从底部浮出的操作条 */
.selection-bar {
	position: fixed;
	z-index: 70;
	bottom: 24px;
	left: calc(50% + var(--sidebar-width) / 2);
	display: flex;
	max-width: calc(100vw - var(--sidebar-width) - 24px);
	align-items: center;
	gap: 6px;
	overflow-x: auto;
	border-radius: 14px;
	background: #17201d;
	box-shadow: 0 1px 2px rgba(23, 32, 29, 0.06), 0 12px 32px -12px rgba(23, 32, 29, 0.4);
	padding: 8px 8px 8px 18px;
	color: #fff;
	font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
	transform: translateX(-50%);
}
.selection-bar[hidden] { display: none; }
.selection-bar strong { margin-right: 8px; font-family: "DIN Alternate", "Bahnschrift", "Roboto Condensed", -apple-system, "PingFang SC", system-ui, sans-serif; font-size: 16px; white-space: nowrap; }
.selection-bar button {
	height: 38px;
	border: 0;
	border-radius: 9px;
	background: rgba(128, 128, 128, 0.28);
	padding: 0 14px;
	color: inherit;
	cursor: pointer;
	font-family: inherit;
	font-size: 15px;
	font-weight: 550;
	white-space: nowrap;
}
.selection-bar button:hover:not(:disabled) { background: rgba(128, 128, 128, 0.5); }
.selection-bar button:disabled { cursor: not-allowed; opacity: 0.45; }

@media (max-width: 900px) {
	/* 窄屏：标题和实时指示一行，搜索区换到第二行占满宽度 */
	.topbar { height: auto; min-height: 56px; flex-wrap: wrap; gap: 8px 10px; padding: 8px 12px; }
	.topbar .topbar-tools { order: 5; flex: 1 1 100%; }
	.topbar .topbar-tools:not(:has(.topbar-tool:not([hidden]))) { display: none; }
	.topbar .order-search-tools { display: flex; flex-wrap: wrap; gap: 8px; }
	.topbar .order-search-form { max-width: none; flex: 1 1 100%; }
	.topbar .order-filter-field { flex: 1 1 0; }
	.topbar .order-filter-field select { width: 100%; max-width: none; }
	.topbar .packing-filter-band { display: flex; flex-wrap: wrap; gap: 8px; }
	.topbar .packing-search-field { max-width: none; flex: 1 1 100%; grid-column: auto; grid-row: auto; }
	.topbar .packing-filter-field { flex: 1 1 100%; grid-column: auto; grid-row: auto; }
	.topbar .packing-filter-field select { width: 100%; max-width: none; }

	.order-table-panel .pagination-bar { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
	.selection-bar { right: 12px; bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom) + 10px); left: 12px; max-width: none; justify-content: space-between; transform: none; }
}
