/* ZODIAC Studio – kreator szelek typu guard. Układ z ZONDA Studio (podgląd po lewej, kroki po prawej),
   wygląd ZODIAC: ciemne tło jak karta produktu, tokeny z zodiac-core (zodiac.css), Big Shoulders Display,
   IBM Plex Sans i IBM Plex Mono. Podgląd psa leży na jasnej karcie (jak zdjęcia produktów). */

.zs {
	--zs-text: var(--z-bone, #EDE7DC);
	--zs-bg: var(--z-black, #0F0E0D);
	--zs-surface: var(--z-surface-dark, #1C1A18);
	--zs-line: var(--z-line-dark, #2A2725);
	--zs-line-strong: #4A453F;
	--zs-muted: var(--z-muted-dark, #A39C92);
	--zs-red: var(--z-red, #B3261E);
	--zs-red-light: var(--z-red-light, #E8604F);
	--zs-paper: var(--z-image-bg, #ECE6DC);
	--zs-ink: var(--z-ink, #141210);
	--zs-ink-muted: var(--z-muted, #5E574F);
	--zs-display: var(--z-font-display, "Big Shoulders Display", "Arial Narrow", sans-serif);
	--zs-mono: var(--z-font-mono, "IBM Plex Mono", ui-monospace, monospace);
	--zs-radius: var(--z-radius, 6px);
	--zs-radius-sm: var(--z-radius-sm, 4px);
	/* Przyklejony nagłówek ZODIAC ma ok. 87 px – podgląd przykleja się pod nim. */
	--zs-sticky-top: 104px;
	display: grid;
	gap: 20px;
	color: var(--zs-text);
	font-family: var(--z-font-body, "IBM Plex Sans", system-ui, sans-serif);
	font-size: 16px;
	line-height: 1.5;
}

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

.zs p {
	margin: 0;
}

.zs [hidden] {
	display: none !important;
}

.zs :focus-visible {
	outline: 2px solid var(--zs-red-light);
	outline-offset: 2px;
}

/* ---------- Narzędzia ---------- */

.zs-tools {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.zs .zs-btn {
	min-height: 40px;
	padding: 0 14px;
	border: 1px solid var(--zs-line-strong);
	border-radius: var(--zs-radius-sm);
	background: transparent;
	color: var(--zs-text);
	font-family: var(--zs-mono);
	font-size: 12px;
	font-weight: 500;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	cursor: pointer;
}

.zs .zs-btn:hover,
.zs .zs-btn:focus {
	background: var(--zs-surface);
	border-color: var(--zs-text);
	color: var(--zs-text);
}

.zs .zs-btn[aria-pressed="true"],
.zs .zs-btn[aria-pressed="true"]:hover,
.zs .zs-btn[aria-pressed="true"]:focus {
	background: var(--zs-text);
	border-color: var(--zs-text);
	color: var(--zs-bg);
}

/* ---------- Układ ---------- */

.zs-grid {
	display: grid;
	grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
	gap: 40px;
	align-items: start;
}

.zs-stage {
	position: sticky;
	top: calc(var(--zs-sticky-top, 16px) + env(safe-area-inset-top, 0px));
	display: grid;
	gap: 12px;
	padding: 16px;
	background: var(--zs-paper);
	border-radius: var(--zs-radius);
	color: var(--zs-ink);
}

.zs-stage__svg svg {
	display: block;
	width: 100%;
	height: auto;
}

.zs-strap {
	cursor: pointer;
}

@media (prefers-reduced-motion: no-preference) {
	.zs-strap .zs-c,
	.zs-strap .zs-e {
		transition: stroke 0.2s ease;
	}
}

.zs-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 14px;
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 13px;
}

.zs-legend i {
	display: inline-block;
	width: 12px;
	height: 12px;
	margin-right: 6px;
	border: 1px solid rgba(15, 14, 13, 0.5);
	border-radius: 3px;
	vertical-align: -1px;
}

.zs-stage__foot {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 6px 12px;
	font-family: var(--zs-mono);
	font-size: 12px;
	color: var(--zs-ink-muted);
	text-transform: uppercase;
}

.zs-stage__foot b {
	color: var(--zs-ink);
}

.zs-panel {
	display: grid;
	gap: 32px;
	min-width: 0;
}

/* ---------- Kroki ---------- */

.zs-step {
	display: grid;
	gap: 12px;
}

.zs .zs-step__title,
.zs .zs-summary__title {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0;
	color: var(--zs-text);
	font-family: var(--zs-display);
	font-size: 28px;
	font-weight: 900;
	line-height: 1;
	text-transform: uppercase;
}

.zs-step__n {
	color: var(--zs-red-light);
	font-family: var(--zs-display);
	font-size: 28px;
	font-weight: 900;
	line-height: 1;
}

.zs-step__n:empty {
	display: none;
}

.zs-hint {
	font-size: 14px;
	color: var(--zs-muted);
}

.zs-hint a {
	color: var(--zs-text);
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.zs-seg {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.zs .zs-seg__btn {
	min-width: 56px;
	min-height: 46px;
	padding: 0 16px;
	border: 1px solid var(--zs-line-strong);
	border-radius: var(--zs-radius-sm);
	background: transparent;
	color: var(--zs-text);
	font-family: var(--zs-display);
	font-size: 20px;
	font-weight: 800;
	text-transform: uppercase;
	cursor: pointer;
}

.zs .zs-seg__btn:hover,
.zs .zs-seg__btn:focus {
	background: var(--zs-surface);
	border-color: var(--zs-text);
	color: var(--zs-text);
}

.zs .zs-seg__btn[aria-pressed="true"],
.zs .zs-seg__btn[aria-pressed="true"]:hover,
.zs .zs-seg__btn[aria-pressed="true"]:focus {
	background: var(--zs-text);
	border-color: var(--zs-text);
	color: var(--zs-bg);
}

/* Tabela rozmiarów */
.zs-table {
	overflow-x: auto;
	border: 1px solid var(--zs-line);
	border-radius: var(--zs-radius-sm);
}

.zs-table table {
	width: 100%;
	margin: 0;
	border-collapse: collapse;
	font-size: 14px;
	font-variant-numeric: tabular-nums;
}

.zs-table th,
.zs-table td {
	padding: 9px 12px;
	border: 0;
	border-top: 1px solid var(--zs-line);
	background: transparent;
	color: var(--zs-text);
	text-align: left;
	white-space: nowrap;
}

.zs-table th {
	border-top: 0;
	background: var(--zs-surface);
	color: var(--zs-muted);
	font-family: var(--zs-mono);
	font-size: 11px;
	font-weight: 500;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.zs-table tr.is-on td {
	background: var(--zs-surface);
	box-shadow: inset 3px 0 0 var(--zs-red);
}

/* Pola wyboru */
.zs-checks {
	display: grid;
	gap: 8px;
}

.zs-check {
	display: flex;
	align-items: center;
	gap: 12px;
	min-height: 52px;
	padding: 10px 14px;
	border: 1px solid var(--zs-line-strong);
	border-radius: var(--zs-radius-sm);
	background: transparent;
	cursor: pointer;
}

.zs-check input {
	flex: none;
	width: 20px;
	height: 20px;
	margin: 0;
	accent-color: var(--zs-red);
}

.zs-check span {
	flex: 1;
	font-weight: 600;
}

.zs-check em {
	font-family: var(--zs-mono);
	font-size: 13px;
	font-style: normal;
	font-weight: 500;
	white-space: nowrap;
	color: var(--zs-muted);
}

.zs-check:has(input:checked) {
	background: var(--zs-surface);
	border-color: var(--zs-text);
}

/* Szyte na wymiar */
.zs-custom {
	display: grid;
	gap: 14px;
	padding: 16px;
	background: var(--zs-surface);
	border-radius: var(--zs-radius-sm);
}

.zs-custom__drawing img {
	display: block;
	width: 100%;
	max-width: 420px;
	height: auto;
	margin: 0 auto;
	border-radius: var(--zs-radius-sm);
}

.zs-custom__drawing:empty {
	display: none;
}

.zs-custom__grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 12px;
	align-items: end;
}

.zs-measure {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.zs-measure__label {
	font-family: var(--zs-mono);
	font-size: 11px;
	font-weight: 500;
	letter-spacing: 0.04em;
	line-height: 1.3;
	text-transform: uppercase;
	color: var(--zs-muted);
}

.zs-measure__label b {
	display: inline-grid;
	place-items: center;
	width: 20px;
	height: 20px;
	margin-right: 4px;
	background: var(--zs-red);
	border-radius: 50%;
	color: #fff;
}

.zs-measure__input {
	display: flex;
	align-items: center;
	background: var(--zs-bg);
	border: 1px solid var(--zs-line-strong);
	border-radius: var(--zs-radius-sm);
}

.zs .zs-measure__input input,
.zs .zs-measure textarea {
	flex: 1;
	min-width: 0;
	height: 44px;
	padding: 0 10px;
	border: 0 !important;
	border-radius: var(--zs-radius-sm);
	background: transparent;
	box-shadow: none !important;
	color: var(--zs-text);
	font: inherit;
	font-size: 16px;
}

.zs .zs-measure textarea {
	height: auto;
	padding: 10px;
	background: var(--zs-bg);
	border: 1px solid var(--zs-line-strong) !important;
}

.zs-measure__input span {
	padding: 0 10px;
	font-family: var(--zs-mono);
	font-size: 12px;
	color: var(--zs-muted);
}

.zs-measure__input:focus-within {
	border-color: var(--zs-text);
}

.zs-measure__input:has([aria-invalid="true"]) {
	border-color: var(--zs-red-light);
	box-shadow: 0 0 0 1px var(--zs-red-light);
}

/* Kolory */
.zs-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.zs .zs-chip {
	display: flex;
	align-items: center;
	gap: 8px;
	min-height: 40px;
	padding: 4px 12px 4px 5px;
	border: 1px solid var(--zs-line-strong);
	border-radius: 999px;
	background: transparent;
	color: var(--zs-text);
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
}

.zs .zs-chip:hover,
.zs .zs-chip:focus {
	background: var(--zs-surface);
	border-color: var(--zs-text);
	color: var(--zs-text);
}

.zs .zs-chip[aria-pressed="true"] {
	border-color: var(--zs-red-light);
	box-shadow: inset 0 0 0 1px var(--zs-red-light);
}

.zs-chip i {
	width: 26px;
	height: 26px;
	border: 1px solid rgba(237, 231, 220, 0.35);
	border-radius: 50%;
}

.zs-chip__all {
	background: conic-gradient(#0F0E0D, #B3261E, #5B6B3A, #C8A24A, #1F2A44, #E8601C, #0F0E0D);
}

.zs-chip__n {
	font-family: var(--zs-mono);
	font-size: 11px;
	color: var(--zs-muted);
}

.zs-swatches {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
	gap: 12px 8px;
}

.zs .zs-sw:hover,
.zs .zs-sw:focus {
	background: none;
	color: var(--zs-text);
}

.zs .zs-sw {
	display: grid;
	justify-items: center;
	gap: 4px;
	padding: 0;
	border: 0;
	background: none;
	color: var(--zs-text);
	font-size: 12px;
	line-height: 1.2;
	text-align: center;
	cursor: pointer;
}

.zs-sw i {
	display: block;
	width: 48px;
	height: 48px;
	border: 1px solid rgba(237, 231, 220, 0.3);
	border-radius: var(--zs-radius);
	background-image: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.1) 0 2px, transparent 2px 5px);
}

.zs .zs-sw[aria-pressed="true"] i {
	outline: 2px solid var(--zs-red-light);
	outline-offset: 3px;
}

.zs-sw__tag {
	font-family: var(--zs-mono);
	font-size: 9px;
	font-weight: 500;
	letter-spacing: 0.08em;
	color: var(--zs-red-light);
}

/* ---------- Podsumowanie ---------- */

.zs-summary {
	display: grid;
	gap: 12px;
	padding: 24px;
	background: var(--zs-surface);
	border: 1px solid var(--zs-line);
	border-radius: var(--zs-radius);
	color: var(--zs-text);
}

.zs-summary__rows {
	display: grid;
	gap: 6px;
}

.zs-row {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	font-size: 15px;
	font-variant-numeric: tabular-nums;
}

.zs-row span:last-child {
	white-space: nowrap;
}

.zs-row--disc {
	color: var(--zs-red-light);
}

.zs-summary__total {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 12px;
	padding-top: 12px;
	border-top: 1px solid var(--zs-line-strong);
	font-family: var(--zs-display);
	font-size: 36px;
	font-weight: 900;
	line-height: 1;
	text-transform: uppercase;
}

.zs-summary__total .is-provisional {
	opacity: 0.7;
}

.zs-summary__note,
.zs-summary__legal {
	font-size: 13px;
	color: var(--zs-muted);
}

.zs-summary__legal {
	font-size: 12px;
}

.zs-summary__errors {
	padding: 10px 12px;
	background: rgba(179, 38, 30, 0.15);
	border-left: 3px solid var(--zs-red);
	border-radius: var(--zs-radius-sm);
	color: var(--zs-text);
	font-size: 14px;
	font-weight: 600;
}

.zs-summary__done {
	font-weight: 600;
	color: var(--zs-text);
}

.zs-summary__done a {
	color: var(--zs-text);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.zs .zs-cta {
	width: 100%;
	min-height: 56px;
	padding: 0 20px;
	border: 0;
	border-radius: var(--zs-radius-sm);
	background: var(--zs-red);
	color: #fff;
	font-family: var(--z-font-body, "IBM Plex Sans", system-ui, sans-serif);
	font-size: 17px;
	font-weight: 600;
	cursor: pointer;
}

.zs .zs-cta:hover,
.zs .zs-cta:focus {
	background: #9A1F18;
	color: #fff;
}

.zs .zs-cta[disabled] {
	opacity: 0.6;
	cursor: progress;
}

/* Wczytaj projekt */
.zs-load {
	display: flex;
	gap: 8px;
}

.zs .zs-load input {
	flex: 1;
	min-width: 0;
	height: 44px;
	padding: 0 12px;
	border: 1px solid var(--zs-line-strong);
	border-radius: var(--zs-radius-sm);
	background: var(--zs-bg);
	color: var(--zs-text);
	font-family: var(--zs-mono);
	font-size: 14px;
}

.zs-load .zs-btn {
	min-height: 44px;
}

/* Komunikat */
.zs-toast {
	position: fixed;
	z-index: 1000;
	bottom: calc(16px + env(safe-area-inset-bottom, 0px));
	left: 50%;
	max-width: calc(100% - 32px);
	padding: 12px 18px;
	transform: translateX(-50%);
	background: var(--zs-surface);
	border: 1px solid var(--zs-line-strong);
	border-left: 3px solid var(--zs-red);
	border-radius: var(--zs-radius-sm);
	color: var(--zs-text);
	font-size: 14px;
	font-weight: 600;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* ---------- Telefon i tablet ---------- */

@media (max-width: 900px) {
	.zs-grid {
		grid-template-columns: minmax(0, 1fr);
		gap: 28px;
	}

	.zs-stage {
		position: relative;
		top: 0;
	}
}

@media (max-width: 420px) {
	.zs-custom__grid {
		grid-template-columns: minmax(0, 1fr);
	}

	.zs .zs-step__title,
	.zs .zs-summary__title,
	.zs-step__n {
		font-size: 24px;
	}

	.zs-summary {
		padding: 16px;
	}
}

/* ---------- Zakładki podglądu i przymierzalnia ---------- */

.zs-tabs {
	display: flex;
	gap: 4px;
	width: max-content;
	max-width: 100%;
	padding: 4px;
	background: rgba(15, 14, 13, 0.08);
	border-radius: var(--zs-radius-sm);
}

.zs .zs-tabs button {
	min-height: 38px;
	padding: 0 16px;
	border: 0;
	border-radius: 3px;
	background: transparent;
	color: var(--zs-ink);
	font-family: var(--zs-display);
	font-size: 18px;
	font-weight: 800;
	text-transform: uppercase;
	cursor: pointer;
}

.zs .zs-tabs button:hover,
.zs .zs-tabs button:focus {
	background: rgba(15, 14, 13, 0.08);
	color: var(--zs-ink);
}

.zs .zs-tabs button[aria-selected="true"],
.zs .zs-tabs button[aria-selected="true"]:hover,
.zs .zs-tabs button[aria-selected="true"]:focus {
	background: var(--zs-ink);
	color: var(--zs-text);
}

.zs-pane {
	display: grid;
	gap: 12px;
}

.zs-fit__tools {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

/* Przyciski przymierzalni leżą na jasnej karcie podglądu. */
.zs-stage .zs-btn {
	border-color: rgba(15, 14, 13, 0.3);
	color: var(--zs-ink);
}

.zs-stage .zs-btn:hover,
.zs-stage .zs-btn:focus {
	background: rgba(15, 14, 13, 0.08);
	border-color: var(--zs-ink);
	color: var(--zs-ink);
}

.zs-stage .zs-btn[aria-pressed="true"],
.zs .zs-btn--dark {
	background: var(--zs-ink);
	border-color: var(--zs-ink);
	color: var(--zs-text);
}

.zs .zs-btn--dark:hover,
.zs .zs-btn--dark:focus-within {
	background: var(--zs-red);
	border-color: var(--zs-red);
	color: #fff;
}

.zs-upload {
	position: relative;
	display: inline-flex;
	align-items: center;
	overflow: hidden;
	cursor: pointer;
}

.zs-upload input {
	position: absolute;
	inset: 0;
	opacity: 0;
	cursor: pointer;
}

.zs-upload:focus-within {
	outline: 2px solid var(--zs-red);
	outline-offset: 2px;
}

.zs-fit__msg {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	color: var(--zs-ink-muted);
}

.zs-badge {
	padding: 3px 8px;
	background: var(--zs-ink);
	border-radius: 3px;
	color: var(--zs-text);
	font-family: var(--zs-mono);
	font-size: 11px;
	font-weight: 500;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.zs-fit__svg {
	display: block;
	width: 100%;
	height: auto;
	max-height: 70vh;
	background: #fff;
	border-radius: var(--zs-radius-sm);
	touch-action: none;
}

.zs-handle {
	cursor: grab;
}

.zs-handle circle {
	fill: var(--zs-red);
	stroke: #fff;
	stroke-width: 2;
}

.zs-handle text {
	fill: #fff;
	font-family: var(--zs-mono);
	font-weight: 700;
	pointer-events: none;
}

.zs-fit__pts {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
	gap: 4px 12px;
	margin: 0;
	padding: 0;
	counter-reset: zs-pt;
	list-style: none;
	font-size: 13px;
	color: var(--zs-ink-muted);
}

.zs-fit__pts li {
	counter-increment: zs-pt;
}

.zs-fit__pts li::before {
	content: counter(zs-pt);
	display: inline-grid;
	place-items: center;
	width: 20px;
	height: 20px;
	margin-right: 6px;
	background: var(--zs-red);
	border-radius: 50%;
	color: #fff;
	font-family: var(--zs-mono);
	font-size: 11px;
	font-weight: 700;
}

.zs-stage .zs-hint {
	color: var(--zs-ink-muted);
}

.zs-label {
	font-family: var(--zs-mono);
	font-size: 12px;
	font-weight: 500;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--zs-muted);
}
