/* 尚新商城 · 独立管理后台样式（自建，不依赖第三方前端库） */
:root {
	--brand: #c8102e;
	--brand-dark: #a30d25;
	--bg: #f4f5f7;
	--panel: #ffffff;
	--text: #23262b;
	--muted: #8a9099;
	--line: #e6e8eb;
	--radius: 6px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
	background: var(--bg);
	color: var(--text);
	font: 14px/1.6 -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono {
	font-family: Menlo, Consolas, "Courier New", monospace;
	font-size: 12px;
}

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
	width: 220px;
	flex: 0 0 220px;
	background: #23262b;
	color: #c9cdd4;
	display: flex;
	flex-direction: column;
	position: sticky;
	top: 0;
	height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px; border-bottom: 1px solid #32363d; }
.brand-mark {
	display: inline-block;
	background: var(--brand);
	color: #fff;
	font-weight: 700;
	font-size: 13px;
	padding: 4px 8px;
	border-radius: 4px;
	letter-spacing: 1px;
}
.brand-text { font-size: 13px; color: #e9ebee; }
.menu { flex: 1; overflow-y: auto; padding: 12px 0; }
.menu-group {
	padding: 12px 16px 6px;
	font-size: 11px;
	color: #6f7681;
	letter-spacing: 1px;
}
.menu-item {
	display: block;
	padding: 9px 16px;
	color: #c9cdd4;
	font-size: 13px;
	border-left: 3px solid transparent;
}
.menu-item:hover { background: #2b2f36; color: #fff; text-decoration: none; }
.menu-item.active { background: #2b2f36; color: #fff; border-left-color: var(--brand); }
/* 可折叠栏目组 */
.menu-fold { margin: 0; }
.menu-summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	cursor: pointer;
	user-select: none;
	list-style: none;
	padding: 12px 16px 6px;
}
.menu-summary::-webkit-details-marker { display: none; }
.menu-summary:hover { color: #c9cdd4; }
.menu-summary::before { content: '▸'; font-size: 9px; margin-right: 6px; color: #6f7681; }
.menu-fold[open] > .menu-summary::before { content: '▾'; }
.menu-fold[open] > .menu-summary { color: #e9ebee; }
.menu-count { font-size: 10px; color: #6f7681; font-variant-numeric: tabular-nums; }
.menu-browse { padding-left: 26px; font-size: 12px; color: #8b929c; }
.menu-fold .menu-item { padding-left: 26px; }
.menu-item-na { color: #6f7681; }
.menu-dot { margin-left: 6px; color: #4b5058; }
.sidebar-foot { padding: 12px 16px; font-size: 11px; color: #6f7681; border-top: 1px solid #32363d; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
	background: #fff;
	border-bottom: 1px solid var(--line);
	padding: 0 20px;
	height: 56px;
	display: flex;
	align-items: center;
	justify-content: space-between;
}
.page-title { font-size: 16px; margin: 0; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.who { color: var(--muted); font-size: 13px; }
.content { padding: 18px 20px 40px; }

/* ---------- 按钮 ---------- */
.btn {
	display: inline-block;
	padding: 7px 14px;
	border-radius: var(--radius);
	border: 1px solid var(--line);
	background: #fff;
	color: var(--text);
	font-size: 13px;
	cursor: pointer;
	line-height: 1.4;
}
.btn:hover { text-decoration: none; border-color: #c9cdd4; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-ghost { background: transparent; }
.btn-block { display: block; width: 100%; padding: 10px; font-size: 14px; }

/* ---------- 卡片 ---------- */
.cards {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
	gap: 14px;
	margin-bottom: 18px;
}
.card {
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 16px;
}
.card-label { color: var(--muted); font-size: 12px; }
.card-value { font-size: 26px; font-weight: 600; margin: 6px 0 4px; letter-spacing: -0.5px; }
.card-sub { color: var(--muted); font-size: 12px; }

/* ---------- 面板 ---------- */
.panels { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
@media (max-width: 900px) { .panels { grid-template-columns: 1fr; } }
.panel {
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 16px;
	margin-bottom: 18px;
}
.panel-title { font-size: 14px; margin: 0 0 12px; font-weight: 600; }
.panel-sub { color: var(--muted); font-size: 12px; font-weight: 400; margin-left: 8px; }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table thead th { color: var(--muted); font-weight: 500; font-size: 12px; background: #fafbfc; }
.table tbody tr:hover { background: #fafbfc; }
.table .num { text-align: right; }
.table .empty { text-align: center; color: var(--muted); padding: 28px 0; }
.w80 { width: 80px; }
.w180 { width: 180px; }

/* ---------- 标签 ---------- */
.tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; line-height: 1.5; }
.tag-ok { background: #e8f6ed; color: #1a7f45; }
.tag-warn { background: #fff6e5; color: #a86a00; }
.tag-danger { background: #fdecec; color: #c8102e; }
.tag-info { background: #e9f1fd; color: #1b62c4; }
.tag-muted { background: #f0f1f3; color: #6f7681; }

/* ---------- 筛选条 ---------- */
.filterbar {
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 12px 14px;
	margin-bottom: 16px;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}
.filter-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-form label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.filter-form select, .filter-form input[type=text] {
	padding: 6px 10px;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	font-size: 13px;
	background: #fff;
	color: var(--text);
}
.tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.tab {
	padding: 6px 12px;
	border-radius: var(--radius);
	border: 1px solid var(--line);
	background: #fff;
	color: var(--text);
	font-size: 13px;
}
.tab:hover { text-decoration: none; border-color: #c9cdd4; }
.tab.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.tab-cnt { margin-left: 6px; opacity: .75; font-size: 12px; }

/* ---------- 图表 ---------- */
.chart { display: flex; align-items: flex-end; gap: 6px; height: 170px; padding-top: 8px; }
.chart-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; text-align: center; }
.chart-bar { background: linear-gradient(180deg, #e0414f, var(--brand)); border-radius: 3px 3px 0 0; min-height: 2px; transition: opacity .15s; }
.chart-col:hover .chart-bar { opacity: .75; }
.chart-x { font-size: 10px; color: var(--muted); margin-top: 6px; white-space: nowrap; }

/* ---------- 分页 ---------- */
.pager { display: flex; gap: 6px; justify-content: flex-end; margin-top: 14px; }
.page-link {
	padding: 5px 10px;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: #fff;
	font-size: 13px;
	color: var(--text);
}
.page-link:hover { text-decoration: none; border-color: #c9cdd4; }
.page-link.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- 键值网格 ---------- */
.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.kv { background: #fafbfc; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.kv span { display: block; color: var(--muted); font-size: 12px; }
.kv strong { font-size: 14px; font-weight: 600; }
.text { margin: 0 0 12px; }
.text-muted { color: var(--muted); }
.link { font-size: 13px; }

/* ---------- 详情页 ---------- */
.detail-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 16px;
	flex-wrap: wrap;
}
.detail-ordersn { font-size: 15px; font-weight: 600; margin-left: 8px; }

/* ---------- 登录页 ---------- */
.login-body {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 100vh;
	background: linear-gradient(135deg, #23262b 0%, #3a3f47 100%);
}
.login-card {
	width: 360px;
	background: #fff;
	border-radius: 10px;
	padding: 30px 28px;
	box-shadow: 0 12px 40px rgba(0,0,0,.28);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login-brand .brand-mark { font-size: 15px; padding: 6px 10px; }
.login-brand-text strong { display: block; font-size: 17px; }
.login-brand-text span { color: var(--muted); font-size: 12px; }
.field { display: block; margin-bottom: 16px; }
.field-label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	font-size: 14px;
	background: #fafbfc;
}
.field input:focus { outline: none; border-color: var(--brand); background: #fff; }
.alert { padding: 10px 12px; border-radius: var(--radius); font-size: 13px; margin-bottom: 16px; }
.alert-error { background: #fdecec; color: #c8102e; border: 1px solid #f7cfd3; }
.login-tip { color: var(--muted); font-size: 12px; text-align: center; margin: 16px 0 0; }

/* ===================== 新增：通用列表 / 报表 / 设置 组件 ===================== */

/* 表格横向滚动容器（宽表不撑破布局） */
.table-wrap { overflow-x: auto; }

/* 表头小字与说明文字 */
.hint {
	color: var(--muted);
	font-size: 12px;
	line-height: 1.8;
	margin: 8px 0 12px;
}
.hint code {
	background: #f0f1f3;
	padding: 1px 5px;
	border-radius: 3px;
	font-size: 12px;
}
.notice {
	border-radius: 6px;
	padding: 14px 16px;
	margin: 12px 0;
}
.notice-warn { background: #fff6e5; border: 1px solid #f0dcb4; }
.notice .text { margin: 0; }

/* 缩略图 */
.thumb {
	width: 42px;
	height: 42px;
	object-fit: cover;
	border-radius: 4px;
	border: 1px solid var(--line);
	background: #f7f8fa;
}
.thumb-lg { max-width: 320px; max-height: 240px; border-radius: 6px; border: 1px solid var(--line); }

/* 详情表 */
.table-detail th.detail-label {
	width: 240px;
	text-align: left;
	font-weight: 600;
	color: #3c4048;
	background: #fafbfc;
	vertical-align: top;
}
.detail-field {
	display: block;
	font-weight: 400;
	font-size: 11px;
	color: var(--muted);
	font-family: ui-monospace, Menlo, Consolas, monospace;
}
.detail-pre {
	margin: 0;
	padding: 10px;
	background: #f7f8fa;
	border: 1px solid var(--line);
	border-radius: 4px;
	font-size: 12px;
	max-height: 360px;
	overflow: auto;
	white-space: pre-wrap;
	word-break: break-all;
}
.row-na { background: #fbfbfc; }

/* 指标卡片 */
.metric-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
	gap: 12px;
	margin: 14px 0 18px;
}
.metric {
	background: #fff;
	border: 1px solid var(--line);
	border-radius: 8px;
	padding: 14px 16px;
}
.metric-v { font-size: 22px; font-weight: 700; color: #1f2328; font-variant-numeric: tabular-nums; }
.metric-t { font-size: 13px; color: #3c4048; margin-top: 4px; }
.metric-h { font-size: 11px; color: var(--muted); margin-top: 6px; line-height: 1.6; }

/* 条形图 */
.bars { margin: 12px 0 18px; }
.bar-row { display: flex; align-items: center; gap: 10px; padding: 2px 0; }
.bar-label {
	width: 110px;
	font-size: 12px;
	color: var(--muted);
	text-align: right;
	flex: none;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.bar-track { flex: 1; height: 14px; background: #f0f1f3; border-radius: 7px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--brand); border-radius: 7px; min-width: 2px; }
.bar-value {
	width: 110px;
	font-size: 12px;
	color: #3c4048;
	font-variant-numeric: tabular-nums;
	flex: none;
}
.btn-sm { padding: 3px 10px; font-size: 12px; }
