.app-shell {
	width: min(1320px, 100%);
	margin: 0 auto;
	display: grid;
	grid-template-columns: minmax(280px, var(--sidebar-w)) minmax(0, 1fr);
	gap: 12px;
	min-height: calc(100svh - (var(--page-pad-top) + var(--page-pad-bottom)));
}

.panel {
	background: linear-gradient(180deg, rgba(255, 250, 242, 0.98), rgba(255, 246, 235, 0.96));
	border: 1px solid rgba(216, 203, 187, 0.9);
	border-radius: var(--radius-xl);
	box-shadow: var(--shadow);
	min-width: 0;
}

.panel-sub {
	background: rgba(255, 255, 255, 0.45);
	border: 1px solid rgba(216, 203, 187, 0.65);
	border-radius: var(--radius-lg);
	padding: 10px;
}

:root.theme-dark .panel {
	background: linear-gradient(180deg, rgba(25, 30, 37, 0.98), rgba(20, 24, 30, 0.97));
	border-color: rgba(69, 78, 92, 0.85);
}

:root.theme-dark .panel-sub {
	background: rgba(255, 255, 255, 0.03);
	border-color: rgba(69, 78, 92, 0.7);
}

.sidebar {
	display: grid;
	grid-template-rows: auto auto auto minmax(0, 1fr);
	gap: 10px;
	padding: 12px;
	min-height: 0;
}

.brand-block {
	padding: 4px 2px;
}

.brand-block h1 {
	font-size: clamp(1.05rem, 1.6vw, 1.3rem);
	line-height: 1.15;
	letter-spacing: 0.01em;
}

.brand-block p {
	margin-top: 4px;
	color: var(--muted);
	font-size: 0.88rem;
	line-height: 1.3;
}

.controls-panel,
.list-panel {
	min-width: 0;
}

.list-panel {
	display: grid;
	grid-template-rows: auto auto minmax(0, 1fr);
	gap: 10px;
	min-height: 0;
}

.section-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	min-width: 0;
}

.section-head h2 {
	font-size: 0.95rem;
}

.inline-actions {
	display: flex;
	gap: 6px;
}

.editor {
	display: grid;
	grid-template-rows: minmax(0, 1fr);
	padding: 12px;
	min-height: 0;
}

.editor-empty,
.editor-active {
	min-height: 0;
}

.editor-empty {
	display: grid;
	place-content: center;
	gap: 6px;
	text-align: center;
	border-radius: var(--radius-lg);
	border: 1px dashed rgba(203, 185, 163, 0.8);
	background: rgba(255, 255, 255, 0.42);
	color: var(--muted);
	padding: 20px;
}

:root.theme-dark .editor-empty {
	border-color: rgba(92, 102, 117, 0.7);
	background: rgba(255, 255, 255, 0.025);
}

.editor-empty h2 {
	color: var(--ink);
	font-size: 1.02rem;
}

.editor-active {
	display: grid;
	grid-template-rows: auto minmax(0, 1fr) auto;
	gap: 8px;
}

.editor-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 10px;
	flex-wrap: wrap;
}

.editor-title {
	min-width: 0;
}

.editor-name {
	font-weight: 700;
	line-height: 1.2;
	word-break: break-word;
}

.editor-meta {
	color: var(--muted);
	font-size: 0.86rem;
	margin-top: 2px;
}

.editor-actions {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
}

.canvas-stage {
	position: relative;
	min-height: 0;
	display: grid;
	place-items: start center;
	padding: 0;
}

.editor-controls {
	display: grid;
	gap: 8px;
}

@media (min-width: 981px) {
	.app-shell {
		height: calc(100svh - (var(--page-pad-top) + var(--page-pad-bottom)));
		min-height: 0;
		overflow: hidden;
	}

	.sidebar,
	.editor,
	.list-panel {
		overflow: hidden;
	}
}

@media (max-width: 980px) {
	.app-shell {
		grid-template-columns: 1fr;
		grid-template-rows: auto minmax(0, 1fr);
		min-height: auto;
		height: auto;
		overflow: visible;
	}

	.sidebar {
		grid-template-rows: auto auto auto auto;
		overflow: visible;
	}

	.list-panel {
		grid-template-rows: auto auto auto;
		overflow: visible;
	}

	.editor {
		min-height: min(70svh, 760px);
		overflow: visible;
	}
}

@media (max-width: 680px) {
	.app-shell {
		gap: 10px;
	}

	.panel,
	.sidebar,
	.editor {
		border-radius: 16px;
	}

	.sidebar,
	.editor {
		padding: 10px;
	}

	.brand-block p {
		display: none;
	}

	.editor {
		min-height: 62svh;
	}
}
