:root {
	color-scheme: light;
	--bg: #f6f7f9;
	--panel: #ffffff;
	--ink: #172033;
	--muted: #667085;
	--line: #d7dce5;
	--accent: #146c5f;
	--accent-strong: #0f5248;
	--danger: #b42318;
	--soft: #eef5f3;
	font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--ink);
	font-size: 14px;
	min-height: 100vh;
}

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

button {
	border: 1px solid var(--line);
	border-radius: 6px;
	background: #fff;
	color: var(--ink);
	cursor: pointer;
	min-height: 38px;
	padding: 0 12px;
}

button:hover:not(:disabled) {
	background: var(--soft);
	border-color: var(--accent);
	color: var(--accent-strong);
}

button.primary {
	background: var(--accent);
	border-color: var(--accent);
	color: #fff;
	font-weight: 700;
}

button.primary:hover:not(:disabled) {
	background: var(--accent-strong);
	border-color: var(--accent-strong);
	color: #fff;
}

button:disabled {
	background: #f2f4f7;
	color: #98a2b3;
	cursor: not-allowed;
}

button.danger {
	color: var(--danger);
	min-height: 30px;
}

input,
select,
textarea {
	width: 100%;
	border: 1px solid var(--line);
	border-radius: 6px;
	background: #fff;
	color: var(--ink);
	min-height: 38px;
	padding: 8px 10px;
}

textarea {
	min-height: 180px;
	resize: vertical;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 12px;
	line-height: 1.5;
}

label {
	display: flex;
	align-items: center;
	gap: 6px;
	width: fit-content;
	max-width: 100%;
	color: var(--muted);
	font-size: 12px;
	font-weight: 700;
	line-height: 18px;
	margin-bottom: 5px;
}

svg {
	stroke: currentColor;
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-width: 2;
}

.app {
	max-width: 1180px;
	margin: 0 auto;
	padding: 18px;
	min-height: 100vh;
}

.header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 14px;
}

.title-row-main {
	display: flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
}

.title {
	margin: 0;
	font-size: 22px;
	line-height: 1.2;
}

.status {
	color: var(--muted);
	min-height: 20px;
	overflow-wrap: anywhere;
}

.section-card,
.editor,
.list {
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: 8px;
}

.section-card {
	padding: 12px;
	margin-bottom: 12px;
}

.section-head {
	display: flex;
	align-items: center;
	gap: 9px;
	margin-bottom: 12px;
}

.step {
	display: inline-grid;
	place-items: center;
	width: 24px;
	height: 24px;
	border-radius: 999px;
	background: var(--accent);
	color: #fff;
	font-size: 12px;
	font-weight: 800;
}

.section-title {
	font-size: 13px;
	font-weight: 800;
	line-height: 1.2;
}

.section-subtitle,
.flow-note {
	color: var(--muted);
	font-size: 12px;
}

.flow-note {
	line-height: 1.4;
	margin-top: 8px;
}

.auth-controls {
	display: grid;
	grid-template-columns: 1fr auto auto;
	align-items: end;
	gap: 8px;
}

.data-controls {
	display: flex;
	flex-wrap: wrap;
	align-items: end;
	gap: 8px;
}

.button-group,
.actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.data-controls button {
	flex: 0 0 auto;
	min-width: 118px;
}

.field {
	min-width: 0;
	text-align: left;
}

.data-controls .field {
	flex: 1 1 240px;
	max-width: 360px;
}

.help {
	position: relative;
	display: inline-grid;
	place-items: center;
	width: 18px;
	height: 18px;
	flex: 0 0 auto;
	border: 1px solid var(--line);
	border-radius: 999px;
	background: #fff;
	color: var(--accent);
	font-size: 12px;
	font-weight: 800;
	line-height: 1;
	cursor: help;
}

.grid {
	display: grid;
	grid-template-columns: minmax(260px, 360px) 1fr;
	gap: 12px;
	min-height: clamp(560px, calc(100vh - 180px), 860px);
}

.list {
	overflow: hidden;
}

.list-head,
.editor-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 12px;
	border-bottom: 1px solid var(--line);
}

.list-search {
	padding: 10px 12px;
	border-bottom: 1px solid var(--line);
}

.list-head .section-head,
.editor-head .section-head {
	margin-bottom: 0;
}

.list-title,
.editor-title {
	font-weight: 700;
}

.items {
	height: calc(100% - 57px);
	min-height: 500px;
	overflow: auto;
}

.item {
	display: block;
	width: 100%;
	text-align: left;
	border: 0;
	border-bottom: 1px solid var(--line);
	border-radius: 0;
	padding: 11px 12px;
	min-height: 0;
}

.item.active {
	background: var(--soft);
	border-left: 4px solid var(--accent);
	padding-left: 8px;
}

.item-main {
	font-weight: 650;
	overflow-wrap: anywhere;
}

.item-sub {
	margin-top: 3px;
	color: var(--muted);
	font-size: 12px;
	overflow-wrap: anywhere;
}

.editor {
	min-height: 100%;
	overflow: visible;
}

.editor-body {
	padding: 12px;
}

.selection-chip {
	display: inline-flex;
	align-items: center;
	width: fit-content;
	border: 1px solid var(--accent);
	border-radius: 999px;
	background: var(--soft);
	color: var(--accent-strong);
	font-size: 12px;
	font-weight: 800;
	line-height: 1.2;
	margin-top: 6px;
	padding: 4px 8px;
}

.details-panel {
	border-bottom: 1px solid var(--line);
	margin-bottom: 12px;
	padding-bottom: 12px;
}

.details-title {
	font-size: 13px;
	font-weight: 800;
}

.title-row,
.label-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-bottom: 10px;
}

.label-row label {
	margin-bottom: 0;
}

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

.details-grid .wide {
	grid-column: 1 / -1;
}

.object-summary,
.meta-table {
	width: 100%;
	border-collapse: collapse;
	margin-bottom: 10px;
}

.object-summary th,
.object-summary td,
.meta-table th,
.meta-table td {
	border-bottom: 1px solid var(--line);
	padding: 7px 6px;
	text-align: left;
	vertical-align: top;
	overflow-wrap: anywhere;
}

.object-summary th,
.meta-table th {
	color: var(--muted);
	font-size: 12px;
	font-weight: 800;
}

.object-summary th {
	width: 180px;
}

.key-row {
	display: grid;
	grid-template-columns: minmax(120px, 220px) 1fr auto;
	gap: 8px;
	margin-bottom: 12px;
}

.icon-button {
	display: inline-grid;
	place-items: center;
	flex: 0 0 auto;
	width: 34px;
	min-width: 34px;
	min-height: 34px;
	padding: 0;
}

.icon-button svg {
	width: 17px;
	height: 17px;
}

.muted-value {
	color: var(--muted);
	font-style: italic;
}

@media (max-width: 760px) {
	.app {
		padding: 12px;
	}

	.header,
	.auth-controls,
	.grid,
	.details-grid,
	.key-row {
		grid-template-columns: 1fr;
	}

	.data-controls,
	.button-group {
		align-items: stretch;
	}

	.data-controls button,
	.data-controls .field,
	.button-group {
		flex: 1 1 100%;
		max-width: none;
		width: 100%;
	}

	.header {
		display: grid;
	}

	.items {
		height: auto;
		min-height: 360px;
	}
}
