/* Settings-style admin controls */
.subin-admin-page {
	--subin-settings-bg: #eef3f8;
	--subin-settings-card: #fff;
	--subin-settings-soft: #f8fafc;
	--subin-settings-border: #d8e2ee;
	--subin-settings-text: #172033;
	--subin-settings-muted: #64748b;
	--subin-settings-primary: #2563eb;
	--subin-settings-success: #16a34a;
	--subin-settings-warning: #d97706;
}

.subin-form-settings {
	box-sizing: border-box;
	margin-top: 18px;
	padding: 24px;
	background: var(--subin-settings-bg);
	border: 1px solid #e2e8f0;
	border-radius: 22px;
	color: var(--subin-settings-text);
}

.subin-form-settings *,
.subin-form-settings *::before,
.subin-form-settings *::after,
.subin-template-picker-modal *,
.subin-template-picker-modal *::before,
.subin-template-picker-modal *::after {
	box-sizing: border-box;
}

.subin-form-settings form {
	display: grid;
	gap: 18px;
	margin: 0;
}

.subin-settings-card {
	overflow: hidden;
	background: var(--subin-settings-card);
	border: 1px solid var(--subin-settings-border);
	border-radius: 18px;
	box-shadow: 0 18px 45px rgba(15, 23, 42, 0.06);
}

.subin-settings-card__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 18px;
	padding: 22px 24px;
	border-bottom: 1px solid var(--subin-settings-border);
}

.subin-settings-card__header h2 {
	margin: 0 0 6px;
	color: var(--subin-settings-text);
	font-size: 18px;
	font-weight: 700;
	line-height: 1.25;
}

.subin-settings-card__header p,
.subin-settings-field p,
.subin-settings-help {
	margin: 0;
	color: var(--subin-settings-muted);
	font-size: 13px;
	line-height: 1.5;
}

.subin-settings-card__body {
	display: grid;
	gap: 18px;
	padding: 22px 24px 24px;
	background: linear-gradient(180deg, #fff 0%, var(--subin-settings-soft) 100%);
}

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

.subin-settings-field {
	display: grid;
	gap: 8px;
}

.subin-settings-field label,
.subin-settings-checkbox,
.subin-settings-toggle strong {
	color: var(--subin-settings-text);
	font-size: 13px;
	font-weight: 650;
}

.subin-settings-field input[type="text"],
.subin-settings-field input[type="email"],
.subin-settings-field select {
	width: 100%;
	min-height: 42px;
	margin: 0;
	padding: 8px 12px;
	background: #fff;
	border: 1px solid var(--subin-settings-border);
	border-radius: 12px;
	color: var(--subin-settings-text);
	box-shadow: none;
}

.subin-settings-field input[type="text"]:focus,
.subin-settings-field input[type="email"]:focus,
.subin-settings-field select:focus {
	border-color: var(--subin-settings-primary);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
	outline: none;
}

.subin-settings-shortcode-row {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
	padding: 12px;
	background: var(--subin-settings-soft);
	border: 1px solid var(--subin-settings-border);
	border-radius: 14px;
}

.subin-settings-shortcode-row .subin-shortcode-pill {
	flex: 1 1 260px;
	padding: 10px 12px;
	background: #fff;
	border: 1px solid var(--subin-settings-border);
	border-radius: 10px;
	color: var(--subin-settings-text);
	font-size: 13px;
	white-space: normal;
	overflow-wrap: anywhere;
}

.subin-settings-button,
.subin-form-settings .button,
.subin-template-picker-modal .button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 38px;
	padding: 7px 14px;
	border-radius: 10px;
	font-weight: 650;
	line-height: 1.2;
}

.subin-form-settings .button-primary,
.subin-template-picker-modal .button-primary {
	background: var(--subin-settings-primary, #2563eb);
	border-color: var(--subin-settings-primary, #2563eb);
	color: #fff;
}

.subin-settings-toggle {
	display: grid;
	grid-template-columns: 46px minmax(0, 1fr);
	align-items: center;
	gap: 12px;
	margin: 0;
}

.subin-settings-toggle input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.subin-settings-toggle > span {
	position: relative;
	width: 46px;
	height: 26px;
	background: #cbd5e1;
	border-radius: 999px;
	transition: background 0.16s ease;
}

.subin-settings-toggle > span::after {
	position: absolute;
	top: 3px;
	left: 3px;
	width: 20px;
	height: 20px;
	background: #fff;
	border-radius: 50%;
	box-shadow: 0 1px 4px rgba(15, 23, 42, 0.22);
	content: "";
	transition: transform 0.16s ease;
}

.subin-settings-toggle input:checked + span {
	background: var(--subin-settings-primary, #2563eb);
}

.subin-settings-toggle input:checked + span::after {
	transform: translateX(20px);
}

.subin-settings-toggle input:focus-visible + span {
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.subin-settings-toggle--disabled {
	cursor: not-allowed;
	opacity: 0.58;
}

.subin-settings-toggle--disabled > span {
	background: #e2e8f0;
}

.subin-settings-checkbox {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0;
}

.subin-settings-radio {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	color: var(--subin-settings-text);
	font-size: 13px;
	font-weight: 500;
}

.subin-settings-radio input {
	margin: 0;
}

.subin-settings-checkbox input {
	margin: 0;
}

.subin-settings-warning {
	padding: 12px 14px;
	background: #fffbeb;
	border: 1px solid #fcd34d;
	border-radius: 12px;
	color: #92400e;
	font-size: 13px;
	line-height: 1.5;
}

.subin-auto-reply-settings {
	display: grid;
	gap: 18px;
}

.subin-auto-reply-settings.is-disabled {
	opacity: 0.62;
}

.subin-auto-reply-settings.is-disabled select,
.subin-auto-reply-settings.is-disabled .button {
	cursor: not-allowed;
}

.subin-auto-reply-template-empty,
.subin-auto-reply-template-selected,
.subin-template-picker-card {
	background: #fff;
	border: 1px solid var(--subin-settings-border);
	border-radius: 16px;
}

.subin-auto-reply-template-empty.is-disabled,
.subin-auto-reply-template-selected.is-disabled {
	background: #f8fafc;
	border-color: #d8e2ee;
}

.subin-auto-reply-template-empty {
	display: grid;
	gap: 10px;
	justify-items: start;
	padding: 22px;
}

.subin-auto-reply-template-empty__actions,
.subin-template-picker-modal__header-actions {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
}

.subin-auto-reply-template-empty h3,
.subin-auto-reply-template-selected h3,
.subin-template-picker-card h3 {
	margin: 0;
	color: var(--subin-settings-text, #172033);
	font-size: 15px;
	line-height: 1.3;
}

.subin-auto-reply-template-empty p,
.subin-template-picker-card p {
	margin: 0;
	color: var(--subin-settings-muted, #64748b);
	font-size: 13px;
	line-height: 1.5;
}

.subin-auto-reply-template-selected {
	display: grid;
	grid-template-columns: 220px minmax(0, 1fr);
	gap: 18px;
	padding: 16px;
}

.subin-auto-reply-template-selected__preview {
	min-width: 0;
}

.subin-auto-reply-template-selected__details {
	display: grid;
	gap: 14px;
	min-width: 0;
}

.subin-auto-reply-template-selected__top {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 14px;
}

.subin-auto-reply-template-selected__top > div:first-child {
	display: grid;
	gap: 8px;
}

.subin-auto-reply-template-selected__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	justify-content: flex-end;
}

.subin-template-meta-list {
	display: grid;
	grid-template-columns: 96px minmax(0, 1fr);
	gap: 8px 14px;
	margin: 0;
	padding: 14px;
	background: var(--subin-settings-soft, #f8fafc);
	border: 1px solid var(--subin-settings-border, #d8e2ee);
	border-radius: 12px;
}

.subin-template-meta-list dt {
	color: var(--subin-settings-muted, #64748b);
	font-size: 12px;
	font-weight: 650;
}

.subin-template-meta-list dd {
	margin: 0;
	color: var(--subin-settings-text, #172033);
	font-size: 13px;
	overflow-wrap: anywhere;
}

.subin-template-mini-preview {
	position: relative;
	display: grid;
	gap: 10px;
	min-height: 154px;
	padding: 14px;
	overflow: hidden;
	background: linear-gradient(180deg, #eff6ff 0%, #fff 100%);
	border: 1px solid #dbeafe;
	border-radius: 14px;
}

.subin-template-mini-preview iframe {
	position: absolute;
	top: 0;
	left: 0;
	width: 620px;
	height: 440px;
	border: 0;
	overflow: hidden;
	scrollbar-width: none;
	transform: scale(0.35);
	transform-origin: top left;
	pointer-events: none;
}

.subin-template-mini-preview iframe::-webkit-scrollbar {
	display: none;
}

.subin-auto-reply-template-selected__preview .subin-template-mini-preview {
	height: 172px;
}

.subin-auto-reply-template-selected__preview .subin-template-mini-preview iframe {
	transform: scale(0.35);
}

.subin-template-mini-preview__hero {
	height: 34px;
	background: linear-gradient(135deg, #2563eb, #60a5fa);
	border-radius: 10px;
}

.subin-template-mini-preview__card {
	display: grid;
	gap: 7px;
	padding: 12px;
	background: #fff;
	border: 1px solid #e2e8f0;
	border-radius: 12px;
}

.subin-template-mini-preview__card span {
	display: block;
	height: 7px;
	background: #dbeafe;
	border-radius: 999px;
}

.subin-template-mini-preview__card span:nth-child(2) {
	width: 72%;
}

.subin-template-mini-preview__card span:nth-child(3) {
	width: 46%;
}

.subin-template-mini-preview__subject {
	color: var(--subin-settings-text, #172033);
	font-size: 12px;
	font-weight: 700;
	line-height: 1.35;
}

.subin-settings-actions {
	display: flex;
	justify-content: flex-end;
	padding: 2px 0 0;
}

.subin-settings-actions .submit {
	margin: 0;
	padding: 0;
}

.subin-template-picker-open {
	overflow: hidden;
}

.subin-template-picker-modal[hidden] {
	display: none;
}

.subin-template-picker-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: grid;
	place-items: center;
	padding: 28px;
}

.subin-template-picker-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.52);
}

.subin-template-picker-modal__dialog {
	position: relative;
	z-index: 1;
	display: grid;
	gap: 20px;
	width: min(1040px, 100%);
	max-height: calc(100vh - 56px);
	overflow: auto;
	padding: 24px;
	background: #eef3f8;
	border: 1px solid #d8e2ee;
	border-radius: 22px;
	box-shadow: 0 28px 80px rgba(15, 23, 42, 0.32);
}

.subin-template-picker-modal__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 18px;
}

.subin-template-picker-modal__header h2 {
	margin: 0 0 6px;
	color: #172033;
	font-size: 20px;
	line-height: 1.25;
}

.subin-template-picker-modal__header p {
	margin: 0;
	color: #64748b;
	font-size: 13px;
}

.subin-template-picker-modal__header .button-link {
	color: #2563eb;
	text-decoration: none;
}

.subin-template-picker-modal__grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 16px;
}

.subin-template-picker-modal__empty {
	grid-column: 1 / -1;
	padding: 28px;
	background: #fff;
	border: 1px solid #d8e2ee;
	border-radius: 16px;
	color: #64748b;
	text-align: center;
}

.subin-template-picker-card {
	display: grid;
	gap: 14px;
	padding: 14px;
	transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.subin-template-picker-card:hover {
	border-color: #93c5fd;
	box-shadow: 0 18px 38px rgba(37, 99, 235, 0.12);
	transform: translateY(-1px);
}

.subin-template-picker-card__body {
	display: grid;
	gap: 12px;
}

.subin-template-picker-card__title {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 10px;
}

.subin-template-picker-card__subject {
	padding: 10px 12px;
	background: #f8fafc;
	border: 1px solid #d8e2ee;
	border-radius: 10px;
	color: #172033;
	font-size: 12px;
	font-weight: 650;
	line-height: 1.35;
}

.subin-template-picker-card .button {
	width: 100%;
}
@media (max-width: 900px) {
	.subin-form-settings {
		padding: 16px;
	}

	.subin-settings-card__header,
	.subin-auto-reply-template-selected__top,
	.subin-template-picker-modal__header {
		flex-direction: column;
	}

	.subin-settings-grid,
	.subin-auto-reply-template-selected,
	.subin-template-picker-modal__grid {
		grid-template-columns: 1fr;
	}

	.subin-auto-reply-template-selected__actions {
		justify-content: flex-start;
	}

	.subin-template-picker-modal {
		padding: 14px;
	}
}
