.tk-widget {
	--tk-accent: #f4a300;
	max-width: 520px;
	margin: 0 auto;
	font-family: inherit;
	color: var(--tk-text, #222);
	box-sizing: border-box;
}
.tk-widget *, .tk-widget *::before, .tk-widget *::after { box-sizing: border-box; }
.tk-widget [hidden] { display: none !important; }

.tk-card {
	padding: 20px;
	background: var(--tk-bg, #fff);
	border-radius: 12px;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
	margin: 0 0 16px;
}
.tk-title { font-size: 1.25em; margin: 0 0 16px; }
.tk-card h4 { font-size: 1.05em; margin: 0 0 10px; }

.tk-field { margin: 0 0 14px; position: relative; }
.tk-field label { display: block; font-size: 14px; font-weight: 600; margin: 0 0 6px; }
.tk-widget input[type="text"],
.tk-widget select {
	width: 100%;
	padding: 12px;
	font-size: 16px;
	font-family: inherit;
	line-height: 1.3;
	color: #222;
	border: 1px solid #ccc;
	border-radius: 8px;
	background: #fafafa;
	height: auto;
	margin: 0;
}
.tk-widget input[type="text"]:focus,
.tk-widget select:focus { outline: none; border-color: var(--tk-accent); background: #fff; }

.tk-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }

.tk-check label { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.tk-check input { width: 18px; height: 18px; margin: 0; }
.tk-turn-wrap { margin-left: 26px; }

.tk-suggestions {
	position: absolute; top: 100%; left: 0; right: 0; z-index: 20;
	background: #fff; border: 1px solid #ddd; border-top: none;
	border-radius: 0 0 8px 8px; max-height: 220px; overflow-y: auto;
	box-shadow: 0 6px 14px rgba(0, 0, 0, 0.1);
}
.tk-sug { padding: 12px 14px; font-size: 15px; border-bottom: 1px solid #f0f0f0; cursor: pointer; }
.tk-sug:last-child { border-bottom: none; }
.tk-sug:hover, .tk-sug:active { background: #fff4e0; }

.tk-badge { display: inline-block; margin-top: 8px; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.tk-badge:empty { display: none; }
.tk-badge.tk-week { background: #e6f2e6; color: #2d6a2d; }
.tk-badge.tk-weekend { background: #fff0d6; color: #a66300; }

.tk-submit {
	width: 100%; padding: 14px; font-size: 16px; font-weight: 700; font-family: inherit;
	color: var(--tk-on-accent, #fff); background: var(--tk-accent); border: none; border-radius: 8px; cursor: pointer;
	transition: filter .15s ease;
}
.tk-submit:hover { filter: brightness(0.92); }
.tk-submit:disabled { opacity: .6; cursor: default; }

.tk-result { margin-top: 18px; padding: 14px 16px; background: #f7f7f7; border-radius: 8px; font-size: 15px; }
.tk-row { margin: 0 0 6px; line-height: 1.4; }
.tk-label { font-weight: 600; color: #444; }
.tk-price { font-size: 1.2em; font-weight: 700; color: #222; margin-top: 10px; }
.tk-note { margin-top: 10px; font-size: 12px; color: #777; line-height: 1.45; }
.tk-error { margin-top: 14px; padding: 12px 14px; background: #fdeaea; color: #b02a2a; border-radius: 8px; font-size: 14px; }

.tk-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tk-table th, .tk-table td { padding: 8px 4px; text-align: right; border-bottom: 1px solid #eee; }
.tk-table th:first-child, .tk-table td:first-child { text-align: left; }
.tk-table th { font-size: 11px; color: #888; font-weight: 600; }
.tk-table tbody tr { cursor: pointer; }
.tk-table tbody tr:hover, .tk-table tbody tr:active { background: #fff4e0; }
.tk-hint { font-size: 11px; color: #999; margin: 8px 0 0; }
.tk-rates p { margin: 0; font-size: 13px; line-height: 1.6; }
.tk-footer { text-align: center; font-size: 13px; color: #666; }
.tk-footer a { color: inherit; font-weight: 700; }

@media (max-width: 480px) {
	.tk-card { padding: 16px; }
	.tk-table { font-size: 12px; }
}

/* ------------------------------------------------------------------ *
 * Vyjíždějící widget
 * Kontejner pokrývá celé okno (v náhledu rámeček), ale kliky propouští;
 * záložka i panel jsou v něm absolutně umístěné (žádný transform na rodiči).
 * ------------------------------------------------------------------ */
.tk-float {
	--tk-accent: #f4a300;
	--tk-on-accent: #111;
	--tk-w: 420px;
	position: fixed; inset: 0; z-index: 99990;
	pointer-events: none;
	font-family: inherit; line-height: 1.3;
}
.tk-float *, .tk-float *::before, .tk-float *::after { box-sizing: border-box; }

.tk-float-toggle {
	position: absolute; pointer-events: auto;
	display: flex; align-items: center; gap: 8px;
	margin: 0; padding: 12px 16px;
	font-weight: 700; font-size: 15px; line-height: 1.2; font-family: inherit;
	color: var(--tk-on-accent); background: var(--tk-accent);
	border: 0; cursor: pointer;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28);
	transition: filter .15s ease, opacity .2s ease;
}
.tk-float-toggle:hover { filter: brightness(0.93); }
.tk-float-toggle:focus-visible, .tk-float-close:focus-visible { outline: 3px solid #1a73e8; outline-offset: 2px; }
.tk-float-ico { flex: none; }

.tk-float-panel {
	position: absolute; pointer-events: auto;
	width: min(var(--tk-w), 100%);
	max-height: 90vh; overflow-y: auto; overscroll-behavior: contain;
	padding: 14px 14px 4px;
	background: #f4f4f4; color: #222;
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
	opacity: 0; visibility: hidden;
	transition: transform .28s ease, opacity .2s ease, visibility 0s linear .28s;
}
.tk-float[data-open] .tk-float-panel {
	opacity: 1; visibility: visible;
	transition: transform .28s ease, opacity .2s ease, visibility 0s;
}
.tk-float-panel .tk-widget { max-width: none; margin: 0; }
.tk-float-panel .tk-card { box-shadow: none; margin: 0 0 12px; }
.tk-float-panel .tk-title { padding-right: 36px; }

.tk-float-close {
	position: absolute; top: 12px; right: 12px; z-index: 2;
	width: 36px; height: 36px; padding: 0; margin: 0;
	font: 400 26px/1 sans-serif; color: #444; background: #fff;
	border: 1px solid #ddd; border-radius: 50%; cursor: pointer;
}
.tk-float-close:hover { background: #eee; }

/* Záložka u okraje: svislý štítek uprostřed výšky. */
.tk-float--tab-right .tk-float-toggle,
.tk-float--tab-left .tk-float-toggle {
	top: 50%; transform: translateY(-50%);
	flex-direction: column; writing-mode: vertical-rl; padding: 16px 11px;
}
.tk-float--tab-right .tk-float-toggle { right: 0; border-radius: 12px 0 0 12px; }
.tk-float--tab-left .tk-float-toggle { left: 0; border-radius: 0 12px 12px 0; }
.tk-float--tab-right .tk-float-ico, .tk-float--tab-left .tk-float-ico { writing-mode: horizontal-tb; }
.tk-float--tab-right .tk-float-panel { top: 50%; right: 0; transform: translate(100%, -50%); border-radius: 14px 0 0 14px; }
.tk-float--tab-left .tk-float-panel { top: 50%; left: 0; transform: translate(-100%, -50%); border-radius: 0 14px 14px 0; }
.tk-float--tab-right[data-open] .tk-float-panel,
.tk-float--tab-left[data-open] .tk-float-panel { transform: translate(0, -50%); }
.tk-float--tab-right[data-open] .tk-float-toggle,
.tk-float--tab-left[data-open] .tk-float-toggle { opacity: 0; pointer-events: none; }

/* Bublina vpravo dole: kulaté tlačítko, panel nad ním. */
.tk-float--bubble-right .tk-float-toggle {
	right: 18px; bottom: 18px; width: 60px; height: 60px; padding: 0;
	justify-content: center; border-radius: 50%;
}
.tk-float--bubble-right .tk-float-label {
	position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden;
	clip: rect(0 0 0 0); white-space: nowrap;
}
.tk-float--bubble-right .tk-float-ico { width: 28px; height: 28px; }
.tk-float--bubble-right .tk-float-panel {
	right: 18px; bottom: 88px; width: min(var(--tk-w), calc(100% - 36px));
	max-height: calc(100% - 110px); border-radius: 14px;
	transform: translateY(18px) scale(.97); transform-origin: bottom right;
}
.tk-float--bubble-right[data-open] .tk-float-panel { transform: none; }

/* Lišta u spodního okraje: vhodná hlavně pro telefony. */
.tk-float--bar-bottom .tk-float-toggle {
	left: 0; right: 0; bottom: 0; width: 100%; height: 50px;
	justify-content: center; border-radius: 0; font-size: 16px;
}
.tk-float--bar-bottom .tk-float-panel {
	left: 0; right: 0; bottom: 50px; margin: 0 auto;
	max-height: calc(100% - 70px); border-radius: 14px 14px 0 0;
	transform: translateY(24px);
}
.tk-float--bar-bottom[data-open] .tk-float-panel { transform: none; }

/* Telefon: záložky se otevírají jako spodní panel přes celou šířku. */
@media (max-width: 520px) {
	.tk-float--tab-right .tk-float-panel,
	.tk-float--tab-left .tk-float-panel {
		top: auto; bottom: 0; left: 0; right: 0; width: 100%;
		max-height: 88%; border-radius: 14px 14px 0 0;
		transform: translateY(100%);
	}
	.tk-float--tab-right[data-open] .tk-float-panel,
	.tk-float--tab-left[data-open] .tk-float-panel { transform: none; }
	.tk-float--bubble-right .tk-float-panel { right: 8px; width: calc(100% - 16px); }
}

/* Náhled v administraci: kontejner jen přes rámeček, ne přes celé okno. */
.tk-float--preview { position: absolute; }
.tk-float--preview.tk-float--tab-right .tk-float-panel,
.tk-float--preview.tk-float--tab-left .tk-float-panel { max-height: calc(100% - 24px); }

@media (prefers-reduced-motion: reduce) {
	.tk-float-panel, .tk-float[data-open] .tk-float-panel, .tk-float-toggle { transition: none; }
}
@media print { .tk-float { display: none !important; } }

/* ------------------------------------------------------------------ *
 * Vynucené barvy (třída .tk-force): přebijí styl šablony / Elementoru.
 * Barvy se berou z CSS proměnných nastavených v administraci.
 * ------------------------------------------------------------------ */
.tk-force, .tk-force .tk-card,
.tk-force .tk-title, .tk-force h3, .tk-force h4,
.tk-force label, .tk-force .tk-label, .tk-force .tk-row, .tk-force .tk-price,
.tk-force td, .tk-force th, .tk-force p { color: var(--tk-text) !important; }
.tk-force .tk-card { background: var(--tk-bg) !important; }
.tk-force .tk-title, .tk-force h3, .tk-force h4 { background: transparent !important; }
.tk-force input[type="text"], .tk-force select {
	color: var(--tk-text) !important; background: #fafafa !important;
	border: 1px solid #ccc !important; border-radius: 8px !important;
	box-shadow: none !important; height: auto !important;
}
.tk-force input[type="text"]:focus, .tk-force select:focus {
	border-color: var(--tk-accent) !important; background: #fff !important;
	box-shadow: none !important; outline: none !important;
}
.tk-force input[type="checkbox"] { accent-color: var(--tk-accent); }
.tk-force .tk-submit, .tk-force .tk-submit:hover, .tk-force .tk-submit:focus, .tk-force .tk-submit:active,
.tk-force .tk-float-toggle, .tk-force .tk-float-toggle:hover, .tk-force .tk-float-toggle:focus, .tk-force .tk-float-toggle:active {
	color: var(--tk-on-accent) !important; background: var(--tk-accent) !important;
	border: 0 !important; box-shadow: none; text-transform: none !important; text-decoration: none !important;
}
.tk-force .tk-float-toggle, .tk-force .tk-float-toggle:hover { box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28) !important; }
.tk-force .tk-float-toggle .tk-float-label, .tk-force .tk-float-toggle svg { color: var(--tk-on-accent) !important; }
.tk-force .tk-float-close, .tk-force .tk-float-close:hover, .tk-force .tk-float-close:focus {
	color: #444 !important; background: #fff !important; border: 1px solid #ddd !important; box-shadow: none !important;
}
.tk-force .tk-sug { color: var(--tk-text) !important; background: #fff !important; }
.tk-force .tk-sug:hover, .tk-force .tk-sug:active { background: #fff4e0 !important; }
.tk-force .tk-note, .tk-force .tk-hint { color: #777 !important; }
.tk-force .tk-table th { color: #888 !important; background: transparent !important; }
.tk-force .tk-table td, .tk-force .tk-table th { border-color: #eee !important; }
.tk-force .tk-table tbody tr, .tk-force .tk-table tbody tr:nth-child(odd), .tk-force .tk-table tbody tr:nth-child(even) { background: transparent !important; }
.tk-force .tk-table tbody tr:hover { background: #fff4e0 !important; }
.tk-force .tk-result { background: #f7f7f7 !important; }
.tk-force .tk-error { color: #b02a2a !important; background: #fdeaea !important; }
.tk-force .tk-badge.tk-week { color: #2d6a2d !important; background: #e6f2e6 !important; }
.tk-force .tk-badge.tk-weekend { color: #a66300 !important; background: #fff0d6 !important; }
.tk-force .tk-footer, .tk-force .tk-footer a { color: #666 !important; }
.tk-float-panel .tk-widget.tk-force { background: transparent !important; }

/* ------------------------------------------------------------------ *
 * Mobilní zobrazení: vystředěné ovládací prvky a velké plochy pro klepnutí (min. 48 px)
 * ------------------------------------------------------------------ */
@media (max-width: 520px) {
	.tk-widget .tk-form { text-align: center; }
	.tk-widget .tk-field > label:not(.tk-check-label) { text-align: left; }

	.tk-widget input[type="text"],
	.tk-widget select { min-height: 50px; font-size: 16px; }

	/* „Počítat i cestu zpět“ a „Obratem“: vystředěné, celá řádka je klepací plocha. */
	.tk-widget .tk-check { margin-left: 0; }
	.tk-widget .tk-turn-wrap { margin-left: 0; }
	.tk-widget .tk-check label {
		display: flex; align-items: center; justify-content: center; gap: 12px;
		min-height: 52px; padding: 8px 14px; margin: 0;
		font-size: 16px; line-height: 1.3; text-align: center;
		background: #f7f7f7; border: 1px solid #e1e1e1; border-radius: 10px;
	}
	.tk-widget .tk-check input[type="checkbox"] { flex: none; width: 26px; height: 26px; margin: 0; }

	/* Hlavní tlačítko: přes celou šířku, na střed, vysoké. */
	.tk-widget .tk-submit {
		display: block; width: 100%; min-height: 56px; margin: 4px auto 0;
		font-size: 18px; text-align: center;
	}

	.tk-widget .tk-sug { padding: 15px 14px; min-height: 48px; }
	.tk-widget .tk-result { text-align: left; }
	.tk-widget .tk-table td, .tk-widget .tk-table th { padding: 12px 4px; }
	.tk-widget .tk-footer a { display: inline-block; padding: 12px 8px; }

	.tk-float-close { width: 44px; height: 44px; top: 10px; right: 10px; }
	.tk-float-panel .tk-title { padding-right: 52px; }
	.tk-float-panel { padding-bottom: calc(4px + env(safe-area-inset-bottom, 0px)); }

	/* Bublina na telefonu uprostřed dole, panel přes šířku obrazovky. */
	.tk-float--bubble-right .tk-float-toggle {
		right: auto; left: 50%; transform: translateX(-50%);
		bottom: calc(14px + env(safe-area-inset-bottom, 0px));
		width: 64px; height: 64px;
	}
	.tk-float--bubble-right .tk-float-panel {
		left: 8px; right: 8px; width: auto; bottom: calc(90px + env(safe-area-inset-bottom, 0px));
		transform-origin: bottom center;
	}

	/* Spodní lišta: vyšší a s ohledem na výřez/lištu iPhonu. */
	.tk-float--bar-bottom .tk-float-toggle {
		height: calc(56px + env(safe-area-inset-bottom, 0px));
		padding-bottom: env(safe-area-inset-bottom, 0px);
	}
	.tk-float--bar-bottom .tk-float-panel { bottom: calc(56px + env(safe-area-inset-bottom, 0px)); }
}
