/* =========================================================
   任务管理器主题样式
   ========================================================= */

:root {
	--tm-bg: #f4f6f9;
	--tm-surface: #ffffff;
	--tm-border: #e3e8ef;
	--tm-text: #1f2937;
	--tm-text-muted: #6b7280;
	--tm-primary: #2563eb;
	--tm-primary-dark: #1d4ed8;
	--tm-success: #16a34a;
	--tm-failure: #dc2626;
	--tm-warning: #d97706;
	--tm-radius: 12px;
	--tm-shadow: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.04);
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	background: var(--tm-bg);
	color: var(--tm-text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
}

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

a:hover {
	color: var(--tm-primary-dark);
}

/* ---------- 页头 / 页脚 ---------- */
.tm-site-header {
	background: var(--tm-surface);
	border-bottom: 1px solid var(--tm-border);
}

.tm-site-header__inner {
	max-width: 1200px;
	margin: 0 auto;
	padding: 16px 24px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}

.tm-site-title {
	font-size: 20px;
	font-weight: 700;
	color: var(--tm-text);
}

.tm-site-nav a {
	font-size: 14px;
	font-weight: 600;
}

.tm-site-main {
	max-width: 1200px;
	margin: 0 auto;
	padding: 24px;
}

.tm-site-footer {
	background: var(--tm-surface);
	border-top: 1px solid var(--tm-border);
	margin-top: 48px;
}

.tm-site-footer__inner {
	max-width: 1200px;
	margin: 0 auto;
	padding: 20px 24px;
	color: var(--tm-text-muted);
	font-size: 13px;
}

.tm-site-footer p {
	margin: 0;
}

/* ---------- 首页两栏布局 ---------- */
.tm-home {
	display: grid;
	grid-template-columns: 240px 1fr;
	gap: 24px;
	align-items: start;
}

.tm-sidebar {
	background: var(--tm-surface);
	border: 1px solid var(--tm-border);
	border-radius: var(--tm-radius);
	box-shadow: var(--tm-shadow);
	padding: 20px;
	position: sticky;
	top: 24px;
}

.tm-sidebar__title {
	margin: 0 0 14px;
	font-size: 16px;
	font-weight: 700;
}

.tm-cat-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.tm-cat-list a {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 12px;
	border-radius: 8px;
	color: var(--tm-text);
	font-size: 14px;
	transition: background 0.15s ease, color 0.15s ease;
}

.tm-cat-list a:hover {
	background: #f1f5f9;
}

.tm-cat-list li.is-active a {
	background: var(--tm-primary);
	color: #ffffff;
	font-weight: 600;
}

.tm-cat-list__count {
	background: #eef2f7;
	color: var(--tm-text-muted);
	font-size: 12px;
	border-radius: 999px;
	padding: 1px 8px;
}

.tm-cat-list li.is-active .tm-cat-list__count {
	background: rgba(255, 255, 255, 0.25);
	color: #ffffff;
}

/* ---------- 右侧内容 ---------- */
.tm-content__title {
	margin: 0 0 20px;
	font-size: 24px;
	font-weight: 700;
}

/* 任务网格：一行 3 个 */
.tm-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 20px;
}

/* ---------- 任务卡片 ---------- */
.tm-card {
	background: var(--tm-surface);
	border: 1px solid var(--tm-border);
	border-radius: var(--tm-radius);
	box-shadow: var(--tm-shadow);
	padding: 18px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tm-card:hover {
	transform: translateY(-2px);
	box-shadow: 0 8px 20px rgba(16, 24, 40, 0.1);
}

.tm-card__head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 10px;
}

.tm-card__title {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.4;
}

.tm-card__title a {
	color: var(--tm-text);
}

.tm-card__title a:hover {
	color: var(--tm-primary);
}

.tm-card__excerpt {
	color: var(--tm-text-muted);
	font-size: 13px;
	line-height: 1.6;
	min-height: 40px;
}

.tm-card__meta {
	font-size: 13px;
	color: var(--tm-text-muted);
}

.tm-card__target strong {
	color: var(--tm-text);
}

.tm-card__actions {
	margin-top: auto;
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.tm-btn {
	display: inline-block;
	background: var(--tm-primary);
	color: #ffffff;
	padding: 3px 10px;
	border: 0;
	border-radius: 6px;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.7;
	text-align: center;
	cursor: pointer;
	transition: background 0.15s ease;
}

.tm-btn:hover {
	background: var(--tm-primary-dark);
	color: #ffffff;
}

.tm-btn--end {
	background: #f59e0b;
}

.tm-btn--end:hover {
	background: #d97706;
}

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

/* ---------- 状态徽章 ---------- */
.tm-status {
	display: inline-block;
	font-size: 12px;
	font-weight: 600;
	border-radius: 999px;
	padding: 2px 10px;
	white-space: nowrap;
}

.tm-status--ongoing {
	background: #eef4ff;
	color: var(--tm-primary);
}

.tm-status--success {
	background: #ecfdf3;
	color: var(--tm-success);
}

.tm-status--failure {
	background: #fef2f2;
	color: var(--tm-failure);
}

.tm-status--ended {
	background: #eef2f7;
	color: var(--tm-text-muted);
}

/* ---------- 计时器 ---------- */
.tm-timer {
	background: #f8fafc;
	border: 1px solid var(--tm-border);
	border-radius: 10px;
	padding: 12px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.tm-timer__bar {
	height: 6px;
	background: #e5e7eb;
	border-radius: 999px;
	overflow: hidden;
}

.tm-timer__bar-fill {
	display: block;
	height: 100%;
	width: 0;
	background: var(--tm-primary);
	border-radius: 999px;
	transition: width 0.5s ease;
}

.tm-timer--overdue .tm-timer__bar-fill {
	background: var(--tm-failure);
}

.tm-timer--success .tm-timer__bar-fill {
	background: var(--tm-success);
}

.tm-timer--ended .tm-timer__bar-fill {
	background: var(--tm-text-muted);
}

.tm-timer__text {
	font-size: 13px;
	font-weight: 600;
	color: var(--tm-text);
	font-variant-numeric: tabular-nums;
}

.tm-timer--overdue .tm-timer__text {
	color: var(--tm-failure);
}

.tm-timer--success .tm-timer__text {
	color: var(--tm-success);
}

.tm-timer--ended .tm-timer__text {
	color: var(--tm-text-muted);
}

.tm-timer--large {
	padding: 18px;
}

.tm-timer--large .tm-timer__text {
	font-size: 20px;
}

/* ---------- 分页 ---------- */
.tm-pagination {
	margin-top: 28px;
	display: flex;
	justify-content: center;
}

.tm-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 38px;
	height: 38px;
	padding: 0 12px;
	margin: 0 4px;
	border-radius: 8px;
	background: var(--tm-surface);
	border: 1px solid var(--tm-border);
	color: var(--tm-text);
	font-size: 14px;
}

.tm-pagination .page-numbers.current {
	background: var(--tm-primary);
	border-color: var(--tm-primary);
	color: #ffffff;
	font-weight: 600;
}

.tm-pagination .page-numbers:hover {
	border-color: var(--tm-primary);
	color: var(--tm-primary);
}

.tm-pagination .page-numbers.dots {
	border: none;
	background: transparent;
}

/* ---------- 空状态 ---------- */
.tm-empty {
	background: var(--tm-surface);
	border: 1px dashed var(--tm-border);
	border-radius: var(--tm-radius);
	padding: 40px;
	text-align: center;
	color: var(--tm-text-muted);
}

/* ---------- 任务详情页 ---------- */
.tm-single {
	background: var(--tm-surface);
	border: 1px solid var(--tm-border);
	border-radius: var(--tm-radius);
	box-shadow: var(--tm-shadow);
	padding: 32px;
	max-width: 860px;
	margin: 0 auto;
}

.tm-back {
	display: inline-block;
	margin-bottom: 16px;
	font-size: 14px;
	font-weight: 600;
}

.tm-single__title {
	margin: 0 0 8px;
	font-size: 28px;
	font-weight: 800;
	line-height: 1.3;
}

.tm-single__meta-line {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: 24px;
}

.tm-chip {
	display: inline-block;
	background: #eef2f7;
	color: var(--tm-text-muted);
	font-size: 12px;
	border-radius: 999px;
	padding: 2px 10px;
}

.tm-single__timer {
	background: #f8fafc;
	border: 1px solid var(--tm-border);
	border-radius: var(--tm-radius);
	padding: 20px;
	margin-bottom: 24px;
}

.tm-single__target {
	margin: 12px 0 0;
	font-size: 14px;
	color: var(--tm-text-muted);
}

.tm-single__times {
	margin-top: 14px;
	padding-top: 14px;
	border-top: 1px dashed var(--tm-border);
	display: flex;
	flex-wrap: wrap;
	gap: 8px 28px;
}

.tm-single__times p {
	margin: 0;
	font-size: 14px;
	color: var(--tm-text-muted);
}

.tm-single__times strong {
	color: var(--tm-text);
}

.tm-single__section {
	margin-top: 24px;
	padding-top: 20px;
	border-top: 1px solid var(--tm-border);
}

.tm-single__heading {
	margin: 0 0 10px;
	font-size: 16px;
	font-weight: 700;
}

.tm-single__content {
	font-size: 15px;
	line-height: 1.8;
	color: var(--tm-text);
	overflow-wrap: break-word;
}

.tm-single__content p {
	margin: 0 0 12px;
}

.tm-single__section--success .tm-single__heading {
	color: var(--tm-success);
}

.tm-single__section--failure .tm-single__heading {
	color: var(--tm-failure);
}

/* ---------- 响应式 ---------- */
@media (max-width: 820px) {
	.tm-home {
		grid-template-columns: 1fr;
	}

	.tm-sidebar {
		position: static;
	}

	.tm-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 520px) {
	.tm-grid {
		grid-template-columns: 1fr;
	}

	.tm-site-main {
		padding: 16px;
	}

	.tm-single {
		padding: 20px;
	}
}
