/* AM – Apparel Designer · frontend (GĐ01). Every selector is scoped to amad-. */
.amad-launcher,
.amad-shell {
	--amad-ink: #1b2230;
	--amad-muted: #596273;
	--amad-accent: #2f4a9e;
	--amad-accent-soft: #e9eef9;
	--amad-line: #d5dae3;
	--amad-stage: #eceef2;
	--amad-surface: #ffffff;
	--amad-danger: #a8261b;
	--amad-danger-soft: #fdecea;
}

/* Launcher ---------------------------------------------------------------- */
.amad-launcher {
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	margin: 12px 0 16px;
	clear: both;
}
.amad-launcher *,
.amad-launcher *::before,
.amad-launcher *::after { box-sizing: border-box; }

.amad-launcher .amad-launcher__button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-width: 240px;
	max-width: 100%;
	min-height: 48px;
	margin: 0;
	padding: 12px 22px;
	border: 1.5px solid var(--amad-accent);
	border-radius: 10px;
	background: var(--amad-surface);
	color: var(--amad-accent);
	font: inherit;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	text-transform: none;
	letter-spacing: normal;
	white-space: normal;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	touch-action: manipulation;
	transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.amad-launcher .amad-launcher__button:hover { background: var(--amad-accent-soft); }
.amad-launcher .amad-launcher__button:focus-visible { outline: 2px solid var(--amad-accent); outline-offset: 2px; }
.amad-launcher .amad-launcher__button[data-amad-ready="false"] {
	border-color: var(--amad-line);
	color: var(--amad-muted);
	background: var(--amad-surface);
}
.amad-launcher.amad-launcher--busy .amad-launcher__button { opacity: .7; cursor: progress; }

.amad-launcher .amad-launcher__icon {
	flex: none;
	width: 20px;
	height: 20px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.6;
	stroke-linejoin: round;
}
.amad-launcher .amad-launcher__label { overflow-wrap: anywhere; }

.amad-launcher .amad-launcher__notice {
	margin: 8px 0 0;
	padding: 8px 12px;
	border-left: 3px solid var(--amad-accent);
	background: var(--amad-accent-soft);
	color: var(--amad-ink);
	font-size: .9375rem;
	line-height: 1.45;
}
.amad-launcher .amad-launcher__notice[hidden] { display: none; }
.amad-launcher .amad-launcher__notice--success { border-left-color: #10703b; background: #e8f5ec; }
.amad-launcher .amad-launcher__notice--error { border-left-color: var(--amad-danger); background: var(--amad-danger-soft); }

@media (max-width: 600px) {
	.amad-launcher .amad-launcher__button { display: flex; width: 100%; min-width: 0; }
}

/* Shell ------------------------------------------------------------------- */
html.amad-shell-is-open,
html.amad-shell-is-open body { overflow: hidden; }

.amad-shell {
	position: fixed;
	inset: 0;
	z-index: 2147483000;
	display: grid;
	grid-template-rows: auto 1fr;
	height: 100%;
	height: 100dvh;
	margin: 0;
	background: var(--amad-stage);
	color: var(--amad-ink);
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 16px;
	line-height: 1.4;
	overscroll-behavior: contain;
	animation: amad-shell-in .18s ease-out;
}
.amad-shell *,
.amad-shell *::before,
.amad-shell *::after { box-sizing: border-box; }

@keyframes amad-shell-in {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
	.amad-shell { animation: none; }
}

.amad-shell .amad-shell__bar {
	display: flex;
	align-items: center;
	gap: 8px;
	min-height: 56px;
	padding: calc(env(safe-area-inset-top, 0px) + 6px) calc(env(safe-area-inset-right, 0px) + 12px) 6px calc(env(safe-area-inset-left, 0px) + 8px);
	background: var(--amad-surface);
	border-bottom: 1px solid var(--amad-line);
}
.amad-shell .amad-shell__back {
	display: inline-flex;
	flex: none;
	align-items: center;
	gap: 4px;
	min-height: 44px;
	margin: 0;
	padding: 0 14px 0 6px;
	border: 0;
	border-radius: 10px;
	background: transparent;
	color: var(--amad-accent);
	font: inherit;
	font-size: .9375rem;
	font-weight: 600;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}
.amad-shell .amad-shell__back:hover { background: var(--amad-accent-soft); }
.amad-shell .amad-shell__back:focus-visible { outline: 2px solid var(--amad-accent); outline-offset: 2px; }
.amad-shell .amad-shell__back-icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.amad-shell .amad-shell__title {
	flex: 1;
	min-width: 0;
	margin: 0;
	overflow: hidden;
	color: var(--amad-ink);
	font: inherit;
	font-size: 1rem;
	font-weight: 600;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.amad-shell .amad-shell__stage {
	display: flex;
	align-items: flex-start;
	justify-content: center;
	min-height: 0;
	overflow: auto;
	-webkit-overflow-scrolling: touch;
	padding: 24px calc(env(safe-area-inset-right, 0px) + 16px) calc(env(safe-area-inset-bottom, 0px) + 24px) calc(env(safe-area-inset-left, 0px) + 16px);
}
.amad-shell .amad-shell__adapter { width: 100%; max-width: 560px; }

.amad-shell .amad-foundation {
	padding: 20px;
	border: 1px solid var(--amad-line);
	border-radius: 14px;
	background: var(--amad-surface);
}
.amad-shell .amad-foundation__status { margin: 0 0 6px; font-size: 1.0625rem; font-weight: 600; }
.amad-shell .amad-foundation__hint { margin: 0 0 12px; color: var(--amad-muted); font-size: .9375rem; line-height: 1.5; }
.amad-shell .amad-foundation__facts { margin: 0; }
.amad-shell .amad-foundation__row {
	display: grid;
	grid-template-columns: 8.5rem minmax(0, 1fr);
	gap: 12px;
	padding: 10px 0;
	border-top: 1px solid var(--amad-line);
}
.amad-shell .amad-foundation__term { margin: 0; color: var(--amad-muted); font-size: .875rem; }
.amad-shell .amad-foundation__value { margin: 0; font-size: .9375rem; overflow-wrap: anywhere; }
.amad-shell .amad-foundation__swatch {
	display: inline-block;
	width: 14px;
	height: 14px;
	margin-right: 8px;
	border: 1px solid rgba(27, 34, 48, .25);
	border-radius: 4px;
	vertical-align: -2px;
}
@media (max-width: 420px) {
	.amad-shell .amad-foundation { padding: 16px; }
	.amad-shell .amad-foundation__row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}

/* GĐ03: saved design on the Product Page (owner-scoped, loaded by API — never in cached HTML). */
.amad-launcher .amad-launcher__saved[hidden] { display: none; }
.amad-launcher .amad-launcher__saved { margin: 0 0 10px; padding: 10px; border: 1px solid var(--amad-line, #dcdcde); border-radius: 10px; background: #fff; }
.amad-launcher .amad-launcher__previews { display: flex; gap: 8px; flex-wrap: wrap; }
.amad-launcher .amad-launcher__previews figure { margin: 0; width: 140px; max-width: calc(50% - 4px); }
.amad-launcher .amad-launcher__previews img { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: contain; background: #f2f3f5; border-radius: 6px; }
.amad-launcher .amad-launcher__previews figcaption { font-size: 12px; text-align: center; margin-top: 4px; color: #555; }
.amad-launcher .amad-launcher__saved-meta { margin: 8px 0; font-size: 14px; }
.amad-launcher .amad-launcher__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.amad-launcher .amad-launcher__action { min-height: 44px; padding: 0 14px; border: 1px solid var(--amad-accent, #2f4a9e); border-radius: 8px; background: #fff; color: var(--amad-accent, #2f4a9e); font-weight: 600; cursor: pointer; }
.amad-launcher .amad-launcher__action--new { background: var(--amad-accent, #2f4a9e); color: #fff; }
.amad-launcher.amad-launcher--saved .amad-launcher__button { display: none; }
@media (max-width: 600px) { .amad-launcher .amad-launcher__action { flex: 1 1 100%; } }
