/* Nacotokomu — widget czatu (Faza 82, przebudowa „cichy czat” 2026-10-26).
 *
 * Bąbelek w prawym dolnym rogu, panel jako arkusz dolny na telefonie
 * i okno na desktopie. Bez JS bąbelek jest zwykłym linkiem do wyceny —
 * dlatego stylujemy <a>, nie <button>.
 *
 * Makieta: docs/80-Design/_makieta-czat-sklepu-mobile.html. Zasady:
 *   - bąbelek biały 44 px, bez pulsowania; na telefonie chowa się przy przewijaniu w dół,
 *   - arkusz ma wysokość treści; pełny dopiero przy pisaniu, rozmowie albo formularzu,
 *   - na telefonie arkusz trzyma się `visualViewport` (zmienne z JS), więc pole
 *     i „wyślij” są zawsze nad klawiaturą.
 *
 * Tokeny z `theme.json`. Animujemy tylko `transform` i `opacity`.
 */

/*
 * STRAŻNIK `hidden` — czytaj przed dodaniem czegokolwiek do widgetu.
 *
 * Reguła autorska `display:flex` BIJE `display:none`, które przeglądarka nadaje
 * atrybutowi `hidden`. Bez tego strażnika `panel.hidden = true` nie chowało panelu.
 * Selektor jest ogólny (potomek `.nctk-chat`), bo lista klas zawsze się rozjedzie.
 */
.nctk-chat [hidden],
.nctk-chat__backdrop[hidden] {
	display: none !important;
}

.nctk-chat {
	position: fixed;
	right: 16px;
	bottom: calc(16px + env(safe-area-inset-bottom, 0px));
	z-index: 90;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 10px;
}

/*
 * Landingi /branze/* (treść „l26") mają własny przyklejony pasek CTA na dole
 * telefonu (73 px, z-index 9990). Bąbelek czatu chował się pod nim w całości,
 * a strona kończyła się pod paskiem. Podnosimy czat nad pasek i dokładamy
 * stronie zapas na dole. Próg 767 px = próg, od którego pasek jest widoczny.
 */
@media (max-width: 767px) {
	/* Tylko zamknięty: otwarty czat jest arkuszem od dolnej krawędzi (niżej). */
	body:has(.l26-sticky-cta) .nctk-chat:not(.is-open) {
		bottom: calc(89px + env(safe-area-inset-bottom, 0px));
	}
	body:has(.l26-sticky-cta) {
		padding-bottom: calc(73px + env(safe-area-inset-bottom, 0px));
	}
}

/*
 * Pasek szybkiego kontaktu na /kontakt/ (blok `nacotokomu/kontakt-pasek`, 68 px,
 * widoczny do 700 px — próg i zapas strony w `kontakt-pasek.css`). Ten sam
 * mechanizm: zamknięty bąbelek wędruje nad pasek.
 */
@media (max-width: 700px) {
	body:has(.nctk-kontakt-pasek) .nctk-chat:not(.is-open) {
		bottom: calc(84px + env(safe-area-inset-bottom, 0px));
	}
}

/* Baner zgody na cookies jest otwarty — na dole ekranu ma być tylko on. */
html.ncc-open .nctk-chat { display: none; }

/* ── Bąbelek ─────────────────────────────────────────────────
 *
 * Biały, 44 px (cel dotykowy), ikona w kolorze akcji. Niebieskie koło 56 px
 * z pulsującym pierścieniem było najgłośniejszym elementem każdej strony.
 */
.nctk-chat__launcher {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	background: var(--wp--preset--color--surface, #fff);
	border: 1px solid var(--wp--preset--color--border, #e2e8f0);
	border-radius: var(--wp--custom--radius--badge, 9999px);
	box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
	color: var(--wp--preset--color--action, #2563eb);
	text-decoration: none;
	transition: transform 180ms ease-out, opacity 180ms ease-out, border-color 150ms ease-out;
}
.nctk-chat__launcher:hover { border-color: var(--wp--preset--color--action, #2563eb); }
.nctk-chat__launcher:active { transform: scale(0.95); }
.nctk-chat__launcher:focus-visible {
	outline: 2px solid var(--wp--preset--color--action, #2563eb);
	outline-offset: 2px;
}
.nctk-chat__launcher-icon { display: inline-flex; }
.nctk-chat__launcher-icon svg { width: 21px; height: 21px; }

/* Etykieta zostaje w DOM-ie dla czytników ekranu — bez JS to zwykły link do wyceny. */
.nctk-chat__launcher-label {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

/* Zielona kropka: w godzinach pracy ktoś odpisze od razu. */
.nctk-chat.is-available .nctk-chat__launcher::after {
	content: '';
	position: absolute;
	top: 1px;
	right: 1px;
	width: 10px;
	height: 10px;
	border-radius: 9999px;
	background: #16a34a;
	box-shadow: 0 0 0 2px var(--wp--preset--color--surface, #fff);
}

/* Licznik: pomarańcz to TŁO, tekst na nim jest grafitowy (kontrast 6,37:1). */
.nctk-chat__badge {
	position: absolute;
	top: -6px;
	right: -6px;
	z-index: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 20px;
	height: 20px;
	padding: 0 5px;
	background: var(--wp--preset--color--accent, #f97316);
	border-radius: var(--wp--custom--radius--badge, 9999px);
	color: var(--wp--preset--color--ink, #0f172a);
	font-size: 0.6875rem;
	font-weight: 800;
	font-variant-numeric: tabular-nums;
}

/* ── Dymek zachęty (tylko komputer — JS nie pokazuje go na telefonie) ── */
.nctk-chat__peek {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	max-width: min(78vw, 260px);
	padding: 12px 14px;
	background: var(--wp--preset--color--surface, #fff);
	border: 1px solid var(--wp--preset--color--border, #e2e8f0);
	border-radius: var(--nctk-radius-btn, 14px);
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06), 0 4px 16px rgba(0, 0, 0, 0.08);
	animation: nctk-chat-peek-in 180ms ease-out;
}
@keyframes nctk-chat-peek-in {
	from { transform: translateY(6px) scale(0.96); opacity: 0; }
	to   { transform: translateY(0)   scale(1);    opacity: 1; }
}
.nctk-chat__peek-text {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
	cursor: pointer;
}
.nctk-chat__peek-title {
	margin: 0;
	font-family: var(--wp--preset--font-family--heading);
	font-size: 0.875rem;
	font-weight: 800;
	line-height: 1.3;
	color: var(--wp--preset--color--ink, #0f172a);
}
.nctk-chat__peek-sub {
	margin: 0;
	font-size: 0.75rem;
	line-height: 1.4;
	color: var(--wp--preset--color--muted, #64748b);
}
.nctk-chat__peek-close {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	/* 44 px celu dotykowego przy ikonie 16 px; ujemny margines trzyma dymek w tym samym rozmiarze. */
	width: 44px;
	height: 44px;
	margin: -12px -14px -8px -8px;
	padding: 0;
	background: none;
	border: 0;
	border-radius: 9999px;
	color: var(--wp--preset--color--muted, #64748b);
	cursor: pointer;
}
.nctk-chat__peek-close:hover { background: var(--wp--preset--color--bg, #f8fafc); }
.nctk-chat__peek-close:focus-visible {
	outline: 2px solid var(--wp--preset--color--action, #2563eb);
	outline-offset: 2px;
}

/* ── Panel ──────────────────────────────────────────────────────
 *
 * Wysokość według treści. Pełna (stała) dopiero z klasą `is-full`: rozmowa,
 * pisanie albo formularz — wtedy lista ma gdzie rosnąć, a arkusz formularza
 * ma miejsce także przy krótkiej rozmowie.
 */
.nctk-chat__panel {
	position: relative;
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	width: min(calc(100vw - 32px), 360px);
	max-height: min(640px, calc(100dvh - 96px));
	overflow: hidden;
	background: var(--wp--preset--color--surface, #fff);
	border: 1px solid var(--wp--preset--color--border, #e2e8f0);
	border-radius: 18px;
	box-shadow: 0 10px 30px rgba(15, 23, 42, 0.14);
	font-family: var(--wp--preset--font-family--body);
}
.nctk-chat__panel.is-full {
	height: min(600px, calc(100dvh - 96px));
}
.nctk-chat__panel *,
.nctk-chat__panel *::before,
.nctk-chat__panel *::after { box-sizing: border-box; }

.nctk-chat__head {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 8px 6px 4px 16px;
	background: var(--wp--preset--color--surface, #fff);
	color: var(--wp--preset--color--ink, #0f172a);
}
.nctk-chat__head-title {
	margin: 0;
	font-family: var(--wp--preset--font-family--heading);
	font-size: 0.9375rem;
	font-weight: 800;
}
.nctk-chat__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	background: none;
	border: 0;
	border-radius: var(--nctk-radius-btn, 14px);
	color: var(--wp--preset--color--muted, #64748b);
	cursor: pointer;
}
.nctk-chat__close:hover { background: var(--wp--preset--color--bg, #f8fafc); }
.nctk-chat__close:focus-visible {
	outline: 2px solid var(--wp--preset--color--action, #2563eb);
	outline-offset: -2px;
}

/* ── Wiadomości ─────────────────────────────────────────────── */

.nctk-chat__list {
	flex: 0 1 auto;
	min-height: 0;
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 4px 14px 12px;
	overflow-x: hidden;
	overflow-y: auto;
	overscroll-behavior: contain;
	background: var(--wp--preset--color--surface, #fff);
}
.nctk-chat__panel.is-full .nctk-chat__list { flex: 1 1 auto; }

.nctk-chat__msg {
	display: flex;
	flex-direction: column;
	max-width: 85%;
	min-width: 0;
}
.nctk-chat__msg--mine {
	align-self: flex-end;
	align-items: flex-end;
}
.nctk-chat__msg--them { align-self: flex-start; }
.nctk-chat__who {
	margin: 0 0 2px;
	font-size: 0.6875rem;
	font-weight: 700;
	color: var(--wp--preset--color--muted, #64748b);
}
.nctk-chat__bubble {
	margin: 0;
	padding: 9px 13px;
	background: var(--wp--preset--color--bg, #f8fafc);
	border: 1px solid var(--wp--preset--color--border, #e2e8f0);
	border-radius: 16px;
	border-bottom-left-radius: 4px;
	color: var(--wp--preset--color--ink, #0f172a);
	font-size: 0.875rem;
	line-height: 1.45;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}
.nctk-chat__msg--mine .nctk-chat__bubble {
	background: var(--wp--preset--color--action, #2563eb);
	border-color: var(--wp--preset--color--action, #2563eb);
	border-radius: 16px;
	border-bottom-right-radius: 4px;
	color: var(--wp--preset--color--surface, #fff);
}
.nctk-chat__files + .nctk-chat__bubble { margin-top: 4px; }
.nctk-chat__time {
	margin: 3px 0 0;
	font-size: 0.6875rem;
	color: var(--wp--preset--color--muted, #64748b);
	font-variant-numeric: tabular-nums;
}
.nctk-chat__system {
	align-self: center;
	max-width: 90%;
	margin: 0;
	font-size: 0.75rem;
	line-height: 1.45;
	text-align: center;
	color: var(--wp--preset--color--muted, #64748b);
}

/* Pliki: podgląd od razu, klik otwiera duży podgląd. */
.nctk-chat__files {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 6px;
}
.nctk-chat__msg--them .nctk-chat__files { justify-content: flex-start; }
.nctk-chat__file {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	max-width: 220px;
	padding: 8px 10px;
	overflow: hidden;
	background: var(--wp--preset--color--surface, #fff);
	border: 1px solid var(--wp--preset--color--border, #e2e8f0);
	border-radius: 14px;
	font: inherit;
	font-size: 0.75rem;
	color: var(--wp--preset--color--ink, #0f172a);
	cursor: pointer;
}
.nctk-chat__file--img {
	width: 200px;
	max-width: 100%;
	aspect-ratio: 4 / 3;
	padding: 0;
	justify-content: center;
	background: #fff;
	cursor: zoom-in;
}
.nctk-chat__file--img img {
	display: block;
	max-width: 90%;
	max-height: 90%;
	object-fit: contain;
}
.nctk-chat__file:focus-visible {
	outline: 2px solid var(--wp--preset--color--action, #2563eb);
	outline-offset: 2px;
}
.nctk-chat__file-ext {
	flex: none;
	padding: 6px 7px;
	border: 1.5px solid var(--wp--preset--color--border, #e2e8f0);
	border-radius: 7px;
	font-weight: 800;
	font-size: 0.6875rem;
	color: var(--wp--preset--color--muted, #64748b);
}
.nctk-chat__file-name {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
/* Pasek wysyłania leży NA podglądzie — gość widzi plik i postęp w jednym miejscu. */
.nctk-chat__file-bar {
	position: absolute;
	right: 8px;
	bottom: 8px;
	left: 8px;
	height: 4px;
	overflow: hidden;
	background: rgba(15, 23, 42, 0.15);
	border-radius: 9999px;
}
.nctk-chat__file-bar-fill {
	display: block;
	width: 4%;
	height: 100%;
	background: #16a34a;
	border-radius: 9999px;
	transition: width 160ms ease-out;
}
.nctk-chat__msg.is-sending .nctk-chat__time { font-style: italic; }

/* ── Status ─────────────────────────────────────────────────── */

.nctk-chat__status {
	flex: 0 0 auto;
	margin: 0;
	padding: 6px 14px;
	font-size: 0.75rem;
	line-height: 1.4;
	color: var(--wp--preset--color--muted, #64748b);
}
.nctk-chat__status--err {
	color: var(--wp--preset--color--err, #dc2626);
	font-weight: 600;
}
.nctk-chat__status--ok {
	color: var(--wp--preset--color--ok-tx, #047857);
	font-weight: 600;
}

/* ── Szybki start ────────────────────────────────────────────── */

.nctk-chat__quick {
	display: flex;
	flex-direction: column;
	gap: 10px;
}
.nctk-chat__quick-row {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}
.nctk-chat__chip {
	min-height: 36px;
	padding: 7px 13px;
	background: var(--wp--preset--color--surface, #fff);
	border: 1px solid var(--wp--preset--color--border, #e2e8f0);
	border-radius: var(--wp--custom--radius--badge, 9999px);
	color: var(--wp--preset--color--ink, #0f172a);
	font: inherit;
	font-size: 0.8125rem;
	font-weight: 500;
	white-space: nowrap;
	cursor: pointer;
	transition: border-color 150ms ease-out, color 150ms ease-out;
}
.nctk-chat__chip:hover {
	border-color: var(--wp--preset--color--action, #2563eb);
	color: var(--wp--preset--color--action, #2563eb);
}
.nctk-chat__chip:focus-visible {
	outline: 2px solid var(--wp--preset--color--action, #2563eb);
	outline-offset: 2px;
}

/* Kontekst produktu — gość pisze z karty produktu, więc od razu wiadomo, o czym mowa. */
.nctk-chat__product {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 6px;
	background: var(--wp--preset--color--bg, #f8fafc);
	border: 1px solid var(--wp--preset--color--border, #e2e8f0);
	border-radius: 12px;
}
.nctk-chat__product img {
	width: 40px;
	height: 40px;
	object-fit: cover;
	border-radius: 8px;
}
.nctk-chat__product-meta {
	display: flex;
	flex-direction: column;
	min-width: 0;
}
.nctk-chat__product-lead {
	font-size: 0.6875rem;
	color: var(--wp--preset--color--muted, #64748b);
}
.nctk-chat__product-name {
	font-size: 0.8125rem;
	font-weight: 600;
	color: var(--wp--preset--color--ink, #0f172a);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* ── Karta kontaktu (poza godzinami) ─────────────────────────── */

.nctk-chat__card {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 6px;
	padding: 12px;
	background: var(--wp--preset--color--bg, #f8fafc);
	border: 1px solid var(--wp--preset--color--border, #e2e8f0);
	border-radius: 14px;
	font-size: 0.8125rem;
	line-height: 1.4;
}
.nctk-chat__card-title {
	margin: 0;
	font-weight: 600;
	color: var(--wp--preset--color--ink, #0f172a);
}
.nctk-chat__card-text {
	margin: 0;
	color: var(--wp--preset--color--ink-soft, #1e293b);
}
.nctk-chat__card-row {
	display: flex;
	gap: 6px;
	min-width: 0;
	margin: 2px 0 0;
}
.nctk-chat__card-input {
	flex: 1 1 auto;
	width: 100%;
	min-width: 0;
	height: 42px;
	padding: 0 11px;
	background: var(--wp--preset--color--surface, #fff);
	border: 1px solid var(--wp--preset--color--border, #e2e8f0);
	border-radius: 11px;
	font: inherit;
	/* 16 px — mniejsza czcionka w polu = Safari powiększa stronę przy fokusie. */
	font-size: 16px;
	color: var(--wp--preset--color--ink, #0f172a);
}
.nctk-chat__card-input:focus-visible {
	outline: 2px solid var(--wp--preset--color--action, #2563eb);
	outline-offset: 0;
}
.nctk-chat__card-btn {
	flex: 0 0 auto;
	height: 42px;
	padding: 0 14px;
	background: var(--wp--preset--color--action, #2563eb);
	border: 0;
	border-radius: 11px;
	color: #fff;
	font: inherit;
	font-size: 0.8125rem;
	font-weight: 700;
	cursor: pointer;
}
.nctk-chat__card-btn:disabled { opacity: 0.6; cursor: default; }
.nctk-chat__card-btn:focus-visible {
	outline: 2px solid var(--wp--preset--color--ink, #0f172a);
	outline-offset: 2px;
}
.nctk-chat__card-err {
	margin: 0;
	color: var(--wp--preset--color--err, #dc2626);
	font-weight: 600;
}
.nctk-chat__card-link {
	justify-self: start;
	padding: 4px 0;
	background: none;
	border: 0;
	color: var(--wp--preset--color--action, #2563eb);
	font: inherit;
	font-size: 0.8125rem;
	font-weight: 600;
	cursor: pointer;
}
.nctk-chat__card-link:focus-visible {
	outline: 2px solid var(--wp--preset--color--action, #2563eb);
	outline-offset: 2px;
}
.nctk-chat__card--done {
	background: #ecfdf3;
	border-color: #bbf7d0;
}
.nctk-chat__card--done .nctk-chat__card-title { color: #166534; }

/* ── „Zostaw dane” / „Wyślij logo” nad polem ─────────────────── */

.nctk-chat__actions {
	flex: 0 0 auto;
	display: flex;
	gap: 6px;
	padding: 8px 10px 0;
	overflow-x: auto;
	border-top: 1px solid var(--wp--preset--color--border, #e2e8f0);
	scrollbar-width: none;
}
.nctk-chat__action {
	position: relative;
	flex: none;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 34px;
	max-width: 100%;
	padding: 0 12px;
	background: var(--wp--preset--color--surface, #fff);
	border: 1px solid var(--wp--preset--color--border, #e2e8f0);
	border-radius: var(--wp--custom--radius--badge, 9999px);
	font: inherit;
	font-size: 0.8125rem;
	font-weight: 600;
	color: var(--wp--preset--color--ink, #0f172a);
	white-space: nowrap;
	cursor: pointer;
}
/* 34 px wizualnie, 44 px celu dotykowego. */
.nctk-chat__action::after {
	content: "";
	position: absolute;
	inset: -5px 0;
}
.nctk-chat__action.is-primary {
	background: var(--nctk-action-lo, #eff6ff);
	border-color: transparent;
	color: var(--wp--preset--color--action, #2563eb);
}
.nctk-chat__action.is-done {
	background: #f0fdf4;
	border-color: #bbf7d0;
	color: #15803d;
}
.nctk-chat__action-check { font-weight: 800; }
.nctk-chat__action:focus-visible {
	outline: 2px solid var(--wp--preset--color--action, #2563eb);
	outline-offset: 2px;
}

/* ── Kompozytor ─────────────────────────────────────────────── */

.nctk-chat__composer {
	flex: 0 0 auto;
	display: flex;
	align-items: flex-end;
	gap: 6px;
	padding: 8px 10px 10px;
	background: var(--wp--preset--color--surface, #fff);
	border-top: 1px solid var(--wp--preset--color--border, #e2e8f0);
}
.nctk-chat__actions:not([hidden]) + .nctk-chat__composer { border-top: 0; }
.nctk-chat__composer.is-busy { opacity: 0.6; }
.nctk-chat__input {
	flex: 1 1 auto;
	min-width: 0;
	min-height: 42px;
	max-height: 132px;
	padding: 10px 12px;
	background: var(--wp--preset--color--bg, #f8fafc);
	border: 1px solid var(--wp--preset--color--border, #e2e8f0);
	border-radius: 12px;
	font-family: var(--wp--preset--font-family--body);
	/* 16 px — mniejsza czcionka w polu = Safari powiększa stronę przy fokusie. */
	font-size: max(16px, 0.875rem);
	line-height: 1.4;
	color: var(--wp--preset--color--ink, #0f172a);
	resize: none;
}
.nctk-chat__input:focus-visible {
	outline: 2px solid var(--wp--preset--color--action, #2563eb);
	outline-offset: 0;
	background: var(--wp--preset--color--surface, #fff);
}
.nctk-chat__attach,
.nctk-chat__send {
	position: relative;
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	border: 0;
	border-radius: 12px;
	cursor: pointer;
}
.nctk-chat__attach {
	background: transparent;
	color: var(--wp--preset--color--muted, #64748b);
}
.nctk-chat__attach:hover { background: var(--wp--preset--color--bg, #f8fafc); }
.nctk-chat__attach:focus-within {
	outline: 2px solid var(--wp--preset--color--action, #2563eb);
	outline-offset: 2px;
}

/* Input pliku schowany wizualnie, ale wciąż fokusowalny z klawiatury. */
.nctk-chat__file-input {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	white-space: nowrap;
	border: 0;
	clip-path: inset(50%);
}
.nctk-chat__send {
	background: var(--wp--preset--color--action, #2563eb);
	color: var(--wp--preset--color--surface, #fff);
}
.nctk-chat__send:hover { background: var(--nctk-action-hi, #1d4ed8); }
.nctk-chat__send:focus-visible {
	outline: 2px solid var(--wp--preset--color--ink, #0f172a);
	outline-offset: 2px;
}

/* ── Tło pod panelem ─────────────────────────────────────────
 *
 * Kliknięcie „gdziekolwiek obok" zamyka czat. Na desktopie przezroczyste,
 * na telefonie lekko przygasza stronę nad arkuszem.
 */
.nctk-chat__backdrop {
	position: fixed;
	inset: 0;
	z-index: 89;
	background: transparent;
	border: 0;
}

/* Chwyt do przeciągnięcia — tylko na telefonie, patrz media query niżej. */
.nctk-chat__grabber { display: none; }

/* ── Formularz „Zostaw dane” (arkusz na cały panel) ─────────── */

.nctk-chat__sheet {
	position: absolute;
	inset: 0;
	z-index: 3;
	display: flex;
	flex-direction: column;
	background: var(--wp--preset--color--surface, #fff);
	animation: nctk-chat-sheet-in 180ms ease-out;
}
@keyframes nctk-chat-sheet-in {
	from { transform: translateY(16px); opacity: 0; }
	to   { transform: none; opacity: 1; }
}
.nctk-chat__sheet-head {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 2px;
	padding: 6px 12px 6px 4px;
	border-bottom: 1px solid var(--wp--preset--color--border, #e2e8f0);
}
.nctk-chat__sheet-titles { min-width: 0; }
.nctk-chat__sheet-title {
	margin: 0;
	font-family: var(--wp--preset--font-family--heading);
	font-size: 0.9375rem;
	font-weight: 800;
	color: var(--wp--preset--color--ink, #0f172a);
}
.nctk-chat__sheet-steps {
	margin: 0;
	font-size: 0.75rem;
	color: var(--wp--preset--color--muted, #64748b);
}
.nctk-chat__sheet-close {
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	background: none;
	border: 0;
	border-radius: var(--nctk-radius-btn, 14px);
	color: var(--wp--preset--color--muted, #64748b);
	cursor: pointer;
}
.nctk-chat__sheet-close:focus-visible {
	outline: 2px solid var(--wp--preset--color--action, #2563eb);
	outline-offset: -2px;
}
.nctk-chat__sheet-body {
	flex: 1 1 auto;
	min-height: 0;
	padding: 10px 14px 12px;
	overflow-y: auto;
	overscroll-behavior: contain;
}
.nctk-chat__sheet-foot {
	flex: 0 0 auto;
	display: grid;
	gap: 4px;
	padding: 8px 14px calc(10px + env(safe-area-inset-bottom, 0px));
	border-top: 1px solid var(--wp--preset--color--border, #e2e8f0);
}
.nctk-chat__sheet-btn {
	width: 100%;
	min-height: 44px;
	box-sizing: border-box;
}
.nctk-chat__sheet-hint {
	margin: 0;
	font-size: 0.6875rem;
	text-align: center;
	color: var(--wp--preset--color--muted, #64748b);
}

/* Formularz ma się zmieścić w arkuszu bez przewijania — gęściej niż formularz wyceny. */
.nctk-chat__inq {
	display: flex;
	flex-direction: column;
	gap: 9px;
	min-width: 0;
}
.nctk-chat__inq .nctk-cf { gap: 8px; }
.nctk-chat__inq .nctk-cf__field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.nctk-chat__inq .nctk-cf__label { font-size: 0.75rem; }
.nctk-chat__inq .nctk-cf__input { min-height: 40px; }
.nctk-chat__inq .nctk-cf__fill { min-height: 40px; }
.nctk-chat__inq .nctk-cf__seg-btn { min-height: 34px; font-size: 0.75rem; }
.nctk-chat__inq .is-required .nctk-cf__label::after {
	content: " *";
	color: var(--wp--preset--color--action, #2563eb);
}
.nctk-chat__inq-file {
	display: flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
	padding: 4px 4px 4px 4px;
	background: var(--wp--preset--color--bg, #f8fafc);
	border: 1px solid var(--wp--preset--color--border, #e2e8f0);
	border-radius: 11px;
	font-size: 0.75rem;
}
.nctk-chat__inq-thumb {
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	overflow: hidden;
	background: #fff;
	border: 1px solid var(--wp--preset--color--border, #e2e8f0);
	border-radius: 7px;
	font-size: 0.5625rem;
	font-weight: 800;
	color: var(--wp--preset--color--muted, #64748b);
}
.nctk-chat__inq-thumb img {
	max-width: 88%;
	max-height: 88%;
	object-fit: contain;
}
.nctk-chat__inq-file-name {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	color: var(--wp--preset--color--ink-soft, #1e293b);
}
.nctk-chat__inq-file-btn {
	flex: none;
	min-height: 32px;
	padding: 0 10px;
	background: var(--wp--preset--color--surface, #fff);
	border: 1px solid var(--wp--preset--color--border, #e2e8f0);
	border-radius: 9px;
	font: inherit;
	font-size: 0.75rem;
	font-weight: 600;
	color: var(--wp--preset--color--action, #2563eb);
	cursor: pointer;
}
.nctk-chat__inq-note {
	margin: 0;
	font-size: 0.6875rem;
	line-height: 1.4;
	color: var(--wp--preset--color--muted, #64748b);
}
.nctk-chat__inq-note a { color: inherit; }

/* ── Duży podgląd obrazu ─────────────────────────────────────── */

.nctk-chat__lb {
	position: absolute;
	inset: 0;
	z-index: 5;
	display: grid;
	grid-template-rows: auto minmax(0, 1fr) auto;
	background: rgba(15, 23, 42, 0.94);
	color: #fff;
}
.nctk-chat__lb-top {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 6px 8px 16px;
}
.nctk-chat__lb-name {
	flex: 1 1 auto;
	min-width: 0;
	margin: 0;
	overflow: hidden;
	font-size: 0.8125rem;
	font-weight: 600;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.nctk-chat__lb-close {
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	background: none;
	border: 0;
	border-radius: 12px;
	color: #fff;
	cursor: pointer;
}
.nctk-chat__lb-close:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
.nctk-chat__lb-stage {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 0;
	padding: 8px 16px;
}
.nctk-chat__lb-stage img {
	max-width: 100%;
	max-height: 100%;
	padding: 12px;
	background: #fff;
	border-radius: 12px;
	object-fit: contain;
}
.nctk-chat__lb-link {
	justify-self: center;
	padding: 10px 16px 14px;
	color: #cbd5e1;
	font-size: 0.75rem;
}

/* ── Telefon: arkusz przy dolnej krawędzi widocznej części ekranu ── */
@media (max-width: 599px) {
	/* Bąbelek zjeżdża przy przewijaniu w dół i wraca przy przewijaniu w górę. */
	.nctk-chat.is-tucked .nctk-chat__launcher {
		transform: translateY(calc(100% + 32px));
		opacity: 0;
		pointer-events: none;
	}
	.nctk-chat.is-open .nctk-chat__launcher { display: none; }

	/* Strona pod otwartym czatem się nie przewija. */
	html.nctk-chat-lock,
	html.nctk-chat-lock body {
		overflow: hidden;
		overscroll-behavior: none;
	}

	.nctk-chat.is-open .nctk-chat__panel {
		position: fixed;
		right: 0;
		bottom: var(--nctk-chat-kb, 0px);
		left: 0;
		z-index: 91;
		width: 100%;
		max-height: calc(var(--nctk-chat-vvh, 100dvh) - 12px);
		border-bottom: 0;
		border-radius: 20px 20px 0 0;
		box-shadow: 0 -6px 24px rgba(15, 23, 42, 0.14);
		transition: transform 160ms ease-out;
	}
	.nctk-chat.is-open .nctk-chat__panel.is-full {
		height: calc(var(--nctk-chat-vvh, 100dvh) - 56px);
	}
	/* Klawiatura otwarta: arkusz od górnej krawędzi widocznej części do klawiatury. */
	.nctk-chat.is-open .nctk-chat__panel.is-typing {
		height: calc(var(--nctk-chat-vvh, 100dvh) - 8px);
		max-height: calc(var(--nctk-chat-vvh, 100dvh) - 8px);
		border-radius: 16px 16px 0 0;
	}
	.nctk-chat__panel.is-typing .nctk-chat__quick-row {
		flex-wrap: nowrap;
		margin: 0 -14px;
		padding: 0 14px;
		overflow-x: auto;
		scrollbar-width: none;
	}
	.nctk-chat__panel.is-typing .nctk-chat__product { display: none; }

	/* Bez klawiatury pod polem jest pasek systemowy — zostawiamy mu miejsce. */
	.nctk-chat__panel:not(.is-typing) .nctk-chat__composer {
		padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
	}

	.nctk-chat__backdrop {
		background: rgba(15, 23, 42, 0.25);
	}

	/* Chwyt — sygnał „to się da ściągnąć w dół". */
	.nctk-chat__grabber {
		display: block;
		position: absolute;
		top: 6px;
		left: 50%;
		width: 32px;
		height: 4px;
		margin-left: -16px;
		background: #cbd5e1;
		border-radius: 9999px;
	}
	.nctk-chat__head {
		position: relative;
		padding-top: 14px;
		/* Nagłówek jest chwytem gestu — przeglądarka nie może przewijać za nas. */
		touch-action: none;
	}
	.nctk-chat__sheet { border-radius: inherit; }
}

@media (prefers-reduced-motion: reduce) {
	.nctk-chat__launcher { transition: none; }
	.nctk-chat__peek { animation: none; }
	.nctk-chat__file-bar-fill { transition: none; }
	.nctk-chat.is-open .nctk-chat__panel { transition: none; }
	.nctk-chat__sheet { animation: none; }
}
