.pwc-wrap {
	--pwc-bg: #ffffff;
	--pwc-bg-soft: #f4f5f7;
	--pwc-bg-accent: #eaf1fd;
	--pwc-text: #1f2329;
	--pwc-text-soft: #6b7280;
	--pwc-text-accent: #1d4ed8;
	--pwc-border: #e2e4e8;
	--pwc-radius: 10px;

	box-sizing: border-box;
	max-width: 720px;
	margin: 0 auto;
	font-family: inherit;
	color: var(--pwc-text);
	direction: rtl;
	text-align: right;
}

.pwc-wrap *,
.pwc-wrap *::before,
.pwc-wrap *::after {
	box-sizing: border-box;
}

/* ===== تب‌ها ===== */
.pwc-tabs {
	display: flex;
	gap: 6px;
	margin-bottom: 16px;
	background: var(--pwc-bg-soft);
	padding: 5px;
	border-radius: var(--pwc-radius);
}

.pwc-tab {
	flex: 1 1 0;
	height: 42px;
	border: none;
	border-radius: calc(var(--pwc-radius) - 3px);
	background: transparent;
	color: var(--pwc-text-soft);
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	white-space: nowrap;
}

.pwc-tab:hover { color: var(--pwc-text); }

.pwc-tab.pwc-tab-active {
	background: var(--pwc-bg);
	color: var(--pwc-text-accent);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.pwc-panel[hidden] { display: none; }

/* ===== ردیف‌های فرم ===== */
.pwc-row {
	display: flex;
	gap: 8px;
	margin-bottom: 14px;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: center;
}

.pwc-wrap select,
.pwc-wrap input[type="text"],
.pwc-wrap input[type="number"],
.pwc-wrap input[type="search"] {
	height: 38px;
	border: 1px solid var(--pwc-border);
	border-radius: var(--pwc-radius);
	background: var(--pwc-bg);
	color: var(--pwc-text);
	padding: 0 10px;
	font-size: 14px;
	width: 100%;
	direction: rtl;
}

/* جستجوی دستگاه */
.pwc-search-box {
	position: relative;
	margin-bottom: 10px;
}

.pwc-search-box input[type="search"] {
	padding-right: 34px;
}

.pwc-search-box input[type="search"]::-webkit-search-cancel-button {
	-webkit-appearance: none;
}

.pwc-search-icon {
	position: absolute;
	right: 11px;
	top: 50%;
	transform: translateY(-50%);
	width: 16px;
	height: 16px;
	pointer-events: none;
	opacity: 0.45;
}

.pwc-search-icon svg { width: 100%; height: 100%; display: block; }

/* ردیف انتخاب دستگاه + تعداد + افزودن: همه در یک خط، جاستیفای */
.pwc-device-row {
	display: flex;
	gap: 8px;
	flex-wrap: nowrap;
	align-items: stretch;
	justify-content: space-between;
	margin-bottom: 14px;
}

.pwc-device-select { flex: 1 1 auto; min-width: 0; }

.pwc-qty {
	width: 64px;
	flex: 0 0 64px;
	text-align: center;
}

.pwc-add-btn {
	flex: 0 0 auto;
}

@media (max-width: 480px) {
	.pwc-device-row {
		flex-wrap: wrap;
	}
	.pwc-device-row .pwc-device-select {
		flex: 1 1 100%;
	}
	.pwc-device-row .pwc-qty {
		flex: 1 1 auto;
	}
	.pwc-device-row .pwc-add-btn {
		flex: 1 1 auto;
	}
}

/* ردیف انتخاب دستگاه صنعتی: نام + توان (هر دو جدا)، تعداد + افزودن */
.pwc-device-row-industrial {
	flex-direction: column;
	gap: 8px;
}

.pwc-device-row-line1,
.pwc-device-row-line2 {
	display: flex;
	gap: 8px;
	justify-content: space-between;
}

.pwc-device-row-line1 .pwc-device-select {
	flex: 2 1 auto;
	min-width: 0;
}

.pwc-device-row-line1 .pwc-watt-input {
	flex: 1 1 130px;
	text-align: center;
}

.pwc-device-row-line2 .pwc-qty {
	flex: 0 0 64px;
}

.pwc-device-row-line2 .pwc-add-btn {
	flex: 1 1 auto;
}

@media (max-width: 480px) {
	.pwc-device-row-line1 .pwc-device-select {
		flex: 1 1 60%;
	}
	.pwc-device-row-line1 .pwc-watt-input {
		flex: 1 1 35%;
	}
	.pwc-device-row-line2 .pwc-qty {
		flex: 1 1 auto;
	}
}

.pwc-custom-name { flex: 2 1 160px; }
.pwc-custom-watt,
.pwc-custom-surge { flex: 1 1 100px; }

.pwc-wrap button {
	height: 38px;
	border: 1px solid var(--pwc-border);
	border-radius: var(--pwc-radius);
	background: var(--pwc-bg-soft);
	color: var(--pwc-text);
	padding: 0 16px;
	font-size: 14px;
	cursor: pointer;
	white-space: nowrap;
}

.pwc-wrap button:hover { background: #e9ebee; }
.pwc-wrap button:active { transform: scale(0.98); }

/* ===== لیست دستگاه‌های افزوده‌شده ===== */
.pwc-list-row {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 4px;
	border-bottom: 1px solid var(--pwc-border);
}

.pwc-list-row:last-child { border-bottom: none; }

.pwc-item-name { font-size: 14px; font-weight: 600; margin: 0; }
.pwc-item-meta { font-size: 12px; color: var(--pwc-text-soft); margin: 2px 0 0; }

.pwc-stepper-btn {
	width: 26px;
	height: 26px;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 16px;
	line-height: 1;
}

.pwc-del-btn {
	width: 26px;
	height: 26px;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 13px;
	flex: 0 0 auto;
}

.pwc-empty {
	font-size: 13px;
	color: var(--pwc-text-soft);
	text-align: center;
	padding: 18px 0;
}

/* ===== حاشیه ایمنی ===== */
.pwc-margin-box {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 18px 0;
	padding: 12px 14px;
	background: var(--pwc-bg-soft);
	border-radius: var(--pwc-radius);
}

.pwc-margin-box label {
	font-size: 13px;
	color: var(--pwc-text-soft);
	white-space: nowrap;
}

.pwc-wrap input[type="range"] { flex: 1; }

.pwc-margin-out {
	font-size: 14px;
	font-weight: 600;
	min-width: 38px;
	text-align: left;
}

/* ===== نتایج ===== */
.pwc-results {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 10px;
	margin-bottom: 14px;
}

.pwc-card {
	background: var(--pwc-bg-soft);
	border-radius: var(--pwc-radius);
	padding: 14px 10px;
	text-align: center;
}

.pwc-card.pwc-card-accent { background: var(--pwc-bg-accent); }

.pwc-card-label {
	font-size: 12px;
	color: var(--pwc-text-soft);
	margin: 0 0 6px;
}

.pwc-card.pwc-card-accent .pwc-card-label { color: var(--pwc-text-accent); }

.pwc-card-value {
	font-size: 19px;
	font-weight: 700;
	margin: 0;
}

.pwc-card.pwc-card-accent .pwc-card-value { color: var(--pwc-text-accent); }

.pwc-card-sub {
	font-size: 12px;
	margin: 3px 0 0;
	color: var(--pwc-text-accent);
}

.pwc-note {
	font-size: 13px;
	line-height: 1.9;
	color: var(--pwc-text-soft);
	margin: 0 0 16px;
}

.pwc-actions {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

.pwc-actions button { flex: 1 1 160px; }

@media (max-width: 480px) {
	.pwc-results { grid-template-columns: 1fr 1fr; }
	.pwc-results .pwc-card-accent { grid-column: span 2; }
}
