/* Project switching lives beside the global navigation. */
.projects-collapsed-pane {
	min-height: 0;
	display: flex;
	border-right: 1px solid var(--line);
	background: var(--surface-muted);
}
.projects-panel-reveal {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	width: 100%;
	padding: 20px 6px;
	border: 0;
	background: transparent;
	color: var(--theme-strong);
	font-size: 0.75rem;
	font-weight: 700;
	cursor: pointer;
}
.projects-panel-reveal svg { width: 20px; height: 20px; flex-shrink: 0; }
.projects-panel-reveal > span { writing-mode: vertical-rl; }
.projects-panel-reveal:hover { background: var(--surface-hover); }
.projects-panel-reveal:focus-visible { outline: 2px solid var(--theme); outline-offset: -3px; }

.projects-pane {
	min-width: 0;
	min-height: 0;
	display: flex;
	flex-direction: column;
	border-right: 1px solid var(--line);
	background: var(--surface);
}

.projects-pane-head {
	display: grid;
	gap: 12px;
	padding: 18px 14px 14px;
	border-bottom: 1px solid var(--line);
}

.projects-pane-heading {
	display: flex;
	align-items: center;
	gap: 8px;
}

.projects-pane-heading h2 { margin: 0; font-size: 0.95rem; }
.projects-pane-count {
	padding: 2px 7px;
	border-radius: 999px;
	background: var(--surface-subtle);
	color: var(--text-muted);
	font-size: 0.7rem;
}

.projects-pane-close,
.projects-panel-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	min-height: 34px;
	padding: 6px 9px;
	border: 1px solid var(--line);
	border-radius: 7px;
	background: var(--surface);
	color: var(--text-muted);
	font-size: 0.75rem;
	cursor: pointer;
}

.projects-pane-close { margin-left: auto; padding: 6px; }
.projects-pane-close svg,
.projects-panel-toggle svg,
.projects-pane-search svg { width: 18px; height: 18px; flex-shrink: 0; }
.projects-pane-close:hover,
.projects-panel-toggle:hover {
	border-color: var(--theme);
	color: var(--theme-strong);
	background: var(--surface-hover);
}

.projects-pane-create {
	width: 100%;
	justify-content: center;
	min-height: 36px;
	font-size: 0.78rem;
}
.projects-pane-create > span:first-child { font-size: 1.25rem; line-height: 1; }
.projects-pane-search {
	display: flex;
	align-items: center;
	gap: 7px;
	padding: 0 9px;
	border: 1px solid var(--line-strong);
	border-radius: 7px;
	color: var(--text-muted);
}
.projects-pane-search:focus-within {
	border-color: var(--theme);
	box-shadow: 0 0 0 2px var(--focus-ring);
}
.projects-pane-search input {
	width: 100%;
	min-width: 0;
	min-height: 36px;
	padding: 6px 0;
	border: 0;
	outline: 0;
	background: transparent;
	color: var(--text);
	font-size: 0.76rem;
}

.projects-pane-list {
	flex: 1;
	min-height: 0;
	display: flex;
	flex-direction: column;
	gap: 5px;
	padding: 10px;
	overflow-y: auto;
	overscroll-behavior: contain;
	scrollbar-width: thin;
}
.projects-pane-row {
	display: flex;
	align-items: flex-start;
	gap: 9px;
	width: 100%;
	padding: 12px 9px;
	border: 1px solid transparent;
	border-radius: 8px;
	background: var(--surface);
	color: var(--text);
	text-align: left;
	cursor: pointer;
}
.projects-pane-row:hover { background: var(--surface-hover); }
.projects-pane-row.is-current {
	border-color: var(--theme-border);
	background: var(--surface-selected);
	box-shadow: inset 3px 0 0 var(--theme);
}
.projects-pane-row-icon img { width: 22px; height: 22px; margin-top: 2px; }
.projects-pane-row-copy { min-width: 0; display: grid; gap: 4px; }
.projects-pane-row-copy strong { font-size: 0.78rem; line-height: 1.4; overflow-wrap: anywhere; }
.projects-pane-row-copy > span { color: var(--text-muted); font-size: 0.68rem; line-height: 1.35; }
.projects-pane-row-status::before {
	content: "";
	display: inline-block;
	width: 5px;
	height: 5px;
	margin-right: 5px;
	border-radius: 50%;
	background: var(--success);
}
.projects-pane-row-status.is-unsaved::before { background: var(--status-warn-fg); }
.projects-pane-empty { padding: 14px 5px; color: var(--text-muted); font-size: 0.76rem; line-height: 1.5; }

.projects-pane-backdrop {
	position: fixed;
	inset: 0;
	z-index: 74;
	width: 100%;
	height: 100%;
	padding: 0;
	border: 0;
	background: rgba(9, 26, 22, 0.42);
}

.project-context-identity { grid-template-columns: minmax(0, 1fr); }
.project-context-copy strong { white-space: normal; overflow-wrap: anywhere; }
.project-context-copy .project-context-save-status { width: max-content; margin-top: 3px; }
.project-context-head { gap: 10px; padding: 16px 12px 12px; }
.project-context-workflow { padding: 6px 8px 12px; }
.project-context-section-list { gap: 4px; }
.project-context-section-button {
	min-height: 62px;
	grid-template-columns: 22px 30px minmax(0, 1fr) 12px;
	gap: 7px;
	padding: 7px;
}
.project-context-section-icon { width: 30px; height: 30px; }

@media (min-width: 1101px) {
	.workspace-shell > .content-pane { grid-column: 3; grid-row: 1; }
	.workspace-shell.has-collapsed-projects-panel {
		grid-template-columns: var(--design-navigation-width, 80px) 44px minmax(0, 1fr);
	}
	.projects-collapsed-pane { grid-column: 2; grid-row: 1; }
}
@media (min-width: 721px) {
	.project-collection-table-head {
		grid-template-columns: minmax(0, 1.25fr) minmax(40px, 0.65fr) minmax(60px, 1fr) 36px;
	}
	.project-collection-row-select {
		grid-template-columns: minmax(0, 1.25fr) minmax(40px, 0.65fr) minmax(60px, 1fr);
	}
	.project-collection-table-head > span { min-width: 0; overflow-wrap: anywhere; }
}
@media (min-width: 1441px) {
	.workspace-shell.has-projects-panel {
		/* The four supporting columns share no more than 40vw, leaving the
		   selected editor at least 60% of wide viewports. Reserve enough room
		   for the global navigation labels, then let the project directory use
		   the remainder of the outer 15vw navigation budget. */
		--workspace-navigation-rail-width: clamp(84px, var(--design-navigation-width, 84px), 96px);
		grid-template-columns:
			var(--workspace-navigation-rail-width)
			max(180px, calc(15vw - var(--workspace-navigation-rail-width)))
			minmax(0, 1fr);
	}
	.workspace-shell.has-projects-panel > .projects-pane { grid-column: 2; grid-row: 1; }
	.workspace-shell.has-projects-panel > .navigator-pane .navigator-primary-button > span {
		max-width: 100%;
		white-space: nowrap;
	}
	.workspace-shell.has-projects-panel > .navigator-pane .navigator-primary-button.is-active {
		box-shadow: 0 6px 12px -6px rgba(15, 118, 110, 0.34);
	}

	.workspace-shell.has-projects-panel > .content-pane.has-project-split.has-project-collection {
		grid-template-columns:
			min(var(--project-context-width, 260px), 12vw)
			min(var(--project-collection-width, 280px), 13vw)
			minmax(0, 1fr);
	}

	/* Project directory: compact two-line rows. */
	.projects-pane-head {
		gap: 8px;
		padding: 12px 10px 10px;
	}
	.projects-pane-heading { gap: 6px; }
	.projects-pane-heading h2 {
		min-width: 0;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}
	.projects-pane-close {
		min-width: 30px;
		min-height: 30px;
	}
	.projects-pane-create { min-height: 34px; }
	.projects-pane-search input { min-height: 32px; }
	.projects-pane-list {
		gap: 3px;
		padding: 7px 6px;
	}
	.projects-pane-row {
		gap: 7px;
		min-height: 58px;
		padding: 8px 7px;
	}
	.projects-pane-row-icon img {
		width: 19px;
		height: 19px;
	}
	.projects-pane-row-copy {
		grid-template-columns: minmax(0, 1fr) auto;
		gap: 2px 5px;
		width: 100%;
	}
	.projects-pane-row-copy strong {
		grid-column: 1 / -1;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}
	.projects-pane-row-copy > span {
		min-width: 0;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}
	.projects-pane-row-status { justify-self: end; }

	/* Workflow: preserve every step while reducing decorative space. */
	.project-context-head {
		gap: 8px;
		padding: 12px 9px 10px;
	}
	.project-context-copy strong {
		display: -webkit-box;
		overflow: hidden;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
		line-clamp: 2;
		white-space: normal;
	}
	.project-context-overview {
		min-height: 36px;
		padding: 7px 8px;
	}
	.project-context-workflow { padding: 5px 5px 10px; }
	.project-context-section-list { gap: 3px; }
	.project-context-section-button {
		min-height: 56px;
		grid-template-columns: 20px 28px minmax(0, 1fr);
		gap: 6px;
		padding: 6px;
	}
	.project-context-section-icon {
		width: 28px;
		height: 28px;
	}
	.project-context-section-open { display: none; }
	.project-context-section-copy {
		gap: 2px;
		overflow: hidden;
	}
	.project-context-section-copy strong,
	.project-context-section-copy span {
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}
	.project-context-section-copy .projects-status-badge {
		max-width: 100%;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	/* Keep the collection as a compact table within the narrow project column. */
	.project-collection-head {
		gap: 6px;
		padding: 12px 10px 10px;
	}
	.project-collection-head > div { flex-basis: 100%; }
	.project-collection-head h3 {
		overflow-wrap: anywhere;
	}
	.project-collection-head > div > p:last-child {
		display: none;
	}
	.project-collection-add {
		min-height: 32px;
		padding: 5px 8px;
	}
	.project-collection-table-head {
		position: static;
		width: auto;
		height: auto;
		min-height: 34px;
		grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.85fr) minmax(0, 0.85fr) 24px;
		gap: 4px;
		padding: 6px 9px;
		clip-path: none;
		overflow: visible;
		white-space: normal;
		font-size: 0.62rem;
		font-weight: 600;
		letter-spacing: 0;
		text-transform: none;
	}
	.project-collection-table-head > span {
		overflow-wrap: anywhere;
	}
	.project-collection-table-body {
		gap: 4px;
		padding: 7px 6px;
	}
	.project-collection-row {
		grid-template-columns: minmax(0, 1fr) 24px;
		gap: 0;
	}
	.project-collection-row-select {
		min-height: 34px;
		grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.85fr) minmax(0, 0.85fr);
		gap: 4px;
		padding: 6px 3px 6px 8px;
	}
	.project-collection-row-select strong {
		font-size: 0.69rem;
		line-height: 1.2;
		overflow: visible;
		text-overflow: clip;
		overflow-wrap: anywhere;
	}
	.project-collection-row-select span {
		font-size: 0.68rem;
		line-height: 1.2;
		overflow: visible;
		text-overflow: clip;
		overflow-wrap: anywhere;
	}
	.project-collection-row-select span::before {
		content: none;
	}
	.project-collection-delete {
		width: 22px;
		height: 22px;
	}
	.project-collection-delete img {
		width: 13px;
		height: 13px;
	}
}
@media (max-width: 1440px) {
	.projects-pane {
		position: fixed;
		inset: 0 auto 0 0;
		z-index: 75;
		width: min(300px, calc(100vw - 32px));
		padding-top: env(safe-area-inset-top);
		padding-bottom: env(safe-area-inset-bottom);
		box-shadow: 12px 0 36px rgba(15, 40, 34, 0.22);
	}
	.projects-pane-close { min-width: 40px; min-height: 40px; }
	.projects-panel-toggle { order: 2; flex-shrink: 0; min-height: 40px; }
	html.is-projects-panel-open { overflow: hidden; }
}
@media (max-width: 1100px) {
	.workspace-shell > .content-pane { grid-column: 1; }
}
@media (max-width: 720px) {
	.project-context-identity { grid-column: 1 / -1; }
	.projects-panel-toggle { min-width: 40px; padding-inline: 9px; }
	.projects-pane-row { min-height: 64px; }
}

/* A dwelling has an additional, user-entered Type value. */
.project-collection-pane.is-dwelling-types .project-collection-table-head {
	display: grid;
	grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.7fr) minmax(0, 0.7fr) minmax(0, 1fr) 24px;
	gap: 3px;
}
.project-collection-pane.is-dwelling-types .project-collection-row {
	grid-template-columns: minmax(0, 1fr) 24px;
	gap: 0;
}
.project-collection-pane.is-dwelling-types .project-collection-row-select {
	grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.7fr) minmax(0, 0.7fr) minmax(0, 1fr);
	gap: 3px;
}
.project-collection-pane.is-dwelling-types .project-collection-delete {
	width: 22px;
	height: 22px;
}
.project-collection-pane.is-dwelling-types .project-collection-table-head > span,
.project-collection-pane.is-dwelling-types .project-collection-row-select strong,
.project-collection-pane.is-dwelling-types .project-collection-row-select span {
	min-width: 0;
	white-space: normal;
	overflow-wrap: anywhere;
}
.project-collection-pane.is-dwelling-types .project-collection-row-select strong {
	grid-column: auto;
}
.project-collection-pane.is-dwelling-types .project-collection-row-select span {
	display: block;
}
.project-collection-pane.is-dwelling-types .project-collection-row-select span::before {
	content: none;
}
