/* Cravatar Tools · 方案 2：左侧 232px 分组导航 + 右侧专注工作区（1280 齐平，390 折顶部横向导航）。 */

[hidden] {
	display: none !important;
}

body.cr-tools-page {
	--wp--style--global--content-size: 1280px;
}

body.cr-tools-page .wp-block-post-title {
	display: none;
}

body.cr-tools-page .wp-block-post-content > .wp-block-shortcode,
body.cr-tools-page .wp-block-post-content > .cr-tools {
	margin-top: 8px;
	margin-bottom: 48px;
}

.cr-tools {
	width: 100%;
	max-width: 1280px;
	margin: 0 auto;
	min-width: 0;
	display: grid;
	grid-template-columns: 232px minmax(0, 1fr);
	gap: 24px;
	align-items: start;
	box-sizing: border-box;
}

.cr-tools *,
.cr-tools *::before,
.cr-tools *::after {
	box-sizing: border-box;
}

.cr-tools h1,
.cr-tools h2,
.cr-tools h3,
.cr-tools strong,
.cr-tools th,
.cr-tools button,
.cr-tools summary {
	font-weight: 400;
}

/* ---------- 左侧分组导航 ---------- */

.cr-tools-sidebar {
	background: #fff;
	border: 1px solid #e5e5e5;
	border-radius: 10px;
	padding: 16px 12px;
	display: grid;
	gap: 16px;
}

.cr-tools-side-group {
	display: grid;
	gap: 6px;
}

.cr-tools-group-label {
	margin: 0;
	padding: 0 10px;
	font-size: 12px;
	color: #6b7280;
}

.cr-tools-side-list {
	display: grid;
	gap: 3px;
}

.cr-tools .cr-tools-side-link {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 10px;
	border-radius: 8px;
	color: #4b5563;
	text-decoration: none;
	font-size: 14px;
	line-height: 1.4;
	transition: background 0.15s ease, color 0.15s ease;
}

.cr-tools .cr-tools-side-link:hover {
	background: #f7f8f9;
	color: #23282d;
	text-decoration: none;
}

.cr-tools .cr-tools-side-link.is-current {
	background: #eef3ff;
	color: #1d4fc4;
}

.cr-tools-side-link svg {
	flex-shrink: 0;
}

.cr-tools-side-card {
	border-top: 1px solid #e5e5e5;
	padding: 14px 10px 2px;
	font-size: 12px;
	color: #6b7280;
	display: grid;
	gap: 6px;
}

.cr-tools-side-card a {
	color: #1d4fc4;
	text-decoration: none;
}

.cr-tools-side-card a:hover {
	text-decoration: underline;
}

/* ---------- 右侧工作区 ---------- */

.cr-tools-main {
	background: #fff;
	border: 1px solid #e5e5e5;
	border-radius: 10px;
	padding: 28px;
	min-width: 0;
}

.cr-tools-head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 8px 16px;
	padding-bottom: 18px;
	border-bottom: 1px solid #e5e5e5;
	margin-bottom: 22px;
}

.cr-tools-title {
	margin: 0;
	font-size: 24px;
	line-height: 1.3;
	color: #23282d;
}

.cr-tools-lede {
	margin: 4px 0 0;
	font-size: 14px;
	color: #6b7280;
	max-width: 100%;
}

.cr-tools a[target="_blank"]::after {
	content: "\2197";
	display: inline-block;
	margin-left: 3px;
	font-size: 0.85em;
	line-height: 1;
	vertical-align: 0.05em;
	opacity: 0.78;
}

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

.cr-tools-form {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 10px;
	align-items: stretch;
}

.entry-content .cr-tools-input,
.wp-block-post-content .cr-tools-input,
.cr-tools .cr-tools-input {
	box-sizing: border-box;
	width: 100% !important;
	min-width: 0;
	max-width: 100% !important;
	height: 44px;
	padding: 0 14px;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	background: #fff;
	color: #23282d;
	font: inherit;
	font-size: 14px;
	text-overflow: ellipsis;
}

.cr-tools .cr-tools-input:focus {
	outline: none;
	border-color: #1d4fc4;
	box-shadow: 0 0 0 3px rgba(29, 79, 196, 0.12);
}

.entry-content .cr-tools-btn,
.wp-block-post-content .cr-tools-btn,
.cr-tools .cr-tools-btn {
	height: 44px;
	padding: 0 24px;
	border: 0;
	border-radius: 8px;
	background: #1d4fc4;
	color: #fff;
	font: inherit;
	font-size: 14px;
	cursor: pointer;
	white-space: nowrap;
}

.cr-tools .cr-tools-btn:hover {
	background: #163ea0;
}

.cr-tools-textarea {
	width: 100%;
	min-width: 0;
	min-height: 92px;
	padding: 10px 14px;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	background: #fff;
	color: #23282d;
	font: inherit;
	font-size: 13px;
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	resize: vertical;
}

.cr-tools-select {
	height: 40px;
	padding: 0 12px;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	background: #fff;
	color: #23282d;
	font: inherit;
	font-size: 13px;
}

.cr-tools-status,
.cr-tools-hint,
.cr-tools-license {
	margin: 12px 0 0;
	color: #6b7280;
	font-size: 14px;
}

.cr-tools-license {
	margin-top: 18px;
	padding-top: 12px;
	border-top: 1px solid #f0f0f0;
	font-size: 12px;
}

.cr-tools-hint a,
.cr-tools a {
	color: #1d4fc4;
}

/* ---------- 结果区（四层漏斗） ---------- */

.cr-tools-result {
	margin-top: 20px;
	display: grid;
	gap: 16px;
}

.cr-tools-result > *,
.cr-tools-meta > *,
.cr-tools-controls > *,
.cr-tools-stage,
.cr-tools-strip,
.cr-tools-field {
	min-width: 0;
}

.cr-tools-banner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 14px 16px;
	border: 1px solid #e5e5e5;
	border-radius: 8px;
	background: #f7f8f9;
	font-size: 14px;
	color: #23282d;
}

.cr-tools-banner-left {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	min-width: 0;
}

.cr-tools-banner a {
	font-size: 13px;
	white-space: nowrap;
}

.cr-tools-pill {
	display: inline-flex;
	align-items: center;
	padding: 2px 10px;
	border-radius: 999px;
	font-size: 12px;
	background: #e5e7eb;
	color: #4b5563;
	white-space: nowrap;
}

.cr-tools-pill--ok {
	background: #ecfdf3;
	color: #166534;
}

.cr-tools-pill--warn {
	background: #fffbeb;
	color: #92400e;
}

.cr-tools-pill--err {
	background: #fef2f2;
	color: #991b1b;
}

.cr-tools-stage {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	gap: 20px;
	align-items: start;
	padding: 20px;
	border: 1px solid #e5e5e5;
	border-radius: 10px;
	background: #fff;
}

.cr-tools-figures {
	display: flex;
	flex-wrap: wrap;
	gap: 14px;
}

.cr-tools-fig {
	margin: 0;
	width: 92px;
	text-align: center;
}

.cr-tools-fig img {
	width: 92px;
	height: 92px;
	border-radius: 12px;
	border: 1px solid #e5e5e5;
	background: #f7f8f9;
	display: block;
	object-fit: cover;
}

.cr-tools-fig--contain img {
	object-fit: contain;
}

.cr-tools-fig figcaption {
	margin-top: 6px;
	font-size: 12px;
	color: #6b7280;
}

.cr-tools-meta {
	display: grid;
	gap: 10px;
	min-width: 0;
}

.cr-tools-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
}

.cr-tools-table td {
	padding: 6px 0;
	border-bottom: 1px solid #f3f4f6;
	vertical-align: top;
	color: #333;
	word-break: break-word;
}

.cr-tools-table tr:last-child td {
	border-bottom: 0;
}

.cr-tools-table td.cr-tools-key {
	width: 1%;
	min-width: 112px;
	padding: 6px 24px 6px 0;
	color: #6b7280;
	white-space: nowrap;
}

.cr-tools-table code,
.cr-tools-strip code,
.cr-tools-grid code,
.cr-tools-code code,
.cr-tools-batchtable code {
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 12px;
	color: #4b5563;
	word-break: break-all;
}

.cr-tools-label {
	font-size: 12px;
	color: #6b7280;
}

.cr-tools-strip {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 12px;
	border: 1px solid #e5e5e5;
	border-radius: 8px;
	background: #f7f8f9;
	min-width: 0;
}

.cr-tools-strip code {
	flex: 1;
	min-width: 0;
	overflow-x: auto;
	white-space: nowrap;
}

.cr-tools-ghost {
	height: 30px;
	padding: 0 10px;
	border: 1px solid #e5e5e5;
	border-radius: 6px;
	background: #fff;
	color: #4b5563;
	font: inherit;
	font-size: 12px;
	cursor: pointer;
	white-space: nowrap;
}

.cr-tools-ghost:hover {
	border-color: #1d4fc4;
	color: #1d4fc4;
}

.cr-tools-fold {
	border: 1px solid #e5e5e5;
	border-radius: 8px;
	padding: 12px 16px;
}

.cr-tools-fold summary {
	cursor: pointer;
	font-size: 13px;
	color: #6b7280;
}

.cr-tools-grid {
	margin-top: 12px;
	display: grid;
	gap: 8px;
	font-size: 12px;
	color: #4b5563;
}

.cr-tools-compare {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-top: 12px;
}

.cr-tools-compare-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 12px;
	border: 1px solid #e5e5e5;
	border-radius: 8px;
	font-size: 13px;
	color: #4b5563;
}

.cr-tools-compare-item img,
.cr-tools-miss {
	width: 34px;
	height: 34px;
	border-radius: 6px;
	border: 1px solid #e5e5e5;
	background: #f7f8f9;
	display: grid;
	place-items: center;
	object-fit: cover;
}

.cr-tools-miss {
	font-size: 11px;
	color: #9ca3af;
}

.cr-tools-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	font-size: 14px;
}

/* ---------- 生成器控件 ---------- */

.cr-tools-controls {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 16px;
	align-items: start;
	padding: 18px;
	border: 1px solid #e5e5e5;
	border-radius: 10px;
	background: #f7f8f9;
}

.cr-tools-field {
	display: grid;
	gap: 6px;
	align-content: start;
}

.cr-tools-field--wide {
	grid-column: 1 / -1;
}

.cr-tools-seg,
.cr-tools-styles {
	display: inline-flex;
	flex-wrap: wrap;
	gap: 4px;
	padding: 3px;
	border: 1px solid #e5e5e5;
	border-radius: 8px;
	background: #fff;
	width: fit-content;
}

.cr-tools-styles {
	background: #f7f8f9;
	margin-top: 14px;
}

.cr-tools-seg-btn {
	appearance: none;
	border: 1px solid transparent;
	border-radius: 6px;
	background: transparent;
	color: #4b5563;
	padding: 5px 11px;
	font: inherit;
	font-size: 12px;
	cursor: pointer;
	white-space: nowrap;
}

.cr-tools-seg-btn:hover {
	color: #1d4fc4;
}

.cr-tools-seg-btn.is-active {
	background: #eef3ff;
	color: #1d4fc4;
	border-color: #dbe3f6;
}

.cr-tools-style-grid {
	display: grid;
	grid-template-columns: repeat(7, minmax(0, 1fr));
	gap: 8px;
}

.cr-tools-style {
	appearance: none;
	border: 1px solid #e5e5e5;
	border-radius: 8px;
	background: #fff;
	padding: 8px 6px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	cursor: pointer;
	font: inherit;
	font-size: 12px;
	color: #4b5563;
	text-align: center;
}

.cr-tools-style img {
	width: 44px;
	height: 44px;
	border-radius: 8px;
}

.cr-tools-style--404 {
	width: 44px;
	height: 44px;
	border-radius: 8px;
	border: 1px dashed #d1d5db;
	background: #fff;
	display: grid;
	place-items: center;
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 11px;
	color: #6b7280;
}

.cr-tools-style:hover {
	border-color: #1d4fc4;
}

.cr-tools-style.is-active {
	border-color: #1d4fc4;
	background: #eef3ff;
	color: #1d4fc4;
}

/* ---------- 目录网格 ---------- */

.cr-tools-schools {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 12px;
	margin-top: 16px;
}

.cr-tools-school {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 14px;
	border: 1px solid #e5e5e5;
	border-radius: 10px;
	background: #fff;
	text-decoration: none;
	color: inherit;
	min-width: 0;
}

.cr-tools-school:hover {
	border-color: #1d4fc4;
	text-decoration: none;
	background: #f7f8f9;
}

.cr-tools-school img {
	width: 48px;
	height: 48px;
	border-radius: 8px;
	object-fit: contain;
	background: #f7f8f9;
	border: 1px solid #e5e5e5;
	flex: 0 0 48px;
}

.cr-tools-school-name {
	display: block;
	font-size: 14px;
	color: #23282d;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.cr-tools-school-domain {
	display: block;
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 12px;
	color: #6b7280;
}

.cr-tools-portraits {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 12px;
	margin-top: 16px;
}

.cr-tools-portrait {
	appearance: none;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	padding: 14px 10px;
	border: 1px solid #e5e5e5;
	border-radius: 10px;
	background: #fff;
	color: inherit;
	font: inherit;
	cursor: pointer;
	text-align: center;
}

.cr-tools-portrait:hover {
	border-color: #1d4fc4;
	background: #f7f8f9;
}

.cr-tools-portrait.is-selected {
	border-color: #1d4fc4;
	background: #eef3ff;
}

.cr-tools-portrait img {
	width: 68px;
	height: 68px;
	border-radius: 12px;
	border: 1px solid #e5e5e5;
}

.cr-tools-portrait-meta {
	font-size: 12px;
	color: #6b7280;
}

/* ---------- 接入与批量试测 ---------- */

.cr-tools-codehead {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	font-size: 12px;
	color: #6b7280;
}

.cr-tools-code {
	margin: 0;
	padding: 14px 16px;
	border: 1px solid #e5e5e5;
	border-radius: 8px;
	background: #f7f8f9;
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 12px;
	line-height: 1.6;
	color: #23282d;
	overflow-x: auto;
	white-space: pre;
}

.cr-tools-batch {
	margin-top: 14px;
	display: grid;
	gap: 10px;
}

.cr-tools-batch-row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 10px;
	align-items: stretch;
}

.cr-tools-batch-row .cr-tools-btn {
	height: 44px;
}

.cr-tools-batchtable {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
	margin-top: 14px;
}

.cr-tools-batchtable th,
.cr-tools-batchtable td {
	padding: 8px 10px;
	border-bottom: 1px solid #e5e5e5;
	text-align: left;
	vertical-align: top;
}

.cr-tools-batchtable th {
	color: #6b7280;
	font-size: 12px;
}

.cr-tools-batchtable tr:last-child td {
	border-bottom: 0;
}

/* ---------- 分页 ---------- */

.cr-tools-pager {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	margin-top: 20px;
}

.cr-tools-pager button {
	min-width: 36px;
	height: 32px;
	padding: 0 10px;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	background: #fff;
	cursor: pointer;
	font: inherit;
	font-size: 13px;
	color: #23282d;
}

.cr-tools-pager button:disabled {
	background: #1d4fc4;
	color: #fff;
	border-color: #1d4fc4;
}

.cr-tools-ellipsis {
	color: #9ca3af;
	padding: 0 4px;
}

.cr-tools-empty {
	color: #6b7280;
	font-size: 14px;
}

/* ---------- v3：堆叠表单、蜜罐与体检列表 ---------- */

.cr-tools-form--stack {
	grid-template-columns: 1fr;
}

.cr-tools-form--stack .cr-tools-btn {
	width: auto;
	min-width: 148px;
	justify-self: start;
}

.cr-tools-field label {
	font-size: 12px;
	color: #6b7280;
}

.cr-tools-field .cr-tools-select,
.cr-tools-field .cr-tools-textarea,
.cr-tools-field .cr-tools-input {
	width: 100%;
	max-width: 100%;
}

.cr-tools-hp {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	border: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.cr-tools-list {
	margin: 0;
	padding-left: 18px;
	display: grid;
	gap: 6px;
	font-size: 13px;
	color: #4b5563;
	list-style: disc;
}

.cr-tools-status .cr-tools-pill {
	margin-right: 6px;
}

.cr-tools-actions span {
	color: #6b7280;
	font-size: 13px;
}

/* ---------- 响应式：960 以下折顶部横向导航 ---------- */

@media (max-width: 960px) {
	.cr-tools {
		grid-template-columns: 1fr;
	}

	.cr-tools-sidebar {
		padding: 10px;
		gap: 8px;
	}

	.cr-tools-side-group {
		gap: 0;
	}

	.cr-tools-group-label,
	.cr-tools-side-card {
		display: none;
	}

	.cr-tools-side-list {
		display: flex;
		flex-wrap: wrap;
		gap: 6px;
	}

	.cr-tools-side-link {
		width: auto;
		padding: 7px 11px;
		border: 1px solid #e5e5e5;
		border-radius: 999px;
		background: #f7f8f9;
		font-size: 13px;
	}

	.cr-tools-side-link svg {
		display: none;
	}

	.cr-tools-style-grid {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

/* ---------- 响应式：640 以下单列 ---------- */

@media (max-width: 640px) {
	.cr-tools-main {
		padding: 18px;
	}

	.cr-tools-form,
	.cr-tools-batch-row,
	.cr-tools-stage,
	.cr-tools-controls {
		grid-template-columns: 1fr;
	}

	.entry-content .cr-tools-btn,
	.wp-block-post-content .cr-tools-btn,
	.cr-tools .cr-tools-btn {
		width: 100%;
	}

	.cr-tools-style-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.cr-tools-fig {
		width: 80px;
	}

	.cr-tools-fig img {
		width: 80px;
		height: 80px;
	}
}
