.niwa-template-library {
	box-sizing: border-box;
	width: auto;
	max-width: none;
	min-height: calc(100vh - 96px);
	background: linear-gradient(116deg, #fbfbfd 0%, #f5f1fb 52%, #eceaf4 100%);
	margin: calc(var(--niwa-space-lg) * -1) calc(clamp(24px, 3vw, 56px) * -1) calc(var(--niwa-space-2xl) * -1);
	padding: 44px clamp(32px, 4vw, 72px) 72px;
	color: #111827;
}

.niwa-template-library > .niwa-template-hero,
.niwa-template-library > .niwa-template-library__bar,
.niwa-template-library > .niwa-template-brief,
.niwa-template-library > .niwa-template-grid,
.niwa-template-library > .niwa-template-create,
.niwa-template-library > .niwa-template-notice {
	width: min(100%, 1480px);
	margin-left: auto;
	margin-right: auto;
}

.niwa-template-hero {
	text-align: center;
	margin: 0 auto 28px;
}

.niwa-template-logo {
	font-size: 17px;
	font-weight: 700;
	letter-spacing: 0;
	margin-bottom: 16px;
}

.niwa-template-hero h1 {
	font-size: clamp(34px, 4vw, 54px);
	font-weight: 400;
	line-height: 1.08;
	margin: 0 0 36px;
}

.niwa-template-tabs {
	display: inline-flex;
	gap: 4px;
	padding: 5px;
	border-radius: 9px;
	background: rgba(255, 255, 255, 0.92);
	box-shadow: 0 1px 0 rgba(17, 24, 39, 0.06);
}

.niwa-template-tab {
	min-height: 31px;
	padding: 6px 13px;
	border: 0;
	border-radius: 7px;
	background: transparent;
	color: #263044;
	cursor: pointer;
	font-size: 14px;
}

.niwa-template-tab.is-active {
	background: #e7def4;
	color: #8b42c6;
}

.niwa-template-library__bar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 16px;
	margin: 26px 0 20px;
	color: #5f677a;
}

.niwa-template-brief {
	display: grid;
	grid-template-columns: minmax(220px, 320px) minmax(320px, 1fr) auto;
	gap: 14px;
	align-items: start;
	margin: 0 auto 22px;
	padding: 16px;
	border: 1px solid #d8d2e6;
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.84);
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.niwa-template-brief[hidden] {
	display: none;
}

.niwa-template-brief strong {
	display: block;
	margin: 0 0 4px;
	font-size: 14px;
	color: #111827;
}

.niwa-template-brief p {
	margin: 0;
	color: #5f677a;
	font-size: 13px;
	line-height: 1.45;
}

.niwa-template-brief textarea {
	width: 100%;
	min-height: 118px;
	resize: vertical;
	border-radius: 7px;
	border-color: #c8ccd8;
	font-family: inherit;
	font-size: 13px;
	line-height: 1.45;
}

.niwa-template-brief__actions {
	display: flex;
	flex-direction: column;
	gap: 8px;
	min-width: 142px;
}

.niwa-template-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 16px;
}

.niwa-template-card {
	min-width: 0;
}

.niwa-template-card__media {
	aspect-ratio: 16 / 9;
	background: #eef0f7;
	border-radius: 8px;
	overflow: hidden;
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.09);
}

.niwa-template-card__media img {
	width: 100%;
	height: 100%;
	display: block;
	object-fit: cover;
}

.niwa-template-card h2 {
	font-size: 16px;
	line-height: 1.25;
	margin: 14px 0 6px;
}

.niwa-template-card p {
	margin: 0 0 34px;
	color: #263044;
	font-size: 14px;
	line-height: 1.45;
	min-height: 40px;
}

.niwa-template-card .button {
	border-radius: 7px;
}

.niwa-template-or {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	gap: 14px;
	align-items: center;
	width: min(100%, 360px);
	max-width: 360px;
	margin: 56px auto 24px;
	color: #5f677a;
}

.niwa-template-or span {
	height: 1px;
	background: #d6d9e4;
}

.niwa-template-or em {
	font-style: normal;
}

.niwa-template-create {
	display: flex;
	justify-content: center;
	gap: 10px;
	flex-wrap: wrap;
}

.niwa-template-create input,
.niwa-template-create select {
	min-height: 38px;
	border-radius: 7px;
	border-color: #c8ccd8;
}

.niwa-template-create input {
	min-width: min(420px, 100%);
}

.niwa-template-notice {
	max-width: 720px;
	margin: 18px auto 0;
	padding: 12px 14px;
	border: 1px solid #b8dfc6;
	background: #f0fbf4;
	color: #14532d;
	border-radius: 8px;
}

.niwa-template-notice.is-error {
	border-color: #f2b8b8;
	background: #fff5f5;
	color: #991b1b;
}

.niwa-snippets-page .niwa-page-header {
	margin-bottom: 20px;
}

.wrap.niwa-snippets-page {
	max-width: none;
}

.niwa-snippet-table-wrap {
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 8px;
	overflow: hidden;
}

.niwa-snippet-table code {
	white-space: nowrap;
}

.niwa-snippet-state {
	display: inline-flex;
	align-items: center;
	min-height: 24px;
	padding: 2px 8px;
	border-radius: 999px;
	background: #eef0f5;
	color: #263044;
	font-size: 12px;
}

.niwa-snippet-state--live {
	background: #e9f8ee;
	color: #166534;
}

.niwa-snippet-state--draft {
	background: #fff7df;
	color: #854d0e;
}

.niwa-snippet-error td {
	color: #991b1b;
	background: #fff5f5;
}

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

@media (max-width: 760px) {
	.niwa-template-library {
		padding: 28px 18px 48px;
	}

	.niwa-template-tabs {
		display: grid;
		grid-template-columns: 1fr;
		width: 100%;
	}

	.niwa-template-brief {
		grid-template-columns: 1fr;
	}

	.niwa-template-brief__actions {
		flex-direction: row;
		flex-wrap: wrap;
	}

	.niwa-template-grid {
		grid-template-columns: 1fr;
	}
}
