@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root,
html[data-theme="dark"] {
	color-scheme: dark;
	--ink: #0d0d0d;
	--gold: #f5b301;
	--gold-dim: #c49202;
	--chrome: #101010;
	--panel: #141414;
	--panel-2: #1c1c1c;
	--line: #2c2c2c;
	--hover-line: #4a4a4a;
	--muted: #9a9488;
	--text: #f3efe6;
	--paper: #ece8de;
	--danger: #e24b4b;
	--ok: #3dba7a;
	--btn-hover: #242424;
	--dot-idle: #3a3a3a;
	--dash: #3a3a3a;
	--thumb: #0a0a0a;
	--preview-bg: #2a2a2a;
	--preview-dot: #3a3a3a;
	--toolbar: rgba(13, 13, 13, 0.92);
	--shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
	--nav-w: 200px;
	--form-w: 400px;
	--radius: 6px;
	--focus: 0 0 0 3px rgba(245, 179, 1, 0.35);
}

html[data-theme="light"] {
	color-scheme: light;
	--ink: #f7f4ec;
	--gold: #f5b301;
	--gold-dim: #c49202;
	--chrome: #fffdf8;
	--panel: #f4f0e6;
	--panel-2: #ffffff;
	--line: #e2d9c6;
	--hover-line: #c9bd9f;
	--muted: #6b6458;
	--text: #16140f;
	--paper: #faf7f0;
	--danger: #c0392b;
	--ok: #1f8a54;
	--btn-hover: #efe8d6;
	--dot-idle: #d4cbb6;
	--dash: #c9bd9f;
	--thumb: #ebe4d4;
	--preview-bg: #e7e1d3;
	--preview-dot: #d2c9b4;
	--toolbar: rgba(255, 253, 248, 0.94);
	--shadow: 0 24px 60px rgba(22, 20, 15, 0.12);
	--focus: 0 0 0 3px rgba(196, 146, 2, 0.28);
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

html,
body {
	height: 100%;
	margin: 0;
}

body {
	font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	background: var(--ink);
	color: var(--text);
	font-size: 14px;
	line-height: 1.5;
}

button,
input,
select,
textarea {
	font: inherit;
}

button {
	cursor: pointer;
}

:focus-visible {
	outline: none;
	box-shadow: var(--focus);
}

.app {
	display: grid;
	grid-template-rows: 64px 1fr;
	height: 100%;
}

.topbar {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 0 20px;
	border-bottom: 1px solid var(--line);
	background: var(--chrome);
}

.brand {
	display: flex;
	align-items: center;
	gap: 12px;
	min-width: 0;
}

.brand img {
	height: 36px;
	width: auto;
	display: block;
}

.brand-copy {
	min-width: 0;
}

.brand-copy strong {
	display: block;
	font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	letter-spacing: -0.02em;
	font-size: 18px;
	font-weight: 600;
	letter-spacing: 0.02em;
	line-height: 1.1;
}

.brand-copy span {
	display: block;
	font-size: 11px;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--gold);
	margin-top: 3px;
}

.topbar-actions {
	margin-left: auto;
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
	justify-content: flex-end;
}

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 40px;
	padding: 0 14px;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--panel-2);
	color: var(--text);
	text-decoration: none;
	transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.btn:hover {
	border-color: var(--hover-line);
	background: var(--btn-hover);
}

.sprite {
	position: absolute;
	width: 0;
	height: 0;
	overflow: hidden;
}

.ico {
	width: 16px;
	height: 16px;
	flex-shrink: 0;
	display: block;
}

.theme-switch {
	display: inline-flex;
	padding: 3px;
	border: 1px solid var(--line);
	border-radius: 8px;
	background: var(--ink);
}

.theme-switch button {
	width: 38px;
	min-height: 34px;
	padding: 0;
	border: 0;
	border-radius: 5px;
	background: transparent;
	color: var(--muted);
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.theme-switch .ico {
	width: 18px;
	height: 18px;
}

.theme-switch button:hover {
	color: var(--text);
}

.theme-switch button[aria-pressed="true"] {
	background: var(--gold);
	color: #0d0d0d;
}

.btn-icon {
	min-width: 40px;
	padding: 0 10px;
}

.nav-label {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
}

.btn-gold {
	background: var(--gold);
	border-color: var(--gold);
	color: #0d0d0d;
	font-weight: 700;
}

.btn-gold:hover {
	background: var(--gold-dim);
	border-color: var(--gold-dim);
	color: #0d0d0d;
}

.btn-ghost {
	background: transparent;
}

.btn[disabled] {
	opacity: 0.5;
	cursor: not-allowed;
}

.workspace {
	display: grid;
	grid-template-columns: var(--nav-w) var(--form-w) 1fr;
	min-height: 0;
}

.nav {
	border-right: 1px solid var(--line);
	padding: 16px 10px;
	overflow: auto;
	background: var(--chrome);
}

.nav button {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	text-align: left;
	padding: 10px 12px;
	margin-bottom: 4px;
	border: 0;
	border-radius: var(--radius);
	background: transparent;
	color: var(--muted);
	min-height: 44px;
}

.nav button:hover,
.nav button.is-active {
	background: var(--panel-2);
	color: var(--text);
}

.nav button.is-active {
	box-shadow: inset 3px 0 0 var(--gold);
}

.nav .dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--dot-idle);
	flex-shrink: 0;
}

.nav button.is-ready .dot {
	background: var(--ok);
}

.form-pane {
	border-right: 1px solid var(--line);
	overflow: auto;
	background: var(--panel);
	padding: 20px 18px 48px;
}

.form-pane h2 {
	font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	letter-spacing: -0.02em;
	font-size: 22px;
	font-weight: 600;
	margin: 0 0 6px;
}

.lede {
	color: var(--muted);
	margin: 0 0 20px;
	font-size: 13px;
}

.field {
	margin-bottom: 14px;
}

.field label {
	display: block;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--muted);
	margin-bottom: 6px;
}

.field input,
.field textarea,
.field select {
	width: 100%;
	background: var(--ink);
	border: 1px solid var(--line);
	color: var(--text);
	border-radius: var(--radius);
	padding: 10px 12px;
	min-height: 42px;
}

.field textarea {
	min-height: 88px;
	resize: vertical;
	line-height: 1.45;
}

.field input[type="date"] {
	min-height: 42px;
}

.counter {
	font-variant-numeric: tabular-nums;
	margin-top: 6px;
	font-size: 11px;
	letter-spacing: 0.04em;
	color: var(--muted);
	text-align: right;
}

.counter.is-over {
	color: var(--danger);
	font-weight: 600;
}

.order {
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

.order .btn-icon {
	min-width: 34px;
	min-height: 34px;
}

.field input:hover,
.field textarea:hover,
.field select:hover {
	border-color: var(--hover-line);
}

.row-2 {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
}

.import-box {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 8px;
	margin-bottom: 16px;
	padding: 12px;
	background: var(--panel-2);
	border: 1px dashed var(--dash);
	border-radius: var(--radius);
}

.import-box input {
	min-height: 42px;
	background: var(--ink);
	border: 1px solid var(--line);
	color: var(--text);
	border-radius: var(--radius);
	padding: 0 12px;
}

.thumb {
	display: block;
	width: 100%;
	height: 92px;
	object-fit: cover;
	border-radius: var(--radius);
	background: var(--thumb);
	margin-top: 8px;
	border: 1px solid var(--line);
}

.card-block {
	padding: 12px;
	margin-bottom: 14px;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--panel-2);
}

.card-block header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 10px;
	font-weight: 600;
	font-size: 13px;
}

.preview-pane {
	position: relative;
	overflow: auto;
	background: var(--preview-bg);
	background-image: radial-gradient(var(--preview-dot) 0.7px, transparent 0.7px);
	background-size: 14px 14px;
}

.preview-toolbar {
	position: sticky;
	top: 0;
	z-index: 5;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 16px;
	background: var(--toolbar);
	border-bottom: 1px solid var(--line);
	backdrop-filter: blur(8px);
}

.preview-toolbar span {
	font-size: 11px;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--muted);
}

.preview-toolbar span:last-child {
	margin-left: auto;
}

.stage {
	padding: 24px 16px 48px;
	display: flex;
	justify-content: center;
}

.stage-inner {
	width: 640px;
	transform-origin: top center;
	box-shadow: var(--shadow);
	background: #fff;
}

.stage iframe {
	display: block;
	width: 640px;
	height: 2400px;
	border: 0;
	background: #e9e9e9;
}

.toast {
	position: fixed;
	bottom: 20px;
	right: 20px;
	z-index: 40;
	padding: 12px 16px;
	background: var(--gold);
	color: #0d0d0d;
	font-weight: 600;
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	transform: translateY(80px);
	opacity: 0;
	transition: transform 0.22s ease, opacity 0.22s ease;
}

.toast.is-on {
	transform: none;
	opacity: 1;
}

.toast.is-err {
	background: var(--danger);
	color: #fff;
}

.mobile-tabs {
	display: none;
}

.status {
	font-size: 12px;
	color: var(--muted);
}

.help {
	font-size: 12px;
	color: var(--muted);
	margin: 0 0 12px;
}

@media (max-width: 1100px) {
	.workspace {
		grid-template-columns: 1fr;
		grid-template-rows: auto 1fr auto;
	}

	.nav {
		display: flex;
		gap: 6px;
		overflow: auto;
		padding: 10px;
		border-right: 0;
		border-bottom: 1px solid var(--line);
	}

	.nav button {
		width: auto;
		white-space: nowrap;
		margin: 0;
	}

	.form-pane,
	.preview-pane {
		border-right: 0;
	}

	.preview-pane {
		min-height: 50vh;
	}
}

@media (max-width: 720px) {
	.brand-copy {
		display: none;
	}

	.row-2 {
		grid-template-columns: 1fr;
	}

	.mobile-tabs {
		display: flex;
		gap: 8px;
		padding: 8px 12px;
		border-bottom: 1px solid var(--line);
		background: var(--chrome);
	}

	.app.is-preview .form-pane,
	.app.is-form .preview-pane {
		display: none;
	}

	.app {
		grid-template-rows: 64px auto 1fr;
	}
}

@media (prefers-reduced-motion: reduce) {
	* {
		transition: none !important;
	}
}
