/* cms.css */

:root {
	--bar-h: 52px;
	--side-w: 300px;
	--border: #d8dde5;
	--bg-side: #ffffff;
	--bg-main: #f5f6f8;
	--bg-card: #ffffff;
	--accent: #2f6fed;
	--article-font-size: 12px;
	--article-line-height: 1.5;
}

body {
	font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	line-height: 1.6;
	color: #222;
	background: var(--bg-main);
}

body.font-lv-1 {
	--article-font-size: 9px;
}

body.font-lv-2 {
	--article-font-size: 10px;
}

body.font-lv-3 {
	--article-font-size: 12px;
}

body.font-lv-4 {
	--article-font-size: 14px;
}

body.font-lv-5 {
	--article-font-size: 16px;
}

body.line-lv-1 {
	--article-line-height: 1.25;
}

body.line-lv-2 {
	--article-line-height: 1.33;
}

body.line-lv-3 {
	--article-line-height: 1.5;
}

body.line-lv-4 {
	--article-line-height: 1.67;
}

body.line-lv-5 {
	--article-line-height: 1.75;
}

.topbar {
	position: fixed;
	top: 0;
	left: 0;
	z-index: 100;
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	height: var(--bar-h);
	color: #fff;
	background: rgba(24, 34, 51, 0.85);
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
	backdrop-filter: blur(6px);
}

.topbar-left,
.topbar-right {
	display: flex;
	align-items: center;
	height: 100%;
	min-width: 0;
}

.menu-btn,
.setting-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 52px;
	height: 52px;
	font-size: 24px;
	line-height: 1;
}

.menu-btn:hover,
.setting-btn:hover {
	background: rgba(255, 255, 255, 0.1);
}

.page-title {
	min-width: 0;
	padding-right: 16px;
	font-size: 17px;
	font-weight: 700;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.app {
	position: fixed;
	top: var(--bar-h);
	right: 0;
	bottom: 0;
	left: 0;
	display: flex;
	overflow: hidden;
	background: var(--bg-main);
}

.sidebar {
	flex: 0 0 var(--side-w);
	width: var(--side-w);
	height: 100%;
	background: var(--bg-side);
	border-right: 1px solid var(--border);
	transform: translateX(calc(var(--side-w) * -1));
	transition: transform 180ms ease;
	overflow-y: auto;
	overscroll-behavior: contain;
}

body.side-open .sidebar {
	transform: translateX(0);
}

.sidebar-head {
	position: sticky;
	top: 0;
	z-index: 2;
	padding: 14px 16px;
	font-size: 14px;
	font-weight: 700;
	background: #fff;
	border-bottom: 1px solid var(--border);
}

.page-list {
	padding: 8px;
}

.page-item-row {
	display: flex;
	align-items: stretch;
	gap: 4px;
	margin-bottom: 2px;
}

.fav-btn {
	flex: 0 0 36px;
	width: 36px;
	border-radius: 8px;
	color: #a0a6b3;
}

.fav-btn:hover {
	background: #fff7d6;
}

.fav-btn.on {
	color: #d8a000;
}

.page-item {
	display: block;
	flex: 1 1 auto;
	min-width: 0;
	padding: 10px 12px;
	text-align: left;
	border-radius: 8px;
	color: #253047;
}

.page-item:hover {
	background: #eef3ff;
}

.page-item.active {
	color: #fff;
	background: var(--accent);
}

.page-item.status-draft {
	color: #9aa1ad;
}

.page-item-title {
	display: block;
	font-weight: 700;
	line-height: 1.35;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.page-item-meta {
	display: block;
	margin-top: 2px;
	font-size: 12px;
	opacity: 0.75;
}

.main {
	position: relative;
	flex: 1 1 auto;
	min-width: 0;
	height: 100%;
	margin-left: calc(var(--side-w) * -1);
	transition: margin-left 180ms ease;
	overflow-y: auto;
	overscroll-behavior: contain;
}

body.side-open .main {
	margin-left: 0;
}

.content {
	width: min(980px, calc(100% - 32px));
	margin: 0 auto;
	padding: 28px 0 56px;
}

.article {
	padding: 28px;
	font-size: var(--article-font-size);
	line-height: var(--article-line-height);
	background: var(--bg-card);
	border: 1px solid var(--border);
	border-radius: 16px;
	box-shadow: 0 8px 26px rgba(20, 32, 54, 0.08);
}

.article-head {
	margin-bottom: 24px;
	padding-bottom: 18px;
	border-bottom: 1px solid var(--border);
}

.article-title-row {
	display: flex;
	align-items: flex-start;
	gap: 10px;
}

.article-title-row h1 {
	flex: 1 1 auto;
	min-width: 0;
	margin-bottom: 8px;
	font-size: 1.5em;
	font-weight: 900;
	line-height: 1.25;
}

.article-count {
	margin-top: 2px;
	font-size: 0.82em;
	line-height: 1.25;
	color: #6a7280;
	text-align: right;
}

.article-date {
	margin-top: 8px;
	font-size: 0.92em;
	line-height: 1.35;
	color: #5c667a;
}


.article-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 14px;
	font-size: 0.92em;
	color: #5c667a;
}

.tag-list {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 12px;
}

.tag {
	display: inline-flex;
	align-items: center;
	padding: 2px 8px;
	font-size: 0.86em;
	color: #28406f;
	background: #eef3ff;
	border: 1px solid #d8e4ff;
	border-radius: 999px;
}

.md-body h1,
.md-body h2,
.md-body h3 {
	margin: 28px 0 10px;
	line-height: 1.35;
}

.md-body h1 {
	font-size: 1.5em;
	font-weight: 900;
}

hr {
	margin-top: 2em;
}

.md-body h2 {
	font-size: 1.4em;
	color: #2200aa;
	border-bottom: 1px solid #e3e8f0;
	padding-bottom: 4px;
}

.md-body h3 {
	font-size: 1.25em;
}

.md-body p {
	margin-top: 14px;
}

.md-body ul,
.md-body ol {
	margin: 14px 0 0 1.5em;
}

.md-body li {
	margin-top: 4px;
}

.md-body blockquote {
	margin: 14px 0;
	padding: 10px 14px;
	color: #4e5a70;
	background: #f7f9fc;
	border-left: 4px solid #b7c5dd;
}

.md-body blockquote > :first-child {
	margin-top: 0;
}

.md-body table {
	width: 100%;
	margin-top: 16px;
	font-size: 0.92em;
}

.md-body th,
.md-body td {
	padding: 8px 10px;
	border: 1px solid #d9e0eb;
}

.md-body th {
	background: #f1f4f9;
}

.md-body code {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 0.92em;
	tab-size: 4;
}

.md-body :not(pre) > code {
	padding: 1px 5px;
	background: #edf1f7;
	border-radius: 5px;
}

.code-box {
	position: relative;
	margin-top: 16px;
	border-radius: 10px;
	overflow: hidden;
	background: #0d1117;
	border: 1px solid #30363d;
}

.code-tools {
	position: absolute;
	top: 6px;
	right: 6px;
	z-index: 2;
	display: flex;
	justify-content: flex-end;
	gap: 5px;
	padding: 0;
	opacity: 0.62;
	transition: opacity 120ms ease;
}

.code-box:hover .code-tools,
.code-tools:focus-within {
	opacity: 1;
}

.code-btn {
	padding: 2px 7px;
	font-size: 11px;
	line-height: 1.4;
	color: rgba(219, 228, 240, 0.9);
	background: rgba(40, 50, 68, 0.42);
	border-radius: 6px;
}

.code-btn:hover,
.code-btn:focus-visible {
	color: #ffffff;
	background: rgba(58, 70, 91, 0.72);
}

.code-scroll {
	overflow-x: auto;
}

.code-scroll.collapsed {
	max-height: calc(1.45em * 10 + 28px);
	overflow-y: hidden;
}

.code-scroll pre {
	margin: 0;
}

.code-scroll pre code.hljs {
	padding: 14px;
	border-radius: 0;
	line-height: 1.45;
}

.page-foot-nav {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	margin-top: 32px;
	padding-top: 20px;
	border-top: 1px solid var(--border);
}

.page-foot-link {
	display: inline-flex;
	align-items: center;
	max-width: 48%;
	padding: 10px 14px;
	color: #fff;
	background: var(--accent);
	border-radius: 10px;
}

.page-foot-link.disabled {
	visibility: hidden;
	pointer-events: none;
}

.float-nav {
	position: fixed;
	right: 18px;
	bottom: 18px;
	z-index: 80;
	padding: 10px 16px;
	color: #fff;
	background: rgba(24, 34, 51, 0.92);
	border-radius: 999px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
}

.float-nav:hover {
	background: rgba(47, 111, 237, 0.95);
}

.backdrop {
	display: none;
}

.setting-dlg,
.password-dlg {
	position: fixed;
	top: 50%;
	left: 50%;
	width: min(420px, calc(100vw - 24px));
	max-height: calc(100vh - 24px);
	padding: 0;
	border: 0;
	border-radius: 14px;
	box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
	transform: translate(-50%, -50%);
}

.setting-dlg::backdrop,
.password-dlg::backdrop {
	background: rgba(0, 0, 0, 0.42);
}

.dlg-panel {
	background: #fff;
}

.dlg-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 16px;
	border-bottom: 1px solid var(--border);
}

.dlg-head h2 {
	font-size: 18px;
}

.dlg-close {
	width: 36px;
	height: 36px;
	border-radius: 8px;
	font-size: 22px;
}

.dlg-close:hover {
	background: #eef3ff;
}

.dlg-body {
	padding: 18px 16px;
}

.dlg-body legend {
	margin-bottom: 8px;
	font-weight: 700;
}

.form-row {
	margin-top: 16px;
}

.form-row:first-child {
	margin-top: 0;
}

.form-row label,
.form-row legend {
	display: block;
	margin-bottom: 8px;
	font-weight: 700;
}

.form-row select,
.form-row input[type="password"] {
	width: 100%;
	padding: 8px 10px;
	font: inherit;
	border: 1px solid var(--border);
	border-radius: 8px;
}

.slider-row {
	display: grid;
	grid-template-columns: 42px 1fr 42px;
	align-items: center;
	gap: 10px;
	margin-top: 10px;
}

.slider-row input[type="range"] {
	width: 100%;
}

.setting-view {
	margin-top: 10px;
	font-size: 14px;
	color: #5c667a;
	text-align: center;
}

.dlg-msg {
	min-height: 1.6em;
	margin-top: 10px;
	color: #c0392b;
	font-size: 13px;
}

.dlg-foot {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	padding: 14px 16px;
	border-top: 1px solid var(--border);
}

.dlg-primary {
	padding: 8px 18px;
	color: #fff;
	background: var(--accent);
	border-radius: 8px;
}

.dlg-secondary {
	padding: 8px 18px;
	background: #edf1f7;
	border-radius: 8px;
}

@media (max-width: 720px) {
	:root {
		--side-w: min(86vw, 320px);
	}

	.sidebar {
		position: absolute;
		top: 0;
		bottom: 0;
		left: 0;
		z-index: 20;
		box-shadow: 6px 0 20px rgba(0, 0, 0, 0.2);
	}

	.main {
		width: 100%;
		margin-left: 0;
	}

	body.side-open .main {
		margin-left: 0;
	}

	.backdrop {
		position: absolute;
		inset: 0;
		z-index: 10;
		background: rgba(0, 0, 0, 0.35);
	}

	body.side-open .backdrop {
		display: block;
	}

	.content {
		width: calc(100% - 20px);
		padding: 16px 0 36px;
	}

	.article {
		padding: 20px;
		border-radius: 12px;
	}

	.page-foot-nav {
		flex-direction: column;
	}

	.page-foot-link {
		max-width: 100%;
		justify-content: center;
	}

	.float-nav {
		right: 12px;
		bottom: 12px;
		padding: 9px 14px;
	}
}

.article-summary {
	margin-top: 10px;
	font-size: 0.92em;
	font-weight: 700;
	line-height: 1.45;
	color: #b8860b;
}

.article-ad {
	margin-top: 2em;
}