/* ── 暗夜模式（默认） ── */
:root,
[data-theme="dark"] {
	color-scheme: dark;
	--bg: #111318;
	--bg-elevated: #181b22;
	--card: #1c2028;
	--card-inner: #22262f;
	--text: #d4dae4;
	--text-secondary: #8b95a8;
	--muted: #6b7589;
	--primary: #6b8cce;
	--primary-hover: #7d9cd8;
	--danger: #c75454;
	--warning: #b8935a;
	--success: #5a9a6e;
	--border: #2a3040;
	--border-light: #343b4d;
	--shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
	--mask: rgba(0, 0, 0, 0.55);
	--chart-grid: #2a3040;
	--chart-line: #6b8cce;
	--chart-gmv: #5a9a6e;
	--chart-dot-fill: #1c2028;
	--btn-text: #e8edf5;
	--btn-danger-bg: #3d2020;
	--btn-danger-border: #5c3030;
	--btn-danger-text: #e8a0a0;
	--btn-danger-hover: #4d2828;
	--tag-danger-bg: #2a1818;
	--tag-danger-border: #4a2828;
	--tag-danger-text: #d08080;
	--tag-pending-bg: #2a2418;
	--tag-pending-border: #4a3d20;
	--tag-success-bg: #1a2a1e;
	--tag-success-border: #2a4030;
	--tag-success-text: #8ec49a;
	--alert-error-bg: #2a1818;
	--alert-error-border: #4a2828;
	--alert-error-text: #d08080;
	--alert-success-bg: #1a2a1e;
	--alert-success-border: #2a4030;
	--alert-success-text: #8ec49a;
	--notice-bg: #2a2418;
	--notice-border: #4a3d20;
	--alert-chip-warn-border: #4a3d20;
	--alert-chip-danger-border: #4a2828;
	--alert-chip-danger-text: #d08080;
	--dot-users: #7a6b9a;
	--pie-0: #6b8cce;
	--pie-1: #5a9a6e;
	--pie-2: #b8935a;
	--pie-3: #7a6b9a;
	--pie-4: #5a8a9a;
	--pie-5: #9a6b8a;
	--pie-6: #8a7a5a;
	--pie-7: #6a7a9a;
}

/* ── 白天模式 ── */
[data-theme="light"] {
	color-scheme: light;
	--bg: #e8ebf0;
	--bg-elevated: #f2f4f8;
	--card: #fafbfc;
	--card-inner: #eef1f6;
	--text: #1e2836;
	--text-secondary: #5c6778;
	--muted: #7a8698;
	--primary: #4a6fa5;
	--primary-hover: #3d5f8f;
	--danger: #a84848;
	--warning: #9a7a42;
	--success: #4a8058;
	--border: #d4dae3;
	--border-light: #c2cad6;
	--shadow: 0 2px 12px rgba(30, 40, 54, 0.08);
	--mask: rgba(30, 40, 54, 0.4);
	--chart-grid: #d4dae3;
	--chart-line: #4a6fa5;
	--chart-gmv: #4a8058;
	--chart-dot-fill: #fafbfc;
	--btn-text: #f5f7fa;
	--btn-danger-bg: #f3e8e8;
	--btn-danger-border: #e0c8c8;
	--btn-danger-text: #a84848;
	--btn-danger-hover: #ead8d8;
	--tag-danger-bg: #f5ecec;
	--tag-danger-border: #e8d4d4;
	--tag-danger-text: #a84848;
	--tag-pending-bg: #f5f0e6;
	--tag-pending-border: #e8dcc8;
	--tag-success-bg: #eaf2ec;
	--tag-success-border: #cce0d0;
	--tag-success-text: #4a8058;
	--alert-error-bg: #f5ecec;
	--alert-error-border: #e8d4d4;
	--alert-error-text: #a84848;
	--alert-success-bg: #eaf2ec;
	--alert-success-border: #cce0d0;
	--alert-success-text: #4a8058;
	--notice-bg: #f5f0e6;
	--notice-border: #e8dcc8;
	--alert-chip-warn-border: #e8dcc8;
	--alert-chip-danger-border: #e8d4d4;
	--alert-chip-danger-text: #a84848;
	--dot-users: #6a5a8a;
	--pie-0: #4a6fa5;
	--pie-1: #4a8058;
	--pie-2: #9a7a42;
	--pie-3: #6a5a8a;
	--pie-4: #4a7a8a;
	--pie-5: #8a6a7a;
	--pie-6: #7a6a4a;
	--pie-7: #5a6a8a;
}

:root {
	--radius: 10px;
	--radius-lg: 12px;
	--page-width: 1320px;
	--sidebar-width: 220px;
	--topbar-height: 60px;
}

* { box-sizing: border-box; }

html, body {
	height: 100%;
	background: var(--bg);
}

body {
	margin: 0;
	font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
	color: var(--text);
	font-size: 14px;
	line-height: 1.55;
	-webkit-font-smoothing: antialiased;
	transition: background-color 0.2s ease, color 0.2s ease;
	overflow: hidden;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

h1, h2, h3, h4 { margin: 0; color: var(--text); font-weight: 600; }
p { margin: 0; }

/* ── Auth ── */
.auth-page {
	min-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: var(--bg);
}
.auth-card {
	width: 100%;
	max-width: 400px;
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	padding: 36px 32px;
	box-shadow: var(--shadow);
}
.auth-card h1 { margin-bottom: 6px; font-size: 22px; }
.auth-card p { margin-bottom: 28px; color: var(--text-secondary); }

/* ── Shell layout ── */
.layout {
	display: flex;
	height: 100vh;
	height: 100dvh;
	background: var(--bg);
	overflow: hidden;
}
.sidebar {
	width: var(--sidebar-width);
	height: 100%;
	background: var(--bg-elevated);
	border-right: 1px solid var(--border);
	padding: 20px 14px;
	flex-shrink: 0;
	overflow-x: hidden;
	overflow-y: auto;
	transition: width 0.3s ease, padding 0.3s ease;
	display: flex;
	flex-direction: column;
}
.layout.sidebar-collapsed .sidebar {
	width: 0;
	padding-left: 0;
	padding-right: 0;
	border-right-color: transparent;
}
.layout.sidebar-collapsed .sidebar .brand,
.layout.sidebar-collapsed .sidebar nav {
	opacity: 0;
	pointer-events: none;
}
.sidebar .brand {
	font-size: 15px;
	font-weight: 600;
	margin-bottom: 24px;
	padding: 0 10px;
	color: var(--text);
	white-space: nowrap;
	letter-spacing: 0.02em;
}
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a {
	display: block;
	padding: 10px 12px;
	border-radius: 8px;
	color: var(--text-secondary);
	font-size: 14px;
	transition: background 0.15s, color 0.15s;
}
.sidebar nav a:hover {
	background: var(--card);
	color: var(--text);
}
.sidebar nav a.active {
	background: var(--card-inner);
	color: var(--text);
	font-weight: 500;
}

.main {
	flex: 1;
	display: flex;
	flex-direction: column;
	min-width: 0;
	min-height: 0;
	overflow: hidden;
}

.topbar {
	height: var(--topbar-height);
	flex-shrink: 0;
	display: flex;
	align-items: center;
	border-bottom: 1px solid var(--border);
	background: var(--bg-elevated);
	padding: 0 24px;
}
.topbar-inner {
	width: 100%;
	max-width: var(--page-width);
	margin: 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}
.topbar-title {
	display: flex;
	align-items: center;
	gap: 12px;
}
.topbar-title strong { font-size: 16px; font-weight: 600; }
.topbar .actions {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-shrink: 0;
}
.topbar .actions > span {
	color: var(--text-secondary);
	font-size: 13px;
	white-space: nowrap;
}

.sidebar-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: var(--card);
	color: var(--text-secondary);
	cursor: pointer;
	padding: 0;
	transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.sidebar-toggle:hover {
	background: var(--card-inner);
	border-color: var(--border-light);
	color: var(--text);
}

.content {
	flex: 1;
	min-height: 0;
	padding: 24px;
	overflow-x: auto;
	overflow-y: auto;
	overscroll-behavior: contain;
}
.page {
	width: 100%;
	max-width: var(--page-width);
	margin: 0 auto;
}

/* ── Cards & stats ── */
.card {
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	padding: 20px;
	transition: background-color 0.2s ease, border-color 0.2s ease;
}
.card + .card,
.card + .stats,
.stats + .card { margin-top: 16px; }
.card h3 { font-size: 15px; margin-bottom: 0; }
.card-sub {
	background: var(--card-inner);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 16px;
	margin-bottom: 16px;
}
.card-sub h4 { font-size: 14px; margin-bottom: 12px; }

.stats {
	display: grid;
	gap: 14px;
}
.stats-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stats-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.stats-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }

.stat-item {
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	padding: 18px 20px;
	display: flex;
	flex-direction: column;
	justify-content: center;
	min-height: 88px;
}
.stat-item > span {
	font-size: 13px;
	color: var(--text-secondary);
}
.stat-item strong {
	display: block;
	font-size: 26px;
	font-weight: 600;
	margin-top: 6px;
	color: var(--text);
	letter-spacing: -0.02em;
}

.mt-16 { margin-top: 16px; }

/* ── Toolbar & filters ── */
.toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 16px;
	gap: 12px;
	flex-wrap: wrap;
}
.page-title { font-size: 16px; font-weight: 600; }
.toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.page-hint {
	margin: -8px 0 16px;
	font-size: 13px;
	color: var(--muted);
	line-height: 1.5;
}
.import-hint {
	font-size: 12px;
	color: var(--muted);
	line-height: 1.6;
	margin: 0 0 12px;
}
.import-hint code {
	font-size: 11px;
	background: var(--card-inner);
	padding: 1px 5px;
	border-radius: 4px;
}
.field-hint {
	margin: 4px 0 0;
	font-size: 11px;
	color: var(--muted);
}
.text-truncate-md {
	max-width: 320px;
}
.aftersale-meta {
	margin-bottom: 14px;
	padding: 12px 14px;
	border-radius: 10px;
	background: var(--card-inner);
	border: 1px solid var(--border);
	font-size: 13px;
	line-height: 1.7;
	color: var(--text-secondary);
}
.aftersale-meta p { margin: 0; }
.aftersale-meta strong { color: var(--text); font-weight: 500; }

.filters {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	margin-bottom: 16px;
}
.filters select,
.filters input[type="date"],
.filters input[type="text"] {
	width: auto;
	min-width: 140px;
}
.filter-sep { color: var(--muted); font-size: 13px; }

.order-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
	margin-bottom: 16px;
}
.order-toolbar .status-tabs {
	margin-bottom: 0;
	flex: 1;
	min-width: 0;
}
.order-toolbar .filters {
	margin-bottom: 0;
	flex-shrink: 0;
}
.filters-inline {
	gap: 6px;
}
.filters-inline select,
.filters-inline input[type="date"] {
	min-width: 108px;
	padding: 6px 8px;
	font-size: 12px;
	border-radius: 8px;
}
.filters-inline .filter-sep { font-size: 11px; }
.filters-inline .btn-secondary {
	padding: 6px 12px;
	font-size: 12px;
}

.status-tabs {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-wrap: wrap;
	margin-bottom: 16px;
}
.status-tab {
	display: inline-flex;
	align-items: center;
	padding: 7px 14px;
	border-radius: 8px;
	border: 1px solid var(--border);
	background: var(--card);
	color: var(--text-secondary);
	text-decoration: none;
	font-size: 13px;
	transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.status-tab:hover {
	border-color: var(--border-light);
	color: var(--text);
	background: var(--card-inner);
}
.status-tab.active {
	background: var(--card-inner);
	border-color: var(--primary);
	color: var(--text);
	font-weight: 500;
}

/* ── Table ── */
.table-wrap { overflow-x: auto; }

/* 大屏表格：固定框架高度，内容区内滚动 */
.card-panel-scroll {
	display: flex;
	flex-direction: column;
	overflow: hidden;
}
.card-panel-scroll .card-head,
.card-panel-scroll .bottom-head,
.card-panel-scroll .usage-legend-inline {
	flex-shrink: 0;
}
.panel-scroll-body {
	flex: 1;
	min-height: 0;
	max-height: 260px;
	overflow: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
}
.panel-scroll-usage {
	max-height: 240px;
}
.table-sticky-head thead th {
	position: sticky;
	top: 0;
	z-index: 2;
	background: var(--card);
	box-shadow: 0 1px 0 var(--border);
}
.panel-scroll-body .table { margin: 0; }
.panel-scroll-body .table tbody tr:last-child td { border-bottom: none; }
.table {
	width: 100%;
	border-collapse: collapse;
}
.table th,
.table td {
	padding: 11px 12px;
	border-bottom: 1px solid var(--border);
	text-align: left;
	vertical-align: middle;
}
.table th {
	color: var(--text-secondary);
	font-weight: 500;
	font-size: 12px;
	text-transform: none;
	letter-spacing: 0.02em;
	white-space: nowrap;
}
.table tbody tr:last-child td { border-bottom: none; }
.table td { font-size: 13px; color: var(--text); }
.text-truncate {
	max-width: 160px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.text-truncate-sm { max-width: 120px; }
.text-muted { color: var(--text-secondary); }
.text-danger { color: var(--tag-danger-text); }
.pagination-hint {
	margin-top: 12px;
	color: var(--muted);
	font-size: 13px;
}

/* ── Forms ── */
.form-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 16px;
}
.form-group {
	display: flex;
	flex-direction: column;
	gap: 6px;
}
.form-group.full { grid-column: 1 / -1; }
label { font-weight: 500; color: var(--text-secondary); font-size: 13px; }

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
	width: 100%;
	padding: 9px 12px;
	border: 1px solid var(--border);
	border-radius: 8px;
	font: inherit;
	background: var(--bg-elevated);
	color: var(--text);
	transition: border-color 0.15s;
}
input:focus,
select:focus,
textarea:focus {
	outline: none;
	border-color: var(--primary);
}
textarea { min-height: 88px; resize: vertical; }

.password-field {
	position: relative;
	display: block;
	width: 100%;
}
.password-field input {
	padding-right: 42px;
}
.password-toggle {
	position: absolute;
	top: 50%;
	right: 8px;
	transform: translateY(-50%);
	width: 32px;
	height: 32px;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: var(--text-secondary);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	padding: 0;
}
.password-toggle:hover {
	color: var(--primary);
	background: color-mix(in srgb, var(--primary) 10%, transparent);
}
.field-hint {
	margin: 6px 0 0;
	font-size: 12px;
	color: var(--text-secondary);
	line-height: 1.45;
}
.secret-textarea.secret-masked {
	-webkit-text-security: disc;
	text-security: disc;
}
.secret-reveal {
	margin-top: 10px;
}
.checkbox {
	display: flex;
	align-items: center;
	gap: 8px;
	font-weight: 400;
	color: var(--text);
}

/* ── Buttons ── */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 8px 16px;
	border-radius: 8px;
	border: 1px solid transparent;
	font: inherit;
	font-size: 13px;
	cursor: pointer;
	background: var(--primary);
	color: var(--btn-text);
	transition: background 0.15s, border-color 0.15s;
	white-space: nowrap;
}
.btn:hover { background: var(--primary-hover); }
.btn-secondary {
	background: var(--card-inner);
	border-color: var(--border);
	color: var(--text);
}
.btn-secondary:hover {
	background: var(--border);
	border-color: var(--border-light);
}
.btn-danger {
	background: var(--btn-danger-bg);
	border-color: var(--btn-danger-border);
	color: var(--btn-danger-text);
}
.btn-danger:hover { background: var(--btn-danger-hover); }
.btn-link {
	background: transparent;
	border: none;
	color: var(--primary);
	padding: 0;
	cursor: pointer;
	font: inherit;
	font-size: 13px;
}
.btn-link:hover { color: var(--primary-hover); }
.btn-block { width: 100%; }
.actions {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

/* ── Tags & alerts ── */
.tag {
	display: inline-flex;
	align-items: center;
	padding: 2px 8px;
	border-radius: 6px;
	font-size: 12px;
	background: var(--card-inner);
	border: 1px solid var(--border);
	color: var(--text-secondary);
}
.tag-muted {
	background: transparent;
	border-color: var(--border);
	color: var(--muted);
}
.tag-pending {
	background: var(--tag-pending-bg);
	border-color: var(--tag-pending-border);
	color: var(--warning);
}
.tag-danger {
	background: var(--tag-danger-bg);
	border-color: var(--tag-danger-border);
	color: var(--tag-danger-text);
}
.tag-success {
	background: var(--tag-success-bg);
	border-color: var(--tag-success-border);
	color: var(--tag-success-text);
}

.alert {
	padding: 11px 14px;
	border-radius: 8px;
	margin-bottom: 16px;
	border: 1px solid var(--border);
	font-size: 13px;
}
.alert-error {
	background: var(--alert-error-bg);
	border-color: var(--alert-error-border);
	color: var(--alert-error-text);
}
.alert-success {
	background: var(--alert-success-bg);
	border-color: var(--alert-success-border);
	color: var(--alert-success-text);
}
.notice-banner {
	background: var(--notice-bg);
	border: 1px solid var(--notice-border);
	border-radius: var(--radius);
	padding: 14px 16px;
	margin-bottom: 16px;
}
.notice-banner p { color: var(--text-secondary); margin-bottom: 12px; }

/* ── Thumbnails ── */
.thumb {
	width: 36px;
	height: 36px;
	border-radius: 8px;
	object-fit: cover;
	background: var(--card-inner);
	border: 1px solid var(--border);
	display: block;
}
.thumb-placeholder {
	width: 36px;
	height: 36px;
	border-radius: 8px;
	background: var(--card-inner);
	border: 1px solid var(--border);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 13px;
	color: var(--text-secondary);
	font-weight: 500;
}

/* ── Dashboard ── */
.dashboard-main {
	display: grid;
	grid-template-columns: 1fr 300px;
	gap: 14px;
	align-items: stretch;
}
.chart-wrap { margin-top: 0; }
.card-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 12px;
}
.chart-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	flex-wrap: wrap;
	margin-bottom: 8px;
}
.chart-head h3 { flex-shrink: 0; }
.chart-head-actions {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
	justify-content: flex-end;
	margin-left: auto;
}
.chart-range { display: flex; gap: 4px; flex-wrap: nowrap; }
.range-btn {
	border: 1px solid var(--border);
	background: var(--card-inner);
	color: var(--text-secondary);
	padding: 4px 10px;
	border-radius: 6px;
	font-size: 12px;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.range-btn:hover { border-color: var(--border-light); color: var(--text); }
.range-btn.active { background: var(--card); border-color: var(--primary); color: var(--text); }
.chart-legend-dual {
	display: flex;
	gap: 14px;
	margin-bottom: 8px;
	font-size: 11px;
	color: var(--text-secondary);
}
.chart-custom-pop {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 3px 6px 3px 8px;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: var(--card-inner);
	flex-shrink: 0;
}
.chart-custom-pop input[type="date"] {
	width: 112px;
	min-width: 0;
	padding: 3px 5px;
	font-size: 11px;
	border-radius: 6px;
}
.chart-custom-pop .date-sep {
	color: var(--muted);
	font-size: 11px;
	line-height: 1;
	user-select: none;
}
.btn-xs {
	padding: 3px 10px;
	font-size: 11px;
	border-radius: 6px;
	min-height: 26px;
}
.chart-svg-wrap {
	position: relative;
	width: 100%;
	height: 200px;
}
.chart-svg-wrap svg { width: 100%; height: 100%; display: block; }
.chart-svg-wrap { cursor: crosshair; }

.pie-ring { position: relative; cursor: pointer; }

.chart-tooltip {
	position: absolute;
	z-index: 6;
	pointer-events: none;
	transform: translate(-50%, calc(-100% - 8px));
	padding: 8px 11px;
	border-radius: 8px;
	background: var(--card-inner);
	border: 1px solid var(--border);
	box-shadow: var(--shadow);
	font-size: 12px;
	line-height: 1.5;
	color: var(--text);
	white-space: nowrap;
	opacity: 0;
	transition: opacity 0.12s ease;
}
.chart-tooltip.show { opacity: 1; }
.chart-tooltip-title {
	font-weight: 600;
	margin-bottom: 4px;
	color: var(--text);
}
.chart-tooltip-row {
	display: flex;
	align-items: center;
	gap: 6px;
	color: var(--text-secondary);
}
.chart-tooltip-row em {
	font-style: normal;
	font-weight: 600;
	color: var(--text);
}
.chart-tooltip-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	flex-shrink: 0;
}
.chart-dot.is-active {
	r: 5.5;
	filter: drop-shadow(0 0 4px var(--primary));
}
.chart-guide {
	stroke: var(--border-light);
	stroke-width: 1;
	stroke-dasharray: 3 3;
	pointer-events: none;
}

/* 右侧商家侧栏 */
.dashboard-side {
	padding: 14px 16px;
	display: flex;
	flex-direction: column;
	gap: 0;
}
.side-section { flex: 1; }
.side-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 8px;
	margin-bottom: 10px;
}
.side-head h3 { font-size: 13px; }
.side-meta { font-size: 11px; color: var(--muted); white-space: nowrap; }
.side-divider {
	height: 1px;
	background: var(--border);
	margin: 12px 0;
}

.pie-compact {
	display: flex;
	align-items: center;
	gap: 12px;
}
.pie-ring {
	position: relative;
	width: 120px;
	height: 120px;
	flex-shrink: 0;
}
.pie-ring canvas { display: block; width: 120px; height: 120px; }
.pie-center {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	pointer-events: none;
}
.pie-center strong { font-size: 20px; line-height: 1; color: var(--text); }
.pie-center small { font-size: 10px; color: var(--muted); margin-top: 2px; }

.pie-legend { list-style: none; padding: 0; margin: 0; flex: 1; min-width: 0; }
.pie-legend-compact li {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 5px 0;
	font-size: 12px;
	border-bottom: 1px solid var(--border);
}
.pie-legend-compact li:last-child { border-bottom: none; }
.pie-name {
	flex: 1;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	color: var(--text-secondary);
}
.pie-val { font-size: 11px; color: var(--muted); white-space: nowrap; }
.pie-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

.rank-bars { list-style: none; padding: 0; margin: 0; }
.rank-bars li { padding: 6px 0; }
.rank-bars li:first-child { padding-top: 0; }
.rank-row {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	margin-bottom: 4px;
}
.rank-no {
	width: 16px;
	height: 16px;
	border-radius: 4px;
	background: var(--card-inner);
	border: 1px solid var(--border);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 10px;
	color: var(--muted);
	flex-shrink: 0;
}
.rank-name {
	flex: 1;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.rank-stat { font-size: 11px; color: var(--muted); white-space: nowrap; }
.rank-track {
	height: 4px;
	background: var(--card-inner);
	border-radius: 2px;
	overflow: hidden;
}
.rank-fill {
	display: block;
	height: 100%;
	background: var(--primary);
	border-radius: 2px;
	opacity: 0.75;
}

.table-compact th,
.table-compact td { padding: 8px 10px; font-size: 12px; }
.empty-hint { color: var(--muted); font-size: 12px; text-align: center; padding: 12px 0; }

/* 底部：预警 + 使用数据表格 */
.dashboard-bottom { padding: 14px 16px; }
.bottom-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
	margin-bottom: 10px;
}
.bottom-head h3 { font-size: 13px; }

.alert-strip { display: flex; gap: 8px; flex-wrap: wrap; }
.alert-chip {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 5px 12px;
	border-radius: 8px;
	border: 1px solid var(--border);
	background: var(--card-inner);
	text-decoration: none;
	color: inherit;
	font-size: 12px;
	transition: border-color 0.15s, background 0.15s;
}
.alert-chip:hover { border-color: var(--border-light); background: var(--bg-elevated); }
.alert-chip span { color: var(--text-secondary); }
.alert-chip strong {
	font-size: 14px;
	font-weight: 600;
	color: var(--text);
	min-width: 1.2em;
	text-align: right;
}
.alert-chip-warn { border-color: var(--alert-chip-warn-border); }
.alert-chip-warn strong { color: var(--warning); }
.alert-chip-danger { border-color: var(--alert-chip-danger-border); }
.alert-chip-danger strong { color: var(--alert-chip-danger-text); }

.usage-legend-inline {
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
	margin-bottom: 10px;
}
.legend-item {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-size: 11px;
	color: var(--text-secondary);
}
.dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	display: inline-block;
	flex-shrink: 0;
}
.dot-success { background: var(--success); }
.dot-delivering { background: var(--primary); }
.dot-pending { background: var(--warning); }
.dot-refund { background: var(--danger); }
.dot-users { background: var(--dot-users); }

/* ── 顶栏主题切换 ── */
.theme-toolbar {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}
.theme-tuning {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 4px 8px;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: var(--card-inner);
}
.theme-tuning-item {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 11px;
	color: var(--text-secondary);
}
.theme-tuning-item span { white-space: nowrap; }
.theme-tuning select,
.theme-tuning input[type="number"] {
	width: auto;
	min-width: 0;
	padding: 4px 6px;
	font-size: 11px;
	border-radius: 6px;
}

.theme-transition-overlay {
	position: fixed;
	inset: 0;
	z-index: 9999;
	pointer-events: none;
	overflow: hidden;
}
.theme-cell {
	position: absolute;
	will-change: transform;
}

.theme-switch {
	display: inline-flex;
	align-items: center;
	border: 1px solid var(--border);
	border-radius: 8px;
	overflow: hidden;
	background: var(--card-inner);
	flex-shrink: 0;
}
.theme-btn {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	border: none;
	background: transparent;
	color: var(--text-secondary);
	padding: 6px 12px;
	font: inherit;
	font-size: 12px;
	cursor: pointer;
	transition: background 0.15s, color 0.15s;
	white-space: nowrap;
}
.theme-btn:hover { color: var(--text); }
.theme-btn.active {
	background: var(--card);
	color: var(--text);
	font-weight: 500;
}
.theme-btn svg {
	width: 14px;
	height: 14px;
	flex-shrink: 0;
}
.auth-theme-bar {
	position: fixed;
	top: 16px;
	right: 16px;
	z-index: 10;
}

/* ── 图片字段：左侧小预览 + 右侧输入 ── */
.image-field-label { margin-bottom: 8px; }
.image-field-row {
	display: flex;
	align-items: flex-start;
	gap: 12px;
}
.image-preview-panel { flex-shrink: 0; }
.image-preview-slot {
	position: relative;
	width: 72px;
	height: 72px;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: var(--card-inner);
	overflow: hidden;
}
.image-preview-img,
.image-preview-empty {
	position: absolute;
	inset: 0;
	margin: 0;
}
.image-preview-img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
	background: var(--bg-elevated);
}
.image-preview-img[hidden],
.image-preview-empty[hidden] {
	display: none !important;
}
.image-preview-empty {
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--muted);
}
.image-preview-empty svg { opacity: 0.35; }
.image-preview-tip {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
}
.image-field-controls {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
}
.image-control-label {
	font-size: 11px;
	color: var(--muted);
	margin: 0;
}
.image-field-hint {
	margin-left: 8px;
	font-size: 11px;
	font-weight: 400;
	color: var(--muted);
}
.image-url-row {
	display: flex;
	align-items: center;
	gap: 8px;
	width: 100%;
}
.image-url-input {
	font-size: 12px;
	flex: 1;
	min-width: 0;
	width: auto;
}
.image-url-textarea {
	min-height: 64px;
	resize: vertical;
	align-self: stretch;
}
.image-field.is-multi .image-url-row {
	align-items: flex-start;
}
.image-field-actions {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-shrink: 0;
}
.image-preview-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	min-width: 72px;
	min-height: 72px;
}
.image-preview-grid .image-preview-slot {
	width: 64px;
	height: 64px;
}
.image-preview-grid .image-preview-empty {
	width: 64px;
	height: 64px;
	position: relative;
	border: 1px dashed var(--border);
	border-radius: 8px;
}
.btn-upload {
	position: relative;
	cursor: pointer;
	margin: 0;
	padding: 4px 10px;
	font-size: 12px;
}
.btn-upload.is-loading { opacity: 0.6; pointer-events: none; }
.btn-upload input[type="file"] {
	position: absolute;
	width: 0;
	height: 0;
	opacity: 0;
}

.input-with-btn {
	display: flex;
	align-items: center;
	gap: 8px;
}
.input-with-btn input { flex: 1; min-width: 0; }
.input-with-btn .btn-link {
	flex-shrink: 0;
	font-size: 12px;
	white-space: nowrap;
}

.usage-table td { color: var(--text-secondary); }
.usage-table td strong { color: var(--text); font-weight: 500; }
.usage-stack {
	display: flex;
	height: 6px;
	border-radius: 3px;
	overflow: hidden;
	background: var(--card-inner);
	min-width: 80px;
}
.stack-seg {
	display: block;
	height: 100%;
	min-width: 0;
}
.bar-success { background: var(--success); }
.bar-delivering { background: var(--primary); }
.bar-pending { background: var(--warning); }
.bar-refund { background: var(--danger); }

/* ── Drawer detail helpers ── */
.order-buyer {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 14px;
}
.amount-summary {
	margin-top: 16px;
	padding: 16px;
	background: var(--card-inner);
	border: 1px solid var(--border);
	border-radius: var(--radius);
}
.amount-summary h4 { margin-bottom: 12px; font-size: 14px; }
.amount-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 4px 0;
	font-size: 13px;
	color: var(--text-secondary);
}
.amount-row.total {
	font-weight: 600;
	color: var(--text);
	margin-top: 8px;
	padding-top: 10px;
	border-top: 1px solid var(--border);
}
.detail-meta p {
	margin-bottom: 6px;
	font-size: 13px;
	color: var(--text-secondary);
}
.detail-meta strong { color: var(--text); font-weight: 500; }

.drawer-tabs-inline {
	display: flex;
	gap: 6px;
	margin-bottom: 16px;
	flex-wrap: wrap;
}

.page.is-soft-loading {
	opacity: 0.55;
	pointer-events: none;
	transition: opacity 0.15s ease;
}

/* ── System settings ── */
.settings-grid {
	display: flex;
	flex-direction: column;
	gap: 16px;
}
.settings-card .card-head { margin-bottom: 16px; }
.settings-card .card-head h3 { margin-bottom: 6px; }
.settings-desc {
	margin: 0;
	font-size: 13px;
	color: var(--text-secondary);
	line-height: 1.5;
}
.settings-actions {
	margin-top: 16px;
	display: flex;
	justify-content: flex-end;
}
.settings-card-compact {
	padding: 18px 20px;
}
.settings-compact-main {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}
.settings-compact-text {
	min-width: 0;
	flex: 1;
}
.settings-compact-text h3 {
	margin: 0 0 6px;
	font-size: 16px;
}
.settings-summary {
	margin: 8px 0 0;
	font-size: 13px;
	color: var(--text);
	font-weight: 500;
	line-height: 1.4;
	word-break: break-all;
}

/* ── Responsive ── */
@media (max-width: 1200px) {
	.stats-5,
	.stats-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.dashboard-main { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
	body { overflow: auto; }
	.layout {
		flex-direction: column;
		height: auto;
		min-height: 100vh;
		min-height: 100dvh;
		overflow: visible;
	}
	.layout.sidebar-collapsed .sidebar { width: 0; height: 0; padding: 0; }
	.sidebar {
		width: 100%;
		height: auto;
		max-height: none;
		border-right: none;
		border-bottom: 1px solid var(--border);
	}
	.main { overflow: visible; }
	.content { overflow: visible; min-height: auto; }
	.stats,
	.stats-2,
	.stats-5,
	.stats-6,
	.form-grid { grid-template-columns: 1fr; }
	.bottom-head { flex-direction: column; align-items: flex-start; }
	.topbar { padding: 0 16px; }
	.content { padding: 16px; }
	.theme-tuning { display: none; }
}
