.sityn-optimizer-panel {
	--sityn-surface: #ffffff;
	--sityn-surface-soft: #f8fafc;
	--sityn-border: #d8dee7;
	--sityn-border-strong: #b7c2d0;
	--sityn-text: #172033;
	--sityn-muted: #667085;
	--sityn-primary: #2563eb;
	--sityn-primary-strong: #1d4ed8;
	--sityn-success: #15803d;
	--sityn-success-soft: #dcfce7;
	--sityn-shadow: 0 14px 36px rgba(23, 32, 51, 0.10);
	box-sizing: border-box;
	position: relative;
	overflow: hidden;
	margin: 0 0 14px;
	padding: 14px;
	border: 1px solid var(--sityn-border);
	border-radius: 8px;
	background: var(--sityn-surface);
	box-shadow: var(--sityn-shadow);
	color: var(--sityn-text);
	font-size: 13px;
	line-height: 1.4;
}

.sityn-optimizer-panel::before {
	content: "";
	position: absolute;
	inset: 0 0 auto;
	height: 3px;
	background: linear-gradient(90deg, var(--sityn-primary), #10b981);
}

.media-modal .sityn-optimizer-panel {
	margin: 12px;
}

.sityn-optimizer-panel *,
.sityn-optimizer-panel *::before,
.sityn-optimizer-panel *::after {
	box-sizing: border-box;
}

.sityn-optimizer-panel__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	margin-bottom: 14px;
	padding-top: 2px;
}

.sityn-optimizer-brand {
	display: flex;
	align-items: center;
	min-width: 0;
	gap: 10px;
}

.sityn-optimizer-logo {
	display: grid;
	flex: 0 0 34px;
	width: 34px;
	height: 34px;
	place-items: center;
	border-radius: 8px;
	background: #111827;
	color: #fff;
	font-size: 14px;
	font-weight: 700;
}

.sityn-optimizer-brand strong {
	display: block;
	font-size: 14px;
	font-weight: 700;
	letter-spacing: 0;
}

.sityn-optimizer-brand span[data-sityn-status] {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: 2px;
	color: var(--sityn-muted);
	font-size: 12px;
}

.sityn-optimizer-brand span[data-sityn-status]::before {
	content: "";
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #10b981;
	box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.14);
}

.sityn-optimizer-panel.is-disabled .sityn-optimizer-brand span[data-sityn-status]::before {
	background: #94a3b8;
	box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.16);
}

.sityn-optimizer-switch {
	display: inline-flex;
	align-items: center;
	flex: 0 0 auto;
	gap: 8px;
	margin: 0;
	cursor: pointer;
	font-weight: 600;
	color: var(--sityn-text);
}

.sityn-optimizer-switch input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.sityn-optimizer-switch span {
	position: relative;
	width: 42px;
	height: 24px;
	border: 1px solid var(--sityn-border-strong);
	border-radius: 999px;
	background: #e5e7eb;
	transition: background 160ms ease, border-color 160ms ease;
}

.sityn-optimizer-switch span::before {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
	transition: transform 160ms ease;
}

.sityn-optimizer-switch input:checked + span {
	border-color: var(--sityn-primary);
	background: var(--sityn-primary);
}

.sityn-optimizer-switch input:checked + span::before {
	transform: translateX(18px);
}

.sityn-optimizer-switch input:focus-visible + span {
	outline: 2px solid var(--sityn-primary);
	outline-offset: 2px;
}

.sityn-optimizer-switch b {
	font-size: 12px;
}

.sityn-optimizer-grid {
	display: grid;
	grid-template-columns: minmax(220px, 1.35fr) minmax(180px, 1fr) minmax(140px, 0.75fr);
	gap: 10px;
	align-items: stretch;
}

.sityn-optimizer-field {
	display: grid;
	gap: 8px;
	min-width: 0;
	margin: 0;
	padding: 10px;
	border: 1px solid var(--sityn-border);
	border-radius: 8px;
	background: var(--sityn-surface-soft);
}

.sityn-optimizer-field > span {
	color: var(--sityn-muted);
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
}

.sityn-optimizer-segmented {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 4px;
	padding: 4px;
	border: 1px solid var(--sityn-border);
	border-radius: 8px;
	background: #fff;
}

.sityn-optimizer-segmented label {
	min-width: 0;
	margin: 0;
}

.sityn-optimizer-segmented input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.sityn-optimizer-segmented span {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 30px;
	padding: 0 8px;
	border-radius: 6px;
	color: var(--sityn-muted);
	font-size: 12px;
	font-weight: 700;
	cursor: pointer;
	transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.sityn-optimizer-segmented input:checked + span {
	background: var(--sityn-primary);
	box-shadow: 0 6px 14px rgba(37, 99, 235, 0.25);
	color: #fff;
}

.sityn-optimizer-segmented input:focus-visible + span {
	outline: 2px solid var(--sityn-primary);
	outline-offset: 2px;
}

.sityn-optimizer-range {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 10px;
	align-items: center;
	min-height: 40px;
}

.sityn-optimizer-grid input[type="range"] {
	width: 100%;
	accent-color: var(--sityn-primary);
}

.sityn-optimizer-grid output {
	display: grid;
	min-width: 42px;
	height: 28px;
	place-items: center;
	border: 1px solid var(--sityn-border);
	border-radius: 6px;
	background: #fff;
	color: var(--sityn-primary-strong);
	font-weight: 800;
}

.sityn-optimizer-number {
	display: grid;
	grid-template-columns: 1fr auto;
	align-items: center;
	overflow: hidden;
	min-height: 40px;
	border: 1px solid var(--sityn-border);
	border-radius: 8px;
	background: #fff;
}

.sityn-optimizer-grid input[type="number"] {
	width: 100%;
	min-height: 38px;
	border: 0;
	background: transparent;
	box-shadow: none;
	font-weight: 700;
}

.sityn-optimizer-grid input[type="number"]:focus {
	box-shadow: none;
	outline: 2px solid var(--sityn-primary);
	outline-offset: -2px;
}

.sityn-optimizer-number small {
	padding: 0 10px;
	color: var(--sityn-muted);
	font-weight: 700;
}

.sityn-optimizer-progress {
	margin-top: 12px;
	padding: 12px;
	border: 1px solid var(--sityn-border);
	border-radius: 8px;
	background: #fff;
}

.sityn-optimizer-progress__label,
.sityn-optimizer-savings,
.sityn-optimizer-file {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 8px;
	align-items: center;
}

.sityn-optimizer-progress__label {
	margin-bottom: 8px;
	color: var(--sityn-muted);
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
}

.sityn-optimizer-progress__label b {
	color: var(--sityn-text);
	font-size: 13px;
}

.sityn-optimizer-savings {
	margin-top: 12px;
	padding: 10px;
	border: 1px solid #bbf7d0;
	border-radius: 8px;
	background: var(--sityn-success-soft);
	color: var(--sityn-success);
}

.sityn-optimizer-savings span {
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
}

.sityn-optimizer-savings strong {
	font-size: 17px;
	font-weight: 800;
}

.sityn-optimizer-bar {
	grid-column: 1 / -1;
	overflow: hidden;
	height: 8px;
	border-radius: 999px;
	background: #e5e7eb;
}

.sityn-optimizer-bar span {
	display: block;
	width: 0;
	height: 100%;
	border-radius: inherit;
	background: linear-gradient(90deg, var(--sityn-primary), #10b981);
	transition: width 160ms ease;
}

.sityn-optimizer-files {
	display: grid;
	gap: 8px;
	margin-top: 10px;
}

.sityn-optimizer-file {
	padding: 9px 10px;
	border: 1px solid var(--sityn-border);
	border-radius: 8px;
	background: var(--sityn-surface-soft);
}

.sityn-optimizer-file__name {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-weight: 700;
}

.sityn-optimizer-file b {
	color: var(--sityn-primary-strong);
	font-size: 12px;
}

.sityn-optimizer-file small {
	grid-column: 1 / -1;
	color: var(--sityn-muted);
}

.sityn-optimizer-panel.is-disabled .sityn-optimizer-grid,
.sityn-optimizer-panel.is-disabled .sityn-optimizer-progress {
	opacity: 0.56;
}

@media (max-width: 960px) {
	.sityn-optimizer-grid {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 782px) {
	.sityn-optimizer-panel {
		padding: 12px;
	}

	.sityn-optimizer-panel__header {
		align-items: flex-start;
		flex-direction: column;
	}

	.sityn-optimizer-switch {
		width: 100%;
		justify-content: space-between;
	}

	.sityn-optimizer-segmented {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}
