/* 柱状图制作原型 — 67tool 风格布局 */

.chart-shell {
	border: 1px solid #eef0f3;
}

.chart-toolbar {
	position: sticky;
	top: 0;
	z-index: 20;
	background: #fff;
}

.chart-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 34px;
	padding: 0 14px;
	border-radius: 8px;
	border: 1px solid #e5e7eb;
	background: #fff;
	color: #374151;
	font-size: 13px;
	line-height: 1;
	cursor: pointer;
	transition: background .15s, border-color .15s, color .15s;
}

.chart-btn:hover {
	background: #f9fafb;
	border-color: #d1d5db;
}

.chart-btn-primary {
	background: #2563eb;
	border-color: #2563eb;
	color: #fff;
}

.chart-btn-primary:hover {
	background: #1d4ed8;
	border-color: #1d4ed8;
	color: #fff;
}

.chart-btn-download {
	background: #ea580c;
	border-color: #ea580c;
	color: #fff;
}

.chart-btn-download:hover {
	background: #c2410c;
	border-color: #c2410c;
	color: #fff;
}

.chart-divider {
	width: 1px;
	height: 22px;
	background: #e5e7eb;
	margin: 0 4px;
}

.chart-inline {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	color: #6b7280;
}

.chart-select,
.chart-input {
	height: 34px;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	padding: 0 10px;
	font-size: 13px;
	color: #111827;
	background: #fff;
	outline: none;
}

.chart-select:focus,
.chart-input:focus {
	border-color: #93c5fd;
	box-shadow: 0 0 0 3px rgba(59, 130, 246, .15);
}

#cfgBgColorPicker,
.chart-series-picker {
	width: 38px;
	height: 34px;
	border-radius: 8px;
	border: 1px solid #e5e7eb;
	cursor: pointer;
	flex-shrink: 0;
}

.chart-body {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 320px;
	align-items: start;
}

.chart-preview {
	padding: 16px;
	min-height: 592px;
	background:
		linear-gradient(45deg, #f3f4f6 25%, transparent 25%) 0 0 / 16px 16px,
		linear-gradient(-45deg, #f3f4f6 25%, transparent 25%) 0 0 / 16px 16px,
		linear-gradient(45deg, transparent 75%, #f3f4f6 75%) 0 0 / 16px 16px,
		linear-gradient(-45deg, transparent 75%, #f3f4f6 75%) 0 0 / 16px 16px,
		#fafafa;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: auto;
	align-self: start;
	width: 100%;
	box-sizing: border-box;
}

.chart-canvas-wrap {
	background: #fff;
	box-shadow: 0 8px 24px rgba(15, 23, 42, .08);
	border-radius: 4px;
	overflow: hidden;
	flex: 0 0 auto;
}

.chart-canvas {
	width: 100%;
	height: 560px;
}

.chart-aside {
	border-left: 1px solid #eef0f3;
	background: #fff;
	width: 320px;
	min-height: 592px;
	height: 592px;
	max-height: 592px;
	overflow-x: hidden;
	overflow-y: auto;
	align-self: start;
}

.chart-panel {
	border-bottom: 1px solid #f3f4f6;
}

.chart-panel > summary {
	list-style: none;
	cursor: pointer;
	user-select: none;
	padding: 12px 16px;
	font-size: 13px;
	font-weight: 600;
	color: #111827;
	background: #fcfcfd;
}

.chart-panel > summary::-webkit-details-marker {
	display: none;
}

.chart-panel > summary::after {
	content: '+';
	float: right;
	color: #9ca3af;
	font-weight: 400;
}

.chart-panel[open] > summary::after {
	content: '−';
}

.chart-panel-body {
	padding: 0 16px 14px;
}

.chart-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	font-size: 12px;
	color: #6b7280;
}

.chart-check {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	font-size: 13px;
	color: #374151;
	cursor: pointer;
	user-select: none;
}

.chart-check span {
	flex: 1;
	min-width: 0;
	order: 1;
}

.chart-check input[type="checkbox"] {
	appearance: none;
	-webkit-appearance: none;
	order: 2;
	flex: 0 0 auto;
	width: 40px;
	height: 22px;
	margin: 0;
	padding: 0;
	border: none;
	border-radius: 999px;
	background: #d1d5db;
	position: relative;
	cursor: pointer;
	transition: background-color .2s ease;
}

.chart-check input[type="checkbox"]::after {
	content: '';
	position: absolute;
	top: 2px;
	left: 2px;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 3px rgba(15, 23, 42, .25);
	transition: transform .2s ease;
}

.chart-check input[type="checkbox"]:checked {
	background: #3b82f6;
}

.chart-check input[type="checkbox"]:checked::after {
	transform: translateX(18px);
}

.chart-check input[type="checkbox"]:focus-visible {
	outline: 2px solid rgba(59, 130, 246, .45);
	outline-offset: 2px;
}

.chart-drawer-mask {
	position: fixed;
	inset: 0;
	background: rgba(15, 23, 42, .35);
	z-index: 60;
}

.chart-drawer {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 70;
	background: #fff;
	border-radius: 8px 8px 0 0;
	box-shadow: 0 -12px 40px rgba(15, 23, 42, .18);
	transform: translateY(110%);
	transition: transform .25s ease;
	max-height: min(70vh, 560px);
	display: flex;
	flex-direction: column;
}

.chart-drawer.is-open {
	transform: translateY(0);
}

.chart-drawer-head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	padding: 12px 16px;
	border-bottom: 1px solid #eef0f3;
}

.chart-drawer-body {
	padding: 12px 16px 20px;
	overflow: auto;
	flex: 1;
}

#tableArea {
	min-height: 280px;
}

@media (max-width: 1023px) {
	.chart-body {
		grid-template-columns: 1fr;
		align-items: stretch;
	}

	.chart-preview {
		min-height: 400px;
	}

	.chart-aside {
		border-left: 0;
		border-top: 1px solid #eef0f3;
		width: 100%;
		height: auto;
		max-height: none;
		min-height: 0;
		position: static;
	}

	.chart-canvas {
		height: 360px;
	}
}
