/* Окно «Сохранить билд» и панель «Мои билды» (assets/builds.js). Цвета — из assets/theme.css. */

.bd-overlay {
	position: fixed;
	inset: 0;
	z-index: 3000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(6, 8, 18, .55);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	opacity: 0;
	transition: opacity .16s ease;
}
.bd-overlay.is-open { opacity: 1; }
.bd-overlay.is-closing { opacity: 0; }

.bd-card {
	position: relative;
	width: 100%;
	max-width: 460px;
	max-height: calc(100vh - 32px);
	overflow-y: auto;
	padding: 24px;
	color: var(--av-text);
	background: var(--av-surface);
	border: 1px solid var(--av-border);
	border-radius: 18px;
	box-shadow: var(--av-shadow-lg);
	transform: translateY(8px) scale(.98);
	transition: transform .16s ease;
}
.bd-overlay.is-open .bd-card { transform: none; }

.bd-x {
	position: absolute;
	top: 14px;
	right: 14px;
	width: 32px;
	height: 32px;
	padding: 6px;
	color: var(--av-faint);
	background: transparent;
	border: 0;
	border-radius: 8px;
	cursor: pointer;
}
.bd-x:hover { color: var(--av-text); background: var(--av-surface-3); }
.bd-x svg { width: 20px; height: 20px; display: block; }
.bd-x--static { position: static; }

.bd-head { display: flex; align-items: center; gap: 14px; padding-right: 32px; margin-bottom: 20px; }
.bd-head__icon {
	width: 48px;
	height: 48px;
	padding: 6px;
	object-fit: contain;
	background: var(--av-surface-2);
	border: 1px solid var(--av-border);
	border-radius: 12px;
}
.bd-head__title { font-size: 20px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.bd-head__sub { margin-top: 3px; font-size: 13px; color: var(--av-muted); }

.bd-form { display: flex; flex-direction: column; gap: 14px; }
.bd-field { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.bd-label { font-size: 13px; font-weight: 600; color: var(--av-text); }
.bd-label i { font-style: normal; font-weight: 500; color: var(--av-faint); margin-left: 4px; }
.bd-input {
	width: 100%;
	height: 42px;
	padding: 0 12px;
	font: 15px var(--av-font);
	color: var(--av-text);
	background: var(--av-surface-2);
	border: 1px solid var(--av-border);
	border-radius: 10px;
	outline: 0;
	transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.bd-input::placeholder { color: var(--av-faint); }
.bd-input:focus { background: var(--av-surface); border-color: var(--av-accent); box-shadow: 0 0 0 3px var(--av-accent-soft); }
.bd-input.is-invalid { border-color: var(--av-danger); box-shadow: 0 0 0 3px var(--av-danger-soft); }
.bd-textarea { height: auto; min-height: 76px; padding: 10px 12px; line-height: 1.45; resize: vertical; }

.bd-roles { display: flex; flex-wrap: wrap; gap: 6px; }
.bd-role { position: relative; margin: 0; cursor: pointer; }
.bd-role input { position: absolute; opacity: 0; pointer-events: none; }
.bd-role span {
	display: inline-flex;
	align-items: center;
	height: 32px;
	padding: 0 12px;
	font-size: 13px;
	font-weight: 600;
	color: var(--av-muted);
	background: var(--av-surface-2);
	border: 1px solid var(--av-border);
	border-radius: 999px;
	transition: color .15s, background-color .15s, border-color .15s;
}
.bd-role:hover span { color: var(--av-text); border-color: var(--av-border-strong); }
.bd-role input:checked + span { color: var(--av-accent); background: var(--av-accent-soft); border-color: var(--av-accent); }
.bd-role input:focus-visible + span { box-shadow: 0 0 0 3px var(--av-accent-ring); }

.bd-error, .bd-hint {
	padding: 10px 12px;
	font-size: 13px;
	line-height: 1.4;
	border-radius: 10px;
}
.bd-error { color: var(--av-danger); background: var(--av-danger-soft); }
.bd-hint { color: var(--av-gold); background: var(--av-gold-soft); }
.bd-note { margin: -4px 0 0; font-size: 12px; text-align: center; color: var(--av-faint); }

/* Результат */
.bd-done { text-align: center; padding: 12px 4px 4px; }
.bd-done__icon {
	width: 64px;
	height: 64px;
	margin: 0 auto 14px;
	padding: 16px;
	color: var(--av-success);
	background: var(--av-success-soft);
	border-radius: 50%;
}
.bd-done--local .bd-done__icon { color: var(--av-gold); background: var(--av-gold-soft); }
.bd-done__icon svg { width: 32px; height: 32px; display: block; }
.bd-done__title { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.bd-done p { margin: 8px 0 20px; font-size: 14px; line-height: 1.5; color: var(--av-muted); }
.bd-done p b { color: var(--av-text); }
.bd-done__actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* «Мои билды» — панель справа */
.bd-mine { justify-content: flex-end; align-items: stretch; padding: 0; }
.bd-drawer {
	width: 100%;
	max-width: 440px;
	height: 100%;
	display: flex;
	flex-direction: column;
	color: var(--av-text);
	background: var(--av-surface);
	border-left: 1px solid var(--av-border);
	box-shadow: var(--av-shadow-lg);
	transform: translateX(24px);
	transition: transform .18s ease;
}
.bd-mine.is-open .bd-drawer { transform: none; }
.bd-drawer__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 16px 14px 20px;
	border-bottom: 1px solid var(--av-border);
}
.bd-drawer__head b { font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.bd-drawer__count {
	margin-left: 8px;
	padding: 1px 8px;
	font-size: 12px;
	font-weight: 700;
	color: var(--av-muted);
	background: var(--av-surface-3);
	border-radius: 999px;
}
.bd-drawer__count:empty { display: none; }
.bd-drawer__body { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.bd-drawer__foot { padding: 12px 20px 16px; font-size: 12px; color: var(--av-faint); border-top: 1px solid var(--av-border); }

.bd-item {
	display: grid;
	grid-template-columns: 40px 1fr;
	gap: 4px 12px;
	padding: 12px;
	background: var(--av-surface-2);
	border: 1px solid var(--av-border);
	border-radius: 12px;
}
.bd-item__icon { width: 40px; height: 40px; object-fit: contain; }
.bd-item__main { min-width: 0; }
.bd-item__title { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-item__meta, .bd-item__stats { font-size: 12.5px; color: var(--av-muted); margin-top: 2px; }
.bd-item__stats { color: var(--av-faint); }
.bd-item__actions { grid-column: 2; display: flex; gap: 6px; margin-top: 8px; }
.bd-status {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	margin-top: 8px;
	padding: 2px 8px 2px 6px;
	font-size: 12px;
	font-weight: 600;
	border-radius: 999px;
}
.bd-status svg { width: 14px; height: 14px; }
.bd-status.is-sent { color: var(--av-success); background: var(--av-success-soft); }
.bd-status.is-local { color: var(--av-gold); background: var(--av-gold-soft); padding-left: 8px; }
.av-btn.bd-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.av-btn.bd-del { margin-left: auto; padding: 0 9px; color: var(--av-faint); }
.av-btn.bd-del:hover, .av-btn.bd-del.is-armed { color: var(--av-danger); border-color: var(--av-danger); background: var(--av-danger-soft); }

.bd-empty { margin: auto; padding: 40px 24px; text-align: center; color: var(--av-muted); }
.bd-empty svg { width: 40px; height: 40px; color: var(--av-faint); }
.bd-empty p { margin: 12px 0 4px; font-weight: 700; color: var(--av-text); }
.bd-empty span { font-size: 13px; }

@media (max-width: 500px) {
	.bd-overlay:not(.bd-mine) { align-items: flex-end; padding: 0; }
	.bd-card { max-width: none; border-radius: 18px 18px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); }
}
