:root {
	--bg: #fff6ec;
	--card: #ffffff;
	--ink: #35302b;
	--muted: #93857a;
	--line: #f1e3d5;
	--brand: #ff8a3d;
	--brand-2: #ff5f6d;
	--good: #17a673;
	--bad: #e5484d;
	--shadow: 0 10px 28px rgba(196, 130, 70, 0.12);
	--radius: 20px;
}

* {
	box-sizing: border-box;
	-webkit-tap-highlight-color: transparent;
}

html,
body {
	margin: 0;
	padding: 0;
}

body {
	background:
		radial-gradient(circle at 12% 8%, #ffe4c4 0, transparent 42%),
		radial-gradient(circle at 88% 4%, #ffd9e2 0, transparent 40%),
		var(--bg);
	min-height: 100vh;
	color: var(--ink);
	font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui,
		sans-serif;
	font-size: 16px;
	line-height: 1.5;
}

.app {
	max-width: 620px;
	margin: 0 auto;
	padding: 0 16px calc(88px + env(safe-area-inset-bottom));
}

/* ---------------------------------------------------------------- 顶栏 */

.topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 18px 4px 12px;
}

.brand {
	font-size: 18px;
	font-weight: 800;
	letter-spacing: 0.5px;
}

.brand-emoji {
	font-size: 20px;
}

.whoami {
	border: 1px solid var(--line);
	background: rgba(255, 255, 255, 0.8);
	color: var(--muted);
	font-size: 12px;
	padding: 5px 10px;
	border-radius: 999px;
	max-width: 46%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.whoami.is-admin {
	color: #8a4b00;
	border-color: #ffd6ab;
	background: #fff3e3;
}

/* ---------------------------------------------------------------- 卡片 */

.card {
	background: var(--card);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 18px;
	margin-bottom: 14px;
}

.card.tight {
	padding: 14px;
}

.card-title {
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 15px;
	font-weight: 700;
	margin-bottom: 12px;
}

.card-title small {
	font-weight: 500;
	color: var(--muted);
	font-size: 12px;
}

.loading {
	text-align: center;
	color: var(--muted);
}

/* ---------------------------------------------------------------- 余额 */

.hero {
	background: linear-gradient(135deg, #ff9a44 0%, #ff5f6d 100%);
	color: #fff;
	border-radius: 24px;
	padding: 22px 20px 20px;
	box-shadow: 0 14px 30px rgba(255, 111, 97, 0.28);
	margin-bottom: 14px;
}

.hero-top {
	display: flex;
	align-items: center;
	gap: 12px;
}

.avatar {
	width: 54px;
	height: 54px;
	border-radius: 18px;
	background: rgba(255, 255, 255, 0.22);
	display: grid;
	place-items: center;
	font-size: 30px;
	flex: 0 0 auto;
}

.hero-name {
	font-size: 17px;
	font-weight: 700;
}

.hero-sub {
	font-size: 12px;
	opacity: 0.85;
}

.balance {
	margin-top: 16px;
	display: flex;
	align-items: baseline;
	gap: 8px;
}

.balance-num {
	font-size: 52px;
	font-weight: 800;
	line-height: 1;
	letter-spacing: -1px;
	font-variant-numeric: tabular-nums;
}

.balance-unit {
	font-size: 15px;
	opacity: 0.9;
}

.hero-stats {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 8px;
	margin-top: 18px;
}

.hero-stat {
	background: rgba(255, 255, 255, 0.18);
	border-radius: 14px;
	padding: 8px 10px;
	text-align: center;
}

.hero-stat b {
	display: block;
	font-size: 17px;
	font-variant-numeric: tabular-nums;
}

.hero-stat span {
	font-size: 11px;
	opacity: 0.88;
}

/* ---------------------------------------------------------------- 按钮 */

button {
	font-family: inherit;
	font-size: 15px;
	cursor: pointer;
}

.btn {
	border: none;
	border-radius: 14px;
	padding: 12px 16px;
	font-weight: 700;
	background: #f5ede4;
	color: var(--ink);
	transition: transform 0.08s ease;
}

.btn:active {
	transform: scale(0.97);
}

.btn-primary {
	background: linear-gradient(135deg, #ff9a44, #ff5f6d);
	color: #fff;
}

.btn-good {
	background: #e6f7ef;
	color: #0f7a55;
}

.btn-ghost {
	background: #f5ede4;
	color: #6b5c50;
}

.btn-danger {
	background: #fdeaea;
	color: var(--bad);
}

.btn-block {
	display: block;
	width: 100%;
}

.btn-sm {
	padding: 7px 11px;
	font-size: 13px;
	border-radius: 11px;
}

.btn:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

/* ---------------------------------------------------------------- 快捷加减分 */

.preset-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 8px;
}

.preset {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 6px;
	border: 1px solid var(--line);
	background: #fffdfb;
	border-radius: 14px;
	padding: 10px 12px;
	font-size: 14px;
	font-weight: 600;
	color: var(--ink);
	text-align: left;
}

.preset .pts {
	color: var(--good);
	font-weight: 800;
	font-variant-numeric: tabular-nums;
}

.preset.negative .pts {
	color: var(--bad);
}

.preset:active {
	background: #fff3e3;
}

/* ---------------------------------------------------------------- 表单 */

label.field {
	display: block;
	margin-bottom: 10px;
}

label.field > span {
	display: block;
	font-size: 12px;
	color: var(--muted);
	margin-bottom: 4px;
}

input[type='text'],
input[type='number'],
input[type='password'],
textarea,
select {
	width: 100%;
	border: 1px solid var(--line);
	border-radius: 12px;
	padding: 10px 12px;
	font-size: 16px;
	font-family: inherit;
	color: var(--ink);
	background: #fffdfb;
}

input:focus,
textarea:focus,
select:focus {
	outline: 2px solid #ffc79a;
	outline-offset: 0;
}

.row {
	display: flex;
	gap: 8px;
	align-items: center;
}

.row > * {
	flex: 1;
}

.row .fixed {
	flex: 0 0 auto;
}

.hint {
	font-size: 12px;
	color: var(--muted);
	margin-top: 8px;
	line-height: 1.5;
}

.seg {
	display: flex;
	gap: 6px;
	background: #f7efe6;
	padding: 4px;
	border-radius: 14px;
	margin-bottom: 12px;
}

.seg button {
	flex: 1;
	border: none;
	background: transparent;
	border-radius: 11px;
	padding: 9px 0;
	font-weight: 700;
	color: var(--muted);
}

.seg button.active {
	background: #fff;
	color: var(--ink);
	box-shadow: 0 2px 8px rgba(180, 120, 60, 0.14);
}

/* ---------------------------------------------------------------- 列表 */

.list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.list li {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 0;
	border-bottom: 1px dashed var(--line);
}

.list li:last-child {
	border-bottom: none;
}

.dot {
	width: 34px;
	height: 34px;
	border-radius: 12px;
	background: #f7efe6;
	display: grid;
	place-items: center;
	font-size: 17px;
	flex: 0 0 auto;
}

.li-main {
	flex: 1;
	min-width: 0;
}

.li-title {
	font-size: 14px;
	font-weight: 600;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.li-sub {
	font-size: 11px;
	color: var(--muted);
}

.amount {
	font-weight: 800;
	font-variant-numeric: tabular-nums;
	font-size: 15px;
}

.amount.plus {
	color: var(--good);
}

.amount.minus {
	color: var(--bad);
}

.date-head {
	font-size: 12px;
	color: var(--muted);
	font-weight: 700;
	margin: 14px 0 2px;
}

/* ---------------------------------------------------------------- 奖励商店 */

.reward {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px;
	border: 1px solid var(--line);
	border-radius: 16px;
	margin-bottom: 10px;
	background: #fffdfb;
}

.reward.out {
	opacity: 0.62;
}

.reward-emoji {
	font-size: 26px;
	width: 44px;
	text-align: center;
	flex: 0 0 auto;
}

.reward-main {
	flex: 1;
	min-width: 0;
}

.reward-title {
	font-weight: 700;
	font-size: 15px;
}

.reward-cost {
	font-size: 12px;
	color: var(--muted);
}

.reward-cost b {
	color: #d9710f;
	font-size: 13px;
}

.badge {
	display: inline-block;
	font-size: 11px;
	padding: 2px 8px;
	border-radius: 999px;
	background: #fff3e3;
	color: #b06400;
	margin-left: 6px;
	vertical-align: 1px;
}

.badge.ok {
	background: #e6f7ef;
	color: #0f7a55;
}

.badge.no {
	background: #fdeaea;
	color: var(--bad);
}

/* ---------------------------------------------------------------- 图表 */

.chart {
	display: flex;
	align-items: flex-end;
	gap: 6px;
	height: 96px;
	margin-top: 6px;
}

.chart .bar-wrap {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	height: 100%;
	justify-content: flex-end;
}

.chart .bar {
	width: 100%;
	border-radius: 8px 8px 4px 4px;
	background: linear-gradient(180deg, #ffb26b, #ff8a3d);
	min-height: 3px;
}

.chart .bar.zero {
	background: #f1e3d5;
}

.chart .bar-label {
	font-size: 10px;
	color: var(--muted);
}

/* ---------------------------------------------------------------- 底部导航 */

.tabbar {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	display: flex;
	background: rgba(255, 255, 255, 0.94);
	backdrop-filter: blur(10px);
	border-top: 1px solid var(--line);
	padding-bottom: env(safe-area-inset-bottom);
}

.tabbar .tab {
	flex: 1;
	border: none;
	background: none;
	padding: 9px 0 8px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
	color: var(--muted);
	font-size: 11px;
	font-weight: 600;
}

.tabbar .tab .tab-icon {
	font-size: 20px;
	filter: grayscale(1) opacity(0.65);
}

.tabbar .tab.active {
	color: var(--brand);
}

.tabbar .tab.active .tab-icon {
	filter: none;
}

/* ---------------------------------------------------------------- 提示 */

.toast {
	position: fixed;
	left: 50%;
	bottom: calc(96px + env(safe-area-inset-bottom));
	transform: translateX(-50%);
	background: rgba(53, 48, 43, 0.94);
	color: #fff;
	padding: 10px 18px;
	border-radius: 999px;
	font-size: 14px;
	max-width: 88vw;
	text-align: center;
	z-index: 50;
	animation: pop 0.18s ease;
}

.toast.error {
	background: rgba(198, 40, 40, 0.95);
}

@keyframes pop {
	from {
		opacity: 0;
		transform: translate(-50%, 8px);
	}
	to {
		opacity: 1;
		transform: translate(-50%, 0);
	}
}

.empty {
	text-align: center;
	color: var(--muted);
	font-size: 13px;
	padding: 18px 0;
}

.spacer-8 {
	height: 8px;
}

.divider {
	height: 1px;
	background: var(--line);
	margin: 14px 0;
}
