:root {
	color-scheme: light;
	--page: #eef1f4;
	--surface: #ffffff;
	--surface-2: #f7f8fa;
	--surface-3: #f1f4f7;
	--ink: #111827;
	--muted: #6b7280;
	--soft: #8a94a3;
	--line: #d8dee6;
	--line-strong: #b8c2ce;
	--blue: #2454d6;
	--blue-soft: #e9efff;
	--green: #14785f;
	--green-soft: #e5f4ef;
	--amber: #9a6500;
	--amber-soft: #fff2d9;
	--violet: #6b4bc9;
	--violet-soft: #f0ecff;
	--red: #b4232f;
	--red-soft: #fff0f1;
	--shadow: 0 18px 40px rgba(17, 24, 39, 0.12);
	font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
	box-sizing: border-box;
}

html {
	min-width: 320px;
	scroll-behavior: smooth;
}

body {
	margin: 0;
	background: var(--page);
	color: var(--ink);
}

button,
input,
select,
textarea {
	font: inherit;
}

button {
	border: 1px solid var(--line);
	border-radius: 5px;
	background: var(--surface);
	color: var(--ink);
	min-height: 32px;
	padding: 0 10px;
	cursor: pointer;
}

button:hover,
button:focus-visible {
	border-color: var(--blue);
	outline: none;
	box-shadow: 0 0 0 2px rgba(36, 84, 214, 0.14);
}

input,
select,
textarea {
	width: 100%;
	border: 1px solid var(--line-strong);
	border-radius: 4px;
	background: #fff;
	color: var(--ink);
	min-height: 32px;
	padding: 7px 9px;
}

textarea {
	min-height: 180px;
	resize: vertical;
	font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
	font-size: 12px;
	line-height: 1.55;
}

.workspace {
	min-height: 100vh;
	display: grid;
	grid-template-rows: auto minmax(0, 1fr);
}

.shell-header {
	position: sticky;
	top: 0;
	z-index: 10;
	display: grid;
	grid-template-columns: minmax(230px, 310px) minmax(280px, 1fr) auto;
	gap: 12px;
	align-items: center;
	padding: 10px 14px;
	border-bottom: 1px solid var(--line);
	background: rgba(255, 255, 255, 0.96);
	backdrop-filter: blur(12px);
}

.document-title {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}

.wp-mark {
	width: 36px;
	height: 36px;
	display: grid;
	place-items: center;
	border: 1px solid #0f172a;
	border-radius: 50%;
	font-family: Georgia, serif;
	font-size: 22px;
	font-weight: 800;
	background: #fff;
	flex: 0 0 auto;
}

.kicker,
.section-number,
.card-label,
.meta-grid span,
.save-progress span,
.table-row span,
.artifact-list span,
.detail-meta span,
.field label,
.mini-label {
	margin: 0;
	color: var(--muted);
	font-size: 11px;
	font-weight: 750;
	letter-spacing: 0;
	text-transform: uppercase;
}

h1,
h2,
h3,
p {
	margin: 0;
}

.document-title h1 {
	font-size: 16px;
	line-height: 1.15;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.route-control {
	display: grid;
	grid-template-columns: auto auto minmax(140px, 1fr) auto auto;
	align-items: center;
	gap: 8px;
	min-width: 0;
}

.route-control label {
	color: var(--muted);
	font-size: 11px;
	font-weight: 750;
	text-transform: uppercase;
}

.header-actions,
.inline-actions {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 8px;
	white-space: nowrap;
}

.icon-action {
	width: 32px;
	padding: 0;
	display: inline-grid;
	place-items: center;
}

.primary {
	background: var(--blue);
	border-color: var(--blue);
	color: #fff;
	font-weight: 750;
}

.block {
	width: 100%;
	justify-content: center;
}

.state {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	border: 1px solid transparent;
	border-radius: 999px;
	padding: 4px 8px;
	font-size: 12px;
	font-weight: 800;
}

.state::before {
	content: "";
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: currentColor;
}

.state-unsaved {
	color: var(--amber);
	background: var(--amber-soft);
}

.state-saved {
	color: var(--green);
	background: var(--green-soft);
}

.page-grid {
	min-height: 0;
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(330px, 410px);
	gap: 14px;
	padding: 14px;
}

.document {
	min-width: 0;
	display: grid;
	gap: 12px;
	align-content: start;
}

.doc-cover,
.doc-section,
.detail-drawer {
	border: 1px solid var(--line);
	background: var(--surface);
	border-radius: 7px;
}

.doc-cover {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 250px;
	gap: 12px;
	padding: 16px;
}

.cover-main h2 {
	max-width: 760px;
	margin-top: 4px;
	font-size: clamp(24px, 3vw, 38px);
	line-height: 1.06;
	letter-spacing: 0;
}

.meta-grid {
	margin-top: 16px;
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	border: 1px solid var(--line);
	border-radius: 6px;
	overflow: hidden;
}

.meta-grid div {
	display: grid;
	gap: 5px;
	padding: 10px;
	background: var(--surface-2);
	border-right: 1px solid var(--line);
	min-width: 0;
}

.meta-grid div:last-child {
	border-right: 0;
}

.meta-grid strong {
	font-size: 13px;
	line-height: 1.25;
}

.cover-side {
	display: grid;
	gap: 8px;
	align-content: start;
}

.save-progress {
	margin-top: 4px;
	border: 1px solid var(--line);
	border-radius: 6px;
	padding: 10px;
	background: var(--surface-2);
	display: grid;
	gap: 8px;
}

.save-progress div:first-child {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
}

.save-progress strong {
	font-size: 12px;
}

.progress-bar {
	height: 7px;
	background: #d9dee7;
	border-radius: 999px;
	overflow: hidden;
}

.progress-bar span {
	display: block;
	width: 81%;
	height: 100%;
	background: linear-gradient(90deg, var(--blue), var(--green));
}

.section-index {
	display: flex;
	gap: 6px;
	overflow-x: auto;
	padding: 4px 0;
}

.section-index a {
	flex: 0 0 auto;
	text-decoration: none;
	color: var(--ink);
	border: 1px solid var(--line);
	background: var(--surface);
	border-radius: 999px;
	padding: 7px 11px;
	font-size: 12px;
	font-weight: 750;
}

.doc-section {
	padding: 12px;
	display: grid;
	gap: 12px;
}

.compact-section {
	gap: 10px;
}

.section-heading {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.section-heading h3 {
	font-size: 18px;
	line-height: 1.15;
}

.span-all {
	grid-column: 1 / -1;
}

.card-grid,
.source-grid,
.manager-matrix {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 8px;
}

.doc-card {
	text-align: left;
	min-height: 120px;
	padding: 12px;
	display: grid;
	align-content: start;
	gap: 7px;
	background: var(--surface);
	border-color: var(--line);
}

.doc-card strong,
.blueprint-strip strong,
.artifact-list strong {
	font-size: 14px;
	line-height: 1.2;
}

.doc-card small,
.blueprint-strip small,
.inline-note p,
.artifact-list span,
.drawer-text,
.field-help {
	color: var(--muted);
	font-size: 12px;
	line-height: 1.45;
}

.doc-card.active,
.selected-row {
	background: var(--blue-soft);
	border-color: #9ab2ff;
}

.card-label {
	width: max-content;
	padding: 3px 6px;
	border-radius: 999px;
	background: var(--surface-3);
	color: #4b5563;
}

.card-label.blue {
	background: var(--blue-soft);
	color: var(--blue);
}

.card-label.green {
	background: var(--green-soft);
	color: var(--green);
}

.card-label.amber {
	background: var(--amber-soft);
	color: var(--amber);
}

.card-label.violet {
	background: var(--violet-soft);
	color: var(--violet);
}

.gallery-tools {
	display: grid;
	grid-template-columns: minmax(190px, 260px) minmax(0, 1fr);
	gap: 8px;
	align-items: start;
}

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

.chips button {
	min-height: 30px;
	border-radius: 999px;
	color: var(--muted);
	background: var(--surface-3);
}

.chips .selected {
	background: var(--blue);
	border-color: var(--blue);
	color: #fff;
}

.blueprint-strip {
	display: grid;
	grid-template-columns: repeat(5, minmax(0, 1fr));
	gap: 8px;
}

.blueprint-strip button {
	text-align: left;
	padding: 0;
	overflow: hidden;
	display: grid;
	gap: 6px;
	align-content: start;
	background: #fff;
}

.blueprint-strip strong,
.blueprint-strip small {
	padding: 0 9px;
}

.blueprint-strip small {
	padding-bottom: 9px;
}

.thumb {
	display: block;
	height: 72px;
	border-bottom: 1px solid var(--line);
	background: linear-gradient(135deg, #dfe7f3, #fff);
}

.thumb.art {
	background:
		linear-gradient(90deg, rgba(16, 80, 70, 0.8), rgba(207, 155, 76, 0.55)),
		linear-gradient(135deg, #9cc8c0 0 34%, #f3d6a4 34% 66%, #6a2d65 66%);
}

.thumb.coffee {
	background:
		linear-gradient(180deg, rgba(72, 30, 111, 0.9) 0 48%, rgba(240, 166, 86, 0.85) 48%),
		repeating-linear-gradient(90deg, #3b1c62 0 20px, #ffbf75 20px 40px);
}

.thumb.feed {
	background:
		linear-gradient(180deg, #f8fbff 0 72%, #d6e2ff 72%),
		repeating-linear-gradient(0deg, transparent 0 12px, #c6d3f7 12px 13px);
}

.thumb.gaming {
	background:
		linear-gradient(135deg, rgba(23, 23, 23, 0.96), rgba(23, 23, 23, 0.2)),
		radial-gradient(circle at 18% 72%, #f46a2c, transparent 34%),
		linear-gradient(135deg, #180b05, #d6e9ff);
}

.thumb.nonprofit {
	background:
		linear-gradient(90deg, rgba(68, 37, 20, 0.76), rgba(122, 62, 20, 0.35)),
		radial-gradient(circle at 72% 48%, #e2c090, #6d3b1b 56%, #23140c);
}

.two-column {
	grid-template-columns: minmax(0, 1.3fr) minmax(220px, 0.7fr);
}

.table-card {
	border: 1px solid var(--line);
	border-radius: 6px;
	overflow: hidden;
}

.table-row {
	width: 100%;
	border: 0;
	border-bottom: 1px solid var(--line);
	border-radius: 0;
	display: grid;
	grid-template-columns: 1fr 1fr 160px;
	gap: 10px;
	align-items: center;
	text-align: left;
	min-height: 46px;
	padding: 9px 10px;
}

.table-row:last-child {
	border-bottom: 0;
}

.table-row.head {
	background: var(--surface-3);
	min-height: 34px;
}

.inline-note {
	border: 1px solid var(--line);
	border-left: 3px solid var(--blue);
	border-radius: 6px;
	padding: 12px;
	background: var(--surface-2);
}

.inline-note p {
	margin-top: 7px;
}

.preview-card {
	background:
		linear-gradient(180deg, #20252b 0 24px, #ffffff 24px);
}

.mini-chrome {
	color: #eef2f7;
	font-size: 11px;
}

.artifact-list {
	display: grid;
	grid-template-columns: repeat(5, minmax(0, 1fr));
	gap: 8px;
}

.artifact-list button {
	min-height: 86px;
	padding: 10px;
	text-align: left;
	display: grid;
	gap: 6px;
	align-content: start;
}

.detail-drawer {
	position: sticky;
	top: 72px;
	max-height: calc(100vh - 86px);
	overflow: auto;
	align-self: start;
	box-shadow: var(--shadow);
}

.drawer-top {
	position: sticky;
	top: 0;
	background: rgba(255, 255, 255, 0.96);
	backdrop-filter: blur(10px);
	display: flex;
	justify-content: space-between;
	align-items: start;
	gap: 12px;
	padding: 14px;
	border-bottom: 1px solid var(--line);
	z-index: 2;
}

.drawer-top h2 {
	font-size: 18px;
	line-height: 1.2;
	margin-top: 2px;
}

.drawer-content {
	padding: 14px;
	display: grid;
	gap: 12px;
}

.detail-card,
.form-card,
.code-card,
.mini-preview,
.log-panel {
	border: 1px solid var(--line);
	border-radius: 6px;
	background: var(--surface-2);
	padding: 12px;
}

.detail-card {
	display: grid;
	gap: 9px;
}

.detail-card h3,
.form-card h3,
.code-card h3 {
	margin: 0;
	font-size: 15px;
}

.detail-actions,
.segmented,
.button-row {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.detail-meta {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 8px;
}

.detail-meta div {
	border: 1px solid var(--line);
	border-radius: 5px;
	background: #fff;
	padding: 9px;
	display: grid;
	gap: 4px;
}

.detail-meta strong {
	font-size: 13px;
}

.form-card {
	display: grid;
	gap: 10px;
}

.field {
	display: grid;
	gap: 6px;
}

.check-row {
	display: flex;
	align-items: center;
	gap: 8px;
	color: var(--ink);
	font-size: 13px;
}

.check-row input {
	width: 16px;
	min-height: 16px;
}

.code-card pre,
.log-panel pre {
	overflow: auto;
	margin: 0;
	border: 1px solid var(--line);
	border-radius: 5px;
	background: #111827;
	color: #dbeafe;
	padding: 10px;
	font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
	font-size: 12px;
	line-height: 1.5;
}

.mini-preview {
	padding: 0;
	overflow: hidden;
	background: #fff;
}

.preview-bar {
	height: 26px;
	background: #1f242a;
	color: #e5e7eb;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 0 9px;
	font-size: 11px;
}

.preview-site {
	padding: 12px;
}

.preview-site nav {
	display: flex;
	justify-content: space-between;
	gap: 10px;
	font-size: 12px;
	border-bottom: 1px solid var(--line);
	padding-bottom: 10px;
}

.preview-hero {
	margin-top: 20px;
	display: grid;
	grid-template-columns: minmax(0, 1fr) 104px;
	gap: 12px;
	align-items: center;
}

.preview-hero h4 {
	margin: 0;
	font-family: Georgia, serif;
	font-size: 28px;
	line-height: 1.05;
}

.preview-hero h4 span {
	color: #3858e9;
}

.wp-orbit {
	width: 104px;
	height: 104px;
	display: grid;
	place-items: center;
	border: 11px solid #32e875;
	border-radius: 50%;
	font-family: Georgia, serif;
	font-size: 54px;
	font-weight: 800;
}

.file-layout {
	display: grid;
	grid-template-columns: 120px minmax(0, 1fr);
	gap: 10px;
}

.file-tree {
	display: grid;
	gap: 5px;
	align-content: start;
}

.file-tree span {
	border: 1px solid var(--line);
	border-radius: 4px;
	background: #fff;
	padding: 6px;
	font-size: 12px;
}

.pill-danger {
	color: var(--red);
	background: var(--red-soft);
	border-color: #ffc9cf;
}

@media (max-width: 1180px) {
	.page-grid {
		grid-template-columns: minmax(0, 1fr);
	}

	.detail-drawer {
		position: static;
		max-height: none;
	}

	.artifact-list,
	.blueprint-strip {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (max-width: 860px) {
	.shell-header {
		position: static;
		grid-template-columns: 1fr;
	}

	.route-control {
		grid-template-columns: auto auto minmax(110px, 1fr);
	}

	.route-control button:not(.icon-action) {
		display: none;
	}

	.header-actions {
		justify-content: start;
		overflow-x: auto;
		padding-bottom: 2px;
	}

	.doc-cover,
	.two-column,
	.gallery-tools {
		grid-template-columns: 1fr;
	}

	.meta-grid,
	.card-grid,
	.source-grid,
	.manager-matrix,
	.artifact-list,
	.blueprint-strip {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.table-row {
		grid-template-columns: 1fr;
		gap: 4px;
	}
}

@media (max-width: 560px) {
	.page-grid {
		padding: 8px;
		gap: 8px;
	}

	.doc-cover,
	.doc-section,
	.drawer-content,
	.drawer-top {
		padding: 10px;
	}

	.cover-main h2 {
		font-size: 24px;
	}

	.meta-grid,
	.card-grid,
	.source-grid,
	.manager-matrix,
	.artifact-list,
	.blueprint-strip,
	.detail-meta,
	.preview-hero,
	.file-layout {
		grid-template-columns: 1fr;
	}

	.section-heading {
		align-items: stretch;
		flex-direction: column;
	}

	.section-heading button,
	.inline-actions button {
		width: 100%;
	}

	.inline-actions {
		display: grid;
		grid-template-columns: 1fr 1fr;
	}

	.blueprint-strip .thumb {
		height: 96px;
	}
}
