/* 订单表格：按设计稿调整字体、字号和间距；列和内容不变。
   放在 app.css 之后加载，只覆盖订单列表面板里的样式。 */
.order-table-panel {
	/* 浅色配色（和设计稿的浅色一致） */
	--ot-surface: #ffffff;
	--ot-ink: #17201d;
	--ot-ink-soft: #5a6561;
	--ot-line: #dce0da;
	--ot-hover: #f5f6f3;
	--ot-signal: #e8501a;
	--ot-green: #17794a;
	--ot-blue: #1f5fd1;
	--ot-orange: #cf4410;
	--ot-red: #bf2630;
	--ot-grey: #6b7672;
	/* 面板里的按钮、输入框沿用 app.css 的变量，这里一起换成同一套配色 */
	--surface: var(--ot-surface);
	--surface-muted: var(--ot-hover);
	--text: var(--ot-ink);
	--text-soft: var(--ot-ink-soft);
	--line: var(--ot-line);
	--line-dark: var(--ot-ink-soft);
	--ink: var(--ot-ink);
	background: var(--ot-surface);
	--ot-num: "DIN Alternate", "Bahnschrift", "Roboto Condensed", -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
	border-color: var(--ot-line);
	border-radius: 14px;
	color: var(--ot-ink);
	font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}

/* 滚动加载时由脚本自己保持位置，关掉浏览器的自动锚定，避免两边同时调整 */
.order-table-scroll { overflow-anchor: none; }
.order-list-top-edge { height: 1px; margin-bottom: -1px; pointer-events: none; }
.order-list-bottom-edge {
	position: sticky;
	left: 0;
	display: flex;
	width: 100%;
	min-height: 64px;
	align-items: center;
	justify-content: center;
	gap: 10px;
	color: var(--ot-ink-soft);
	font-size: 13px;
}
.order-list-bottom-edge .table-loading,
.order-list-loading-inline .table-loading { width: 16px; height: 16px; margin: 0; }
.order-list-loading-inline { display: inline-flex; align-items: center; gap: 8px; color: var(--ot-ink-soft); font-size: 13px; }

.order-table-panel .pagination-bar { min-height: 48px; justify-content: flex-start; border-bottom-color: var(--ot-line); padding: 8px 20px; }
.order-table-panel .pagination-summary { color: var(--ot-ink-soft); font-family: var(--ot-num); font-size: 14px; font-variant-numeric: tabular-nums; }
.order-table-panel #orders-back-to-latest { margin-left: auto; }
.order-table-panel .selected-order-label { font-size: 13px; }

.orders-table { min-width: 1104px; }
.orders-table th,
.orders-table td { border-bottom-color: var(--ot-line); padding: 16px 20px; }
.orders-table th {
	background: var(--ot-surface);
	padding-block: 11px;
	color: var(--ot-ink-soft);
	font-size: 13px;
	font-weight: 500;
	text-transform: none;
}
.orders-table th:first-child { width: 188px; background: var(--ot-surface); box-shadow: none; }
.orders-table td:first-child { background: var(--ot-surface); box-shadow: none; }
.orders-table th:nth-child(2) { width: 64px; }
.orders-table th:nth-child(3) { width: 150px; }
.orders-table th:nth-child(4) { width: 270px; }
.orders-table th:nth-child(5) { width: 128px; }
.orders-table th:nth-child(6) { width: 196px; }
.orders-table th:nth-child(7) { width: 112px; }
.orders-table th:last-child { width: 68px; }
.orders-table.is-order-product-search { min-width: 1216px; }
.orders-table.is-order-product-search th:first-child { width: 188px; }
.orders-table.is-order-product-search th:nth-child(2) { width: 112px; }
.orders-table.is-order-product-search th:nth-child(3) { width: 64px; }
.orders-table.is-order-product-search th:nth-child(4) { width: 150px; }
.orders-table.is-order-product-search th:nth-child(5) { width: 270px; }
.orders-table.is-order-product-search th:nth-child(6) { width: 128px; }
.orders-table.is-order-product-search th:nth-child(7) { width: 196px; }
.orders-table.is-order-product-search th:nth-child(8) { width: 112px; }
.orders-table.is-order-product-search th:last-child { width: 68px; }

/* 行的状态底色 */
.orders-table tbody tr:hover td,
.orders-table tbody tr:hover td:first-child { background: var(--ot-hover); }
.orders-table tbody tr.selected td,
.orders-table tbody tr.selected td:first-child { background: color-mix(in srgb, var(--ot-ink) 7%, var(--ot-surface)); }
.orders-table tbody tr.copied-order td,
.orders-table tbody tr.copied-order td:first-child,
.orders-table tbody tr.opened-order td,
.orders-table tbody tr.opened-order td:first-child { background: color-mix(in srgb, var(--ot-signal) 9%, var(--ot-surface)); }
.orders-table tbody tr.copied-order:hover td,
.orders-table tbody tr.copied-order:hover td:first-child,
.orders-table tbody tr.opened-order:hover td,
.orders-table tbody tr.opened-order:hover td:first-child { background: color-mix(in srgb, var(--ot-signal) 15%, var(--ot-surface)); }
/* 正在查看的订单：左侧一条橙色标记 */
.orders-table tbody tr.opened-order td:first-child { box-shadow: inset 3px 0 0 var(--ot-signal); }

/* 客户列：订单号 + 收货人 */
.order-customer-main { gap: 12px; }
.order-customer-main input { width: 20px; height: 20px; flex-basis: 20px; accent-color: var(--ot-ink); }
.order-customer .order-number { font-family: var(--ot-num); font-size: 16px; font-weight: 600; line-height: 1.4; }
.order-customer small { margin-top: 2px; padding-left: 32px; }
.order-customer .customer-name { color: var(--ot-ink-soft); font-size: 13px; }
/* 未读的新订单：订单号前一个橙色圆点 */
.orders-table tbody tr.unread-order .order-number::before {
	content: "";
	display: inline-block;
	width: 7px;
	height: 7px;
	margin-right: 6px;
	border-radius: 50%;
	background: var(--ot-signal);
	vertical-align: 2px;
}
.orders-table tbody tr.unread-order .order-number,
.orders-table tbody tr.unread-order .contact-email,
.orders-table tbody tr.unread-order .order-status,
.orders-table tbody tr.unread-order .order-amount { font-weight: 700; }

.order-date { color: var(--ot-ink-soft); font-family: var(--ot-num); font-size: 14px; font-variant-numeric: tabular-nums; }
.order-country { font-size: 14px; white-space: normal; }

/* 联系方式：邮箱 + 电话 */
.order-contact .contact-email { font-size: 15px; font-weight: 600; line-height: 1.4; }
.order-contact .phone-line { margin-top: 2px; color: var(--ot-ink-soft); font-family: var(--ot-num); font-size: 14px; }
.order-contact .contact-nickname { color: var(--ot-ink-soft); font-size: 13px; }

/* 付款：付款方式小字不上色，付款状态大字按状态上色（不再用圆角底色标签） */
.payment-status { gap: 1px; }
.payment-status .payment-name,
.payment-status .payment-name[class] { color: var(--ot-ink-soft); font-size: 13px; font-weight: 500; line-height: 1.4; }
.payment-status .order-status {
	justify-content: flex-start;
	border-radius: 0;
	background: none;
	padding: 0;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.4;
}
.payment-status .order-status.complete { color: var(--ot-green); }
.payment-status .order-status.processing { color: var(--ot-blue); }
.payment-status .order-status.pending { color: var(--ot-orange); }
.payment-status .order-status.unpaid,
.payment-status .order-status.failed { color: var(--ot-red); }
.payment-status .order-status.neutral { color: var(--ot-grey); }

.order-amount { font-family: var(--ot-num); font-size: 16px; font-weight: 600; }

.view-cell .icon-button { width: 40px; height: 40px; border-color: transparent; border-radius: 10px; background: transparent; color: var(--ot-ink-soft); }
.view-cell .icon-button:hover { background: var(--ot-line); color: var(--ot-ink); }

@media (max-width: 900px) {
	.orders-table th,
	.orders-table td { padding: 14px 14px; }
	.order-table-panel .pagination-bar { padding: 8px 14px; }
}

/* ---------- 深色外观：订单面板用设计稿的深色配色 ----------
   全站的深色目前是整页反色（见 nav-rail.css）。订单面板在这里再反一次抵消掉，
   然后直接用真正的深色配色，所以颜色和设计稿一致；面板里的图片不再额外处理。 */
html[data-theme="dark"] .order-table-panel {
	--ot-surface: #19201d;
	--ot-ink: #e8eeea;
	--ot-ink-soft: #9aa7a1;
	--ot-line: #2c3732;
	--ot-hover: #202925;
	--ot-signal: #ff7a45;
	--ot-green: #5fd094;
	--ot-blue: #7aa8ff;
	--ot-orange: #ff8a57;
	--ot-red: #ff7b83;
	--ot-grey: #9aa7a1;
	filter: invert(1) hue-rotate(180deg);
	color-scheme: dark;
}
html[data-theme="dark"] .order-table-panel :is(img, video, canvas, iframe) { filter: none; }
html[data-theme="dark"] .order-table-panel .button-primary,
html[data-theme="dark"] .order-table-panel .order-search-button { color: var(--ot-surface); }
html[data-theme="dark"] .order-table-panel :is(input, select) { background-color: var(--ot-hover); color: var(--ot-ink); }
html[data-theme="dark"] .order-table-panel .table-loading { border-color: var(--ot-line); border-top-color: var(--ot-ink); }

/* 表头固定：直接固定每个表头单元格（比只固定 thead 更稳，避免滚动时行内容从表头上沿透出来） */
.orders-table thead th { position: sticky; z-index: 4; top: 0; }
.orders-table thead th:first-child { z-index: 6; }

/* 表头不显示：列宽仍由表头单元格决定，所以只把它压成零高度，不能直接隐藏 */
.orders-table thead th {
	position: static;
	height: 0;
	overflow: hidden;
	border: 0;
	padding-block: 0;
	font-size: 0;
	line-height: 0;
}

/* 店铺图标：放在一个浅色小方块里，深色外观下深色的图标也看得清 */
.order-list-store-link {
	width: 36px;
	height: 36px;
	border-radius: 10px;
	background: #f1f3ef;
}
html[data-theme="dark"] .order-table-panel .order-list-store-link { background: #e8eeea; }

@media (max-width: 900px) {
	/* 手机端：国家、付款状态、金额三列排在最前面；整行一起左右滑动，不再固定第一列 */
	.orders-table,
	.orders-table tbody { display: block; width: max-content; min-width: 100%; }
	.orders-table thead { display: none; }
	.orders-table tbody tr { display: flex; align-items: center; border-bottom: 1px solid var(--ot-line); }
	.orders-table tbody tr:last-child { border-bottom: 0; }
	.orders-table tbody td,
	.orders-table tbody td:first-child { position: static; display: block; flex: 0 0 auto; border-bottom: 0; background: transparent; box-shadow: none; }
	.orders-table tbody tr.opened-order { box-shadow: inset 3px 0 0 var(--ot-signal); }
	.orders-table tbody tr:hover,
	.orders-table tbody tr.selected { background: var(--ot-hover); }
	.orders-table tbody tr.copied-order,
	.orders-table tbody tr.opened-order { background: color-mix(in srgb, var(--ot-signal) 9%, var(--ot-surface)); }
	.orders-table td.order-country { order: 1; width: 100px; padding-right: 6px; }
	.orders-table td.order-payment-cell { order: 2; width: 152px; padding-inline: 8px; }
	.orders-table td.order-amount { order: 3; width: 96px; padding-inline: 8px; }
	.orders-table td.order-customer-cell { order: 4; width: 196px; }
	.orders-table td.order-product-search-cell { order: 5; width: 124px; }
	.orders-table td.order-store-cell { order: 6; width: 64px; }
	.orders-table td.order-date { order: 7; width: 150px; }
	.orders-table td.order-contact-cell { order: 8; width: 262px; }
	.orders-table td.view-cell { order: 9; width: 68px; }
	/* 加载中 / 没有记录的整行提示 */
	.orders-table tbody td[colspan] { width: calc(100vw - 40px); }
}

/* 付款列：付款方式和付款状态同色；付款状态是小号的圆角标签（沿用原系统的层次） */
.payment-status { gap: 5px; }
.payment-status .payment-name,
.payment-status .payment-name[class] { color: var(--pay-color, var(--ot-ink-soft)); font-size: 14px; font-weight: 500; line-height: 1.35; }
.payment-status .order-status {
	border-radius: 99px;
	background: color-mix(in srgb, var(--pay-color, var(--ot-grey)) 13%, var(--ot-surface));
	padding: 3px 9px;
	color: var(--pay-color, var(--ot-grey));
	font-size: 12px;
	font-weight: 500;
	line-height: 1.4;
}
.payment-status .complete { --pay-color: var(--ot-green); }
.payment-status .processing { --pay-color: var(--ot-blue); }
.payment-status .pending { --pay-color: var(--ot-orange); }
.payment-status .unpaid,
.payment-status .failed { --pay-color: var(--ot-red); }
.payment-status .neutral { --pay-color: var(--ot-grey); }
.order-mobile-check { display: none; }

@media (max-width: 900px) {
	/* 手机端前三列：付款（左边带勾选框）、金额、国家；超出的文字用省略号，一屏正好三列 */
	.orders-table td.order-payment-cell { display: flex; order: 1; width: 154px; align-items: center; gap: 8px; padding-inline: 12px 4px; }
	.orders-table td.order-amount { order: 2; width: 88px; padding-inline: 6px; }
	.orders-table td.order-country { order: 3; width: 102px; overflow: hidden; padding-inline: 6px 10px; text-overflow: ellipsis; white-space: nowrap; }
	.order-mobile-check { display: block; width: 22px; height: 22px; flex: 0 0 22px; margin: 0; accent-color: var(--ot-ink); cursor: pointer; }
	.order-payment-cell .payment-status { min-width: 0; flex: 1 1 auto; }
	.order-payment-cell .payment-name { max-width: 100%; }
	.order-customer-main input { display: none; }
	.order-customer small { padding-left: 0; }
}
@media (max-width: 900px) {
	.order-payment-cell .payment-status .payment-name { font-size: 13px; }
}
