* {
	box-sizing: border-box;
}

body {
	margin: 0;
	font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", sans-serif;
	color: #222;
	background: #fafafa;
}

.container {
	max-width: 90%;
	margin: 0 auto;
}

.pad {
	padding: 16px;
}

.narrow {
	max-width: 520px;
}

.row {
	display: flex;
}

.col {
	display: flex;
	flex-direction: column;
}

.wrap {
	flex-wrap: wrap;
}

.gap {
	gap: 8px;
}

.between {
	justify-content: space-between;
}

.center {
	justify-content: center;
	text-align: center;
}

.site-header {
	background: #fff;
	border-bottom: 1px solid #eee;
}

.site-footer {
	margin-top: 40px;
	padding: 16px;
	background: #fff;
	border-top: 1px solid #eee;
	font-size: 14px;
	color: #666;
}

.logo {
	font-size: 20px;
	margin: 0;
}

.nav {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	gap: 12px;
}

.nav a {
	text-decoration: none;
	color: #333;
}

.btn {
	background: var(--theme-primary);
	color: var(--theme-button-text, #fff);
	padding: 8px 14px;
	border-radius: 6px;
	text-decoration: none;
	display: inline-block;
	border: 1px solid var(--theme-primary);
	cursor: pointer;
}

.btn:hover {
	opacity: .9;
}

.btn.outline {
	background: transparent;
	color: var(--theme-primary);
	border: 1px solid var(--theme-primary);
}

.btn.danger {
	background: var(--theme-danger);
	border-color: var(--theme-danger);
}

.btn.small {
	padding: 6px 10px;
	font-size: 12px;
}

.card {
	background: #fff;
	border: 1px solid #eee;
	border-radius: 8px;
	padding: 12px;
}

.alert {
	padding: 10px;
	border-radius: 6px;
	margin-bottom: 10px;
}

.alert.error {
	background: #fee2e2;
	color: #991b1b;
}

label {
	display: flex;
	flex-direction: column;
	gap: 6px;
	font-weight: 600;
}

input,
select,
textarea {
	padding: 8px;
	border: 1px solid #ddd;
	border-radius: 6px;
	font: inherit;
}

.grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 12px;
}

.thumb {
	width: 100%;
	height: 180px;
	object-fit: cover;
	background: #f0f0f0;
	border-radius: 6px;
}

.thumb.small {
	height: 80px;
}

.full-img {
	max-width: 100%;
	height: auto;
	display: block;
}

.table {
	width: 100%;
	border-collapse: collapse;
	background: #fff;
}

.table th,
.table td {
	border: 1px solid #eee;
	padding: 8px;
	text-align: left;
}

.inline {
	display: inline;
}

.hero {
	display: grid;
	gap: 8px;
}

.muted {
	color: #666;
	font-size: 12px;
}

/* Builder */
.builder {
	align-items: flex-start;
}

.canvas-wrap {
	flex: 1 1 600px;
	min-width: 300px;
}

.board {
	position: relative;
	width: 100%;
	aspect-ratio: var(--w)/var(--h);
	background-image: var(--img);
	background-size: contain;
	background-repeat: no-repeat;
	background-position: center;
	border: 1px dashed #bbb;
}

.ph {
	position: absolute;
	transform: translate(-50%, -50%);
	background: rgba(255, 255, 255, 0.4);
	padding: 2px 6px;
	border: 1px solid #999;
	border-radius: 4px;
	cursor: move;
	user-select: none;
}

.panel {
	width: 320px;
	max-width: 100%;
}

/* Preview */
.preview-wrap {
	flex: 1 1 400px;
	min-width: 280px;
}

.canvas-responsive {
	max-width: 100%;
	height: auto;
	display: block;
}

/* Full-width responsive sections */
/*main .card,
main form,
main .row,
main .grid {
	width: 100%;
}
*/
/* Always wrap rows on small screens */
@media (max-width: 992px) {
	.row {
		flex-wrap: wrap;
	}
}

/* Make images inside cards scale to container */
.card img {
	max-width: 100%;
	height: auto;
	display: block;
}

/* Table responsiveness helper */
.table {
	width: 100%;
}

@media (max-width: 640px) {
	.nav {
		gap: 8px;
	}

	.thumb {
		height: 140px;
	}
}