/* 比价精灵 · 统一设计基底
   三个页面共用：跟随系统深浅色、移动端可用、数据密度偏紧凑 */

:root {
	--brand: #ff6a00;
	--brand-weak: #fff4ec;
	--bg: #f5f6f8;
	--surface: #ffffff;
	--surface-2: #fafbfc;
	--line: #e6e8ec;
	--line-strong: #d4d8de;
	--txt: #16181d;
	--txt-2: #4b5563;
	--txt-3: #8b929e;
	--red: #e02020;
	--green: #0a8a4a;
	--amber: #b45309;
	--blue: #2563eb;
	--shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
	--radius: 12px;
	--radius-sm: 8px;
}

@media (prefers-color-scheme: dark) {
	:root {
		--brand: #ff7d1f;
		--brand-weak: #2a1a0d;
		--bg: #0f1115;
		--surface: #171a20;
		--surface-2: #1c2027;
		--line: #262b33;
		--line-strong: #333a45;
		--txt: #e8eaed;
		--txt-2: #b0b6c0;
		--txt-3: #7c8493;
		--red: #ff6b6b;
		--green: #3ddc97;
		--amber: #f0b429;
		--blue: #6ba3f8;
		--shadow: 0 1px 3px rgba(0, 0, 0, .4);
	}
}

* { box-sizing: border-box; }

body {
	margin: 0;
	background: var(--bg);
	color: var(--txt);
	font: 15px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
	-webkit-font-smoothing: antialiased;
}

/* ---------- 布局 ---------- */
.wrap { max-width: 1080px; margin: 0 auto; padding: 20px 16px 64px; }
.wrap-narrow { max-width: 880px; }

.page-head { margin-bottom: 18px; }
.page-head h1 { font-size: 20px; font-weight: 650; margin: 0 0 3px; letter-spacing: -.01em; }
.page-head .desc { color: var(--txt-3); font-size: 13px; }

.card {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 16px;
	margin-bottom: 14px;
	box-shadow: var(--shadow);
}
.card > h2 {
	font-size: 14px; font-weight: 650; margin: 0 0 12px;
	display: flex; align-items: center; gap: 8px;
}
.card > h2 .hint { font-weight: 400; color: var(--txt-3); font-size: 12px; }

.grid { display: grid; gap: 12px; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.spacer { flex: 1; }

/* ---------- 指标卡 ---------- */
.stat {
	background: var(--surface); border: 1px solid var(--line);
	border-radius: var(--radius); padding: 14px 15px;
}
.stat .label { font-size: 12px; color: var(--txt-3); margin-bottom: 5px; }
.stat .value { font-size: 24px; font-weight: 650; letter-spacing: -.02em; line-height: 1.2; }
.stat .value.money { color: var(--red); }
.stat .value.ok { color: var(--green); }
.stat .sub { font-size: 12px; color: var(--txt-3); margin-top: 3px; }
.stat.alert { border-color: color-mix(in srgb, var(--amber) 40%, var(--line)); }
.stat.alert .value { color: var(--amber); }

/* ---------- 控件 ---------- */
button, .btn {
	background: var(--brand); color: #fff; border: 0;
	border-radius: var(--radius-sm); padding: 8px 17px;
	font-size: 14px; font-weight: 600; cursor: pointer;
	font-family: inherit; transition: filter .12s;
}
button:hover:not(:disabled) { filter: brightness(1.06); }
button:active:not(:disabled) { filter: brightness(.95); }
button:disabled { opacity: .45; cursor: default; }
button.ghost { background: var(--surface-2); color: var(--txt-2); border: 1px solid var(--line); }
button.ghost:hover:not(:disabled) { border-color: var(--line-strong); filter: none; }
button.danger { background: var(--red); }
button.sm { padding: 5px 12px; font-size: 13px; }

input, textarea, select {
	background: var(--surface); color: var(--txt);
	border: 1px solid var(--line); border-radius: var(--radius-sm);
	padding: 8px 11px; font: 14px inherit; outline: none;
	transition: border-color .12s;
}
input:focus, textarea:focus, select:focus { border-color: var(--brand); }
input::placeholder, textarea::placeholder { color: var(--txt-3); }
textarea { width: 100%; min-height: 68px; resize: vertical; line-height: 1.55; }
label.field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--txt-3); }

/* ---------- 标签 ---------- */
.tag {
	display: inline-flex; align-items: center;
	padding: 2px 8px; border-radius: 5px;
	font-size: 11px; font-weight: 600; line-height: 1.5;
	background: var(--surface-2); color: var(--txt-2); border: 1px solid var(--line);
}
.tag.ok { background: color-mix(in srgb, var(--green) 12%, transparent); color: var(--green); border-color: transparent; }
.tag.bad { background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--red); border-color: transparent; }
.tag.warn { background: color-mix(in srgb, var(--amber) 14%, transparent); color: var(--amber); border-color: transparent; }
.tag.info { background: color-mix(in srgb, var(--blue) 12%, transparent); color: var(--blue); border-color: transparent; }

.pf { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 4px; margin-right: 5px; }
.pf-taobao { background: #fff0e6; color: #e64a19; }
.pf-jd { background: #fdeaea; color: #d32f2f; }
.pf-pdd { background: #fdecef; color: #c62828; }
@media (prefers-color-scheme: dark) {
	.pf-taobao { background: #3a2416; color: #ff9d6b; }
	.pf-jd { background: #3a1e1e; color: #ff8a80; }
	.pf-pdd { background: #3a1c22; color: #ff8fa3; }
}

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
	text-align: left; font-weight: 600; color: var(--txt-3); font-size: 12px;
	padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

/* ---------- 反馈 ---------- */
.notice {
	padding: 10px 13px; border-radius: var(--radius-sm); font-size: 13px;
	background: color-mix(in srgb, var(--blue) 8%, transparent);
	border: 1px solid color-mix(in srgb, var(--blue) 25%, transparent);
	color: var(--blue);
}
.notice.warn {
	background: color-mix(in srgb, var(--amber) 10%, transparent);
	border-color: color-mix(in srgb, var(--amber) 30%, transparent);
	color: var(--amber);
}
.empty { color: var(--txt-3); font-size: 13px; text-align: center; padding: 26px 0; }

.log {
	background: #0d0f13; color: #ced4de; border-radius: var(--radius-sm);
	padding: 12px 14px; max-height: 260px; overflow: auto;
	font: 12px/1.7 ui-monospace, SFMono-Regular, Menlo, monospace;
	white-space: pre-wrap; word-break: break-all;
}
.log .t { color: #5f6875; }
.log .ok { color: #4ade80; }
.log .err { color: #f87171; }
.log .hl { color: #fbbf24; }

/* ---------- 加载 ---------- */
.skeleton {
	background: linear-gradient(90deg, var(--surface-2) 25%, var(--line) 37%, var(--surface-2) 63%);
	background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: 5px;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

.spin {
	width: 15px; height: 15px; border: 2px solid var(--line);
	border-top-color: var(--brand); border-radius: 50%;
	animation: rot .7s linear infinite; display: inline-block; vertical-align: -2px;
}
@keyframes rot { to { transform: rotate(360deg); } }

/* ---------- 小字 ---------- */
.small { font-size: 12px; color: var(--txt-3); }
.muted { color: var(--txt-3); }
.money { color: var(--red); font-weight: 650; font-variant-numeric: tabular-nums; }
.pos { color: var(--green); }

@media (max-width: 640px) {
	.wrap { padding: 14px 12px 48px; }
	.stat .value { font-size: 21px; }
	.card { padding: 14px; }
}
