
/* Variables moved to base.css, keeping only file-specific ones */
:root {
	--font-ui: var(--font-main);
	--scroll-progress-track: var(--bg-muted);
	--scroll-progress-fill: linear-gradient(90deg, var(--accent-deep) 0%, var(--accent-strong) 100%);
}

[data-theme='light'] {
	--scroll-progress-fill: linear-gradient(90deg, var(--accent-deep) 0%, var(--accent) 100%);
}

[data-theme='pink'] {
	--scroll-progress-fill: linear-gradient(90deg, var(--accent-deep) 0%, var(--accent) 100%);
}

* {
	box-sizing: border-box;
}

*::selection {
	background: var(--accent-soft);
	color: var(--text);
}

body {
	margin: 0;
	min-height: var(--viewport-height);
	font-family: var(--font-ui), sans-serif;
	background: var(--bg);
	color: var(--text);
	line-height: 1.6;
	padding-bottom: var(--safe-area-bottom);
}

body.survey-page {
	overflow-x: hidden;
}

img {
	max-width: 100%;
	display: block;
}

a {
	color: var(--accent);
	text-decoration: none;
}

a:hover {
	color: var(--accent-strong);
}

button,
input,
select,
textarea {
	font: inherit;
	color: inherit;
}

.hidden {
	display: none !important;
}

.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

main {
	width: min(var(--page-max), 100%);
	margin: 0 auto;
	padding: clamp(1.5rem, 4vw, 3rem) var(--page-gutter) 4rem;
}

.site-header {
	width: 100%;
	margin: 0;
	padding: var(--page-gutter-compact) var(--page-gutter) 1rem;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
}

.create-page .site-header,
.login-page .site-header,
.survey-page .site-header,
.legal-page .site-header,
.results-page .site-header {
	width: 100%;
}

.legal-page {
	background: var(--bg);
}

.site-header.compact {
	flex-wrap: wrap;
}

.brand {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

/* .eyebrow ist in base.css zentral definiert (siehe Kommentar dort).
   Hier nur noch die Duplikat-Definition entfernt, damit Homepage
   und Impressum dasselbe Erscheinungsbild bekommen. */

.page-title {
	margin: 0;
	font-size: clamp(1.6rem, 3vw, 2.75rem);
}

.header-actions {
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

.btn,
.btn-primary,
.btn-secondary,
.btn-warning,
.btn-ghost,
.btn-danger,
button {
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	padding: 0.65rem 1.15rem;
	font-weight: 500;
	font-size: 0.9rem;
	letter-spacing: 0.01em;
	cursor: pointer;
	position: relative;
	overflow: hidden;
	transition: transform var(--transition-fast),
	            box-shadow var(--transition-normal),
	            background var(--transition-fast),
	            border-color var(--transition-fast),
	            color var(--transition-fast),
	            filter var(--transition-fast);
	background: var(--bg-muted);
	color: var(--text);
	box-shadow: var(--shadow);
}

.btn-primary,
button.btn-primary,
.login_btn.btn-primary {
	background: var(--bg-muted);
	color: var(--text);
	border-color: var(--border);
	box-shadow: var(--shadow);
}

[data-theme='light'] .btn-primary,
[data-theme='light'] button.btn-primary,
[data-theme='light'] .login_btn.btn-primary,
[data-theme='pink'] .btn-primary,
[data-theme='pink'] button.btn-primary,
[data-theme='pink'] .login_btn.btn-primary {
	color: var(--text) !important;
}

.btn-secondary {
	background: transparent;
	border-color: var(--border-strong);
	color: var(--text);
}

.btn-secondary:hover {
	background: var(--bg-muted);
}

.btn-warning {
	background: var(--bg-muted);
	border-color: var(--warning);
	color: var(--warning);
}

.btn-ghost {
	background: transparent;
	border-color: transparent;
	box-shadow: none;
}

.btn-ghost:hover {
	background: var(--bg-muted);
	border-color: var(--border);
}

.btn-danger {
	background: var(--bg-muted);
	border-color: var(--error);
	color: var(--error);
}

.btn-danger:hover {
	background: var(--error);
	color: #fff;
}

/* #19: Hover ohne Lift — nur dezenter Helligkeits-/Border-Wechsel. */
.btn:hover,
button:hover {
	border-color: var(--border-strong);
	background: var(--bg-contrast);
}

.btn-primary:hover {
	filter: brightness(1.04);
	border-color: var(--border-strong);
}

.btn:active,
button:active {
	filter: brightness(0.96);
	box-shadow: var(--shadow);
}

.btn:disabled,
.login_btn:disabled,
button:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	transform: none !important;
	filter: grayscale(0.4);
}

/* Global button styles apply consistently across all pages */
.create-page .btn,
.create-page button {
	/* Inherit global transition and motion */
}

.create-page .actions-menu {
	transition: opacity 90ms linear, transform 90ms linear;
}

.create-page .actions-option,
.create-page .type-option,
.create-page .question-action-btn {
	transition-duration: 70ms;
}

.create-page .type-option {
	transition: none;
}

/* .icon-button moved to base.css */

/* .theme-toggle moved to base.css */

.hero {
	background: radial-gradient(circle at top right, var(--accent-glow), transparent 55%), var(--bg-elevated);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	padding: clamp(1.75rem, 5vw, 3.5rem);
	box-shadow: var(--shadow);
	margin-bottom: clamp(2rem, 5vw, 3.5rem);
}

.hero-copy {
	max-width: 640px;
}

.hero-title {
	font-size: clamp(2rem, 5vw, 3rem);
	margin: 0 0 1rem;
	line-height: 1.2;
}

.hero-text {
	margin: 0;
	color: var(--text-muted);
	font-size: 1.05rem;
}

.hero-spacer {
	height: clamp(1rem, 5vw, 3rem);
}

/* .section-heading ist in base.css zentral definiert. */

.surveys-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
	gap: 1.25rem;
}

/* .survey-card base moved to base.css */
.survey-card {
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
}

.survey-card.is-disabled {
	opacity: 0.55;
	filter: grayscale(0.3);
	pointer-events: none;
}

.survey-card h3 {
	margin: 0;
	font-size: 1.1rem;
}

.survey-date {
	margin: 0;
	color: var(--text-muted);
	font-size: 0.9rem;
}

.survey-link-btn {
	margin-top: 0.75rem;
	align-self: flex-start;
}

.survey-link-btn.is-disabled {
	cursor: not-allowed;
	background: var(--bg-contrast);
	color: var(--text-muted);
	box-shadow: none;
}

form {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

label {
	font-weight: 600;
}

.h2 {
	font-size: 1.1rem;
	font-weight: 600;
	margin: 0;
}

input,
textarea,
select {
	width: 100%;
	padding: 0.75rem 0.85rem;
	border-radius: var(--radius-sm);
	border: 1px solid var(--border);
	background: var(--bg-muted);
	color: var(--text);
}

select,
select option,
select optgroup {
	font-family: var(--font-ui), sans-serif;
	font-size: 0.95rem;
	font-weight: 500;
	line-height: 1.4;
}

select {
	-webkit-appearance: none;
	appearance: none;
	padding-right: 2rem;
	background-image:
		linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
		linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
	background-position:
		calc(100% - 15px) calc(50% - 2px),
		calc(100% - 10px) calc(50% - 2px);
	background-size: 5px 5px, 5px 5px;
	background-repeat: no-repeat;
}

select[multiple],
select[size] {
	background-image: none;
	padding-right: 0.85rem;
}

input[type='checkbox'],
input[type='radio'] {
	-webkit-appearance: none;
	appearance: none;
	width: 1.05rem;
	height: 1.05rem;
	margin: 0;
	padding: 0;
	border: 1px solid var(--border-strong);
	background: var(--bg-elevated);
	display: inline-grid;
	place-content: center;
	cursor: pointer;
	transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, box-shadow 180ms ease;
}

input[type='checkbox'] {
	border-radius: 0.32rem;
}

input[type='radio'] {
	border-radius: 999px;
}

input[type='checkbox']::before {
	content: '';
	width: 0.54rem;
	height: 0.3rem;
	border-left: 2px solid #fff;
	border-bottom: 2px solid #fff;
	transform: rotate(-45deg) scale(0);
	transform-origin: center;
	transition: transform 130ms ease;
}

input[type='radio']::before {
	content: '';
	width: 0.5rem;
	height: 0.5rem;
	border-radius: 999px;
	background: #fff;
	transform: scale(0);
	transition: transform 130ms ease;
}

input[type='checkbox']:checked,
input[type='radio']:checked {
	background: var(--accent);
	border-color: var(--accent-strong);
	box-shadow: 0 0 0 3px var(--accent-soft);
}

input[type='checkbox']:checked::before,
input[type='radio']:checked::before {
	transform: rotate(-45deg) scale(1);
}

input[type='radio']:checked::before {
	transform: scale(1);
}

input[type='checkbox']:focus-visible,
input[type='radio']:focus-visible {
	outline: none;
	box-shadow: 0 0 0 3px var(--accent-soft);
	transform: scale(1.04);
}

input[type='checkbox']:disabled,
input[type='radio']:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

textarea {
	min-height: 120px;
	resize: vertical;
}

.submit_btn,
form button[type='submit'] {
	align-self: flex-start;
}

.input-with-toggle {
	position: relative;
	display: flex;
	align-items: center;
}

.input-with-toggle input {
	padding-right: 3rem;
}

.toggle-password {
	position: absolute;
	right: 0.6rem;
	background: transparent;
	border: none;
	padding: 0.35rem;
}

.toggle-password:focus-visible {
	outline: 2px solid var(--accent);
	border-radius: 6px;
}

.auth-shell {
	width: min(480px, 100%);
	margin: 0 auto;
	padding: clamp(1.5rem, 3vw, 2.5rem);
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.auth-card {
	background: var(--bg-elevated);
	border-radius: var(--radius-md);
	padding: 2rem;
	border: 1px solid var(--border);
	box-shadow: var(--shadow);
}

.form-hint {
	margin: 0;
	color: var(--text-muted);
	font-size: 0.95rem;
	text-align: center;
}

.create-shell {
	width: min(var(--page-max), 100%);
	margin: 0 auto;
	padding: clamp(1.5rem, 4vw, 3rem) var(--page-gutter) 4rem;
}

.admin-shell {
	width: min(var(--page-max), 100%);
}

.admin-guard {
	position: fixed;
	inset: 0;
	display: grid;
	place-items: center;
	background: var(--bg);
	color: var(--text-muted);
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	font-size: 0.78rem;
	z-index: 50;
}

body.admin-locked .admin-shell {
	display: none;
}

body.admin-locked .admin-only {
	display: none;
}

body:not(.admin-locked) .admin-guard {
	display: none;
}

.admin-overview {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
	gap: 0.85rem;
	margin-bottom: 1rem;
}

.admin-metric-card {
	background: var(--bg-elevated);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	padding: 0.95rem 1rem;
	box-shadow: var(--shadow);
}

.admin-metric-label {
	margin: 0;
	color: var(--text-muted);
	font-size: 0.82rem;
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

.admin-metric-value {
	margin: 0.25rem 0 0;
	font-size: 1.8rem;
	font-weight: 700;
	line-height: 1;
}

.admin-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 1rem;
	align-items: start;
}

.admin-panel {
	background: var(--bg-elevated);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	padding: 1rem;
	box-shadow: var(--shadow);
}

.admin-list-panel {
	display: flex;
	flex-direction: column;
	min-height: 0;
}

.admin-section-title {
	margin: 0;
	font-size: 1.2rem;
}

.admin-list-header {
	display: flex;
	gap: 1rem;
	justify-content: space-between;
	align-items: center;
	flex-wrap: wrap;
}

.create-header-brand {
	display: grid;
	gap: 0.15rem;
}

.admin-list-content {
	margin-top: 0.85rem;
	display: grid;
	gap: 0.85rem;
}

.admin-list-controls {
	display: flex;
	gap: 0.6rem;
	flex-wrap: wrap;
}

.admin-list-controls input,
.admin-list-controls select {
	min-width: 220px;
}

.admin-builder-panel .create-form {
	background: transparent;
	border: 0;
	box-shadow: none;
	padding: 0;
	margin-bottom: 0.75rem;
}

.admin-builder-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
}

.admin-builder-header .admin-section-title {
	margin-bottom: 0;
}

.admin-builder-content {
	margin-top: 0.85rem;
}

/* #23: Der alte Inline-Title-Editor (.title-inline-*), das alte
   Metadaten-Panel (.builder-metadata*) und die Builder-Toolbar /
   Mobile-Preview-CSS sind mit dem Studio-Redesign weggefallen. Die
   Klassen wurden aus admin.js und dashboard.html entfernt; die Regeln
   hingen hier ohne Konsumenten herum. */

.template-quick-insert {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
	gap: 0.5rem;
	margin-bottom: 0.8rem;
}

.template-quick-btn {
	border: 1px solid var(--border);
	background: var(--bg);
	border-radius: 10px;
	padding: 0.55rem;
	text-align: left;
}

.admin-list-panel #surveysList {
	background: transparent;
	border: 0;
	padding: 0;
	margin: 0;
	display: grid;
	align-content: start;
	gap: 0.85rem;
	max-height: none;
	overflow: visible;
	overscroll-behavior: auto;
}

.admin-list-panel #surveysList::-webkit-scrollbar {
	width: 8px;
}

.admin-list-panel #surveysList::-webkit-scrollbar-track {
	background: transparent;
}

.admin-list-panel #surveysList::-webkit-scrollbar-thumb {
	background: var(--border-strong);
	border-radius: 999px;
}

.create-form,
#surveysList {
	background: var(--bg-elevated);
	border-radius: var(--radius-md);
	padding: 1rem;
	border: 1px solid var(--border);
	margin-bottom: 2rem;
}

.edit-mode-banner {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 1rem;
	background: var(--accent-soft);
	border: 1px solid var(--accent-strong);
	border-radius: var(--radius-md);
	padding: 1rem 1.25rem;
	margin-bottom: 1.5rem;
}

.edit-mode-banner p {
	margin: 0;
}

.edit-mode-banner .banner-title {
	font-weight: 600;
}

.question-card {
	background: var(--bg-elevated);
	border-radius: var(--radius-md);
	padding: 1rem;
	border: 1px solid var(--border-strong);
	margin-bottom: 0.95rem;
	box-shadow: var(--shadow);
	position: relative;
	content-visibility: auto;
	contain-intrinsic-size: 420px;
}

/* Keep create-builder scrolling smooth: `content-visibility:auto` can cause
   visible pop-in/height shifts on long dynamic forms while scrolling. */
.create-page .question-card {
	content-visibility: visible;
	contain-intrinsic-size: none;
}

.question-card::before {
	content: '';
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	width: 4px;
	border-radius: 16px 0 0 16px;
	background: linear-gradient(180deg, var(--accent) 0%, transparent 100%);
	opacity: 0.75;
}

.question-card-locked {
	border-style: dashed;
}

.question-card-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	margin-bottom: 0.55rem;
}

.question-card-collapsed .question-card-header {
	margin-bottom: 0;
}

.question-card-collapsed,
.question-card-collapsed .question-card-header,
.question-card-collapsed .question-card-title,
.question-card-collapsed .question-card-title * {
	cursor: pointer;
}

.question-card-title {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.question-locked-pill {
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	padding: 0.1rem 0.5rem;
	border-radius: 999px;
	border: 1px solid var(--border);
	background: rgba(255, 255, 255, 0.02);
	color: var(--text-muted);
}

.locked-hint {
	margin: 0.35rem 0 0;
	font-size: 0.85rem;
	color: var(--text-muted);
}

.question-card-actions {
	display: flex;
	gap: 0.4rem;
}

.question-card-actions button {
	padding: 0.35rem 0.65rem;
	border-radius: 6px;
	background: var(--bg-muted);
}

.question-action-btn {
	border: 0;
	border-radius: 8px;
}

.toggle-question {
	min-width: 2rem;
}

.question-card-body {
	display: grid;
	gap: 0.65rem;
	border-top: 1px solid var(--border);
	padding-top: 0.75rem;
}

.question-layout-grid {
	display: grid;
	grid-template-columns: minmax(0, 1.7fr) minmax(210px, 0.85fr);
	gap: 0.85rem;
	align-items: start;
}

.question-layout-main,
.question-layout-side {
	display: grid;
	gap: 0.5rem;
}

.compact-label {
	margin: 0;
	font-size: 0.82rem;
	text-transform: uppercase;
	letter-spacing: 0.07em;
	color: var(--text-muted);
	font-weight: 700;
}

.question-required-row {
	display: flex;
	align-items: center;
	justify-content: flex-start;
	gap: 0.5rem;
}

.config-label-text {
	text-align: left;
	line-height: 1.35;
}

.config-section-title {
	margin: 0 0 0.45rem;
	font-size: 0.78rem;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--text-muted);
}

.config-section-title + .config-hint {
	margin-top: 0;
}

.question-config {
	margin-top: 0.2rem;
}

.config-section {
	background: var(--bg-muted);
	border-radius: var(--radius-sm);
	border: 1px solid var(--border);
	padding: 0.7rem;
}

.config-section + .config-section {
	margin-top: 0.6rem;
}

.config-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
	gap: 0.75rem;
}

.config-inline {
	display: flex;
	gap: 0.5rem;
	align-items: center;
	margin-top: 0.5rem;
}

.config-hint {
	margin: 0;
	color: var(--text-muted);
	font-size: 0.9rem;
}

.media-config-section {
	display: grid;
	gap: 0.55rem;
}

.media-enabled-row {
	margin: 0;
}

.media-compact-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.8rem;
}

.media-toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	margin: 0;
	font-weight: 600;
}

.media-state {
	font-size: 0.78rem;
	color: var(--text-muted);
	border: 1px solid var(--border);
	border-radius: 999px;
	padding: 0.1rem 0.55rem;
	background: var(--bg-elevated);
	white-space: nowrap;
}

.media-fields {
	display: grid;
	gap: 0.55rem;
	padding-top: 0.6rem;
	border-top: 1px dashed var(--border);
}

.media-grid {
	grid-template-columns: minmax(110px, 150px) minmax(0, 1fr);
	align-items: center;
}

.media-grid label {
	margin: 0;
}

.media-upload {
	display: grid;
	gap: 0.35rem;
}

.media-upload input[type='file'] {
	padding: 0.65rem 0.7rem;
	background: var(--bg-elevated);
	border: 1px dashed var(--border);
	border-radius: var(--radius-sm);
}

.media-preview {
	border: 1px dashed var(--border);
	border-radius: var(--radius-sm);
	padding: 0.4rem;
	background: var(--bg-elevated);
}

.media-preview img,
.media-preview video,
.media-preview iframe {
	width: 100%;
	max-height: min(48vh, 340px);
	object-fit: contain;
	border-radius: 8px;
	border: 1px solid var(--border);
	background: var(--bg-muted);
}

.media-preview img {
	aspect-ratio: 16 / 9;
}

.media-preview iframe {
	aspect-ratio: 16 / 9;
	min-height: 180px;
}

.option-list {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.row-list,
.field-list {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	margin-top: 0.5rem;
}

.option-row {
	display: flex;
	gap: 0.5rem;
}

.add-option {
	margin-top: 0.65rem;
}

.add-row,
.add-field {
	margin-top: 0.65rem;
}

.add-personeninfos-gender,
.add-personeninfos-age {
	margin-top: 0.65rem;
}

.personeninfos-config-section {
	display: grid;
	gap: 0.55rem;
}

.personeninfos-toggle-grid {
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	align-items: start;
}

.image-choice-admin-list {
	display: grid;
	gap: 0.7rem;
	margin: 0.65rem 0;
}

.image-choice-admin-item {
	display: grid;
	grid-template-columns: minmax(140px, 220px) minmax(0, 1fr) auto;
	gap: 0.7rem;
	align-items: start;
	padding: 0.7rem;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: var(--bg-elevated);
}

.image-choice-admin-preview {
	border: 1px dashed var(--border);
	border-radius: 12px;
	background: var(--bg-muted);
	min-height: 104px;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}

.image-choice-admin-preview.is-empty {
	color: var(--text-muted);
	font-size: 0.85rem;
}

.image-choice-admin-preview img {
	width: 100%;
	height: 100%;
	min-height: 104px;
	object-fit: contain;
	background: var(--bg-elevated);
}

.image-choice-admin-fields {
	display: grid;
	gap: 0.35rem;
}

.image-choice-admin-fields label {
	font-size: 0.82rem;
	color: var(--text-muted);
	font-weight: 600;
}

.remove-image-choice {
	align-self: start;
}

.overlay-open {
	overflow: hidden;
}

.type-overlay {
	position: fixed;
	inset: 0;
	z-index: 320;
	display: grid;
	place-items: center;
	padding: calc(1.25rem + var(--safe-area-top)) calc(1.25rem + var(--safe-area-right)) calc(1.25rem + var(--safe-area-bottom)) calc(1.25rem + var(--safe-area-left));
}

.type-overlay-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(5, 9, 18, 0.68);
	backdrop-filter: blur(3px);
}

.type-overlay-dialog {
	position: relative;
	width: min(1120px, 100%);
	max-height: calc(var(--viewport-height) - 2.5rem);
	padding: 1.3rem 1.35rem 1.15rem;
	border-radius: 20px;
	background: var(--bg-elevated);
	border: 1px solid var(--border);
	box-shadow: 0 32px 72px rgba(2, 6, 23, 0.55);
	display: grid;
	grid-template-rows: auto 1fr;
	gap: 1rem;
	overflow: hidden;
}

.delete-overlay-dialog {
	width: min(640px, 100%);
}

.type-overlay-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
}

.type-overlay-header h3 {
	margin: 0;
	font-size: clamp(1.35rem, 2.2vw, 2rem);
	line-height: 1.2;
}

.overlay-subtitle {
	margin: 0.35rem 0 0;
	font-size: 0.86rem;
	color: var(--text-muted);
	font-weight: 500;
}

.type-overlay-close {
	min-width: 2.35rem;
	width: 2.35rem;
	height: 2.35rem;
	padding: 0;
	border-radius: 999px;
	font-size: 1.05rem;
	flex-shrink: 0;
}

.type-overlay-content {
	overflow: auto;
	display: grid;
	gap: 0.9rem;
	padding-right: 0.2rem;
}

.delete-progress-actions {
	display: flex;
	justify-content: flex-end;
	gap: 0.6rem;
}

.app-modal-dialog {
	width: min(560px, 100%);
}

.app-modal-content {
	gap: 0.85rem;
	overflow: auto;
	min-height: 0;
}

.app-modal-body {
	margin: 0;
	white-space: pre-line;
	line-height: 1.55;
}

.app-modal-input-wrap {
	display: grid;
	gap: 0.35rem;
}

.app-modal-label {
	font-size: 0.82rem;
	color: var(--text-muted);
	font-weight: 600;
}

.app-modal-actions {
	display: flex;
	justify-content: flex-end;
	gap: 0.6rem;
	flex-wrap: wrap;
	/* Pin actions to the bottom of the dialog so they're never cut off
	   when the body text is long. The sticky background covers the
	   scrolling content right above. */
	position: sticky;
	bottom: 0;
	padding: 0.7rem 0 0.2rem;
	margin-top: 0.4rem;
	background: linear-gradient(
		to bottom,
		color-mix(in srgb, var(--bg-elevated) 70%, transparent) 0%,
		var(--bg-elevated) 35%,
		var(--bg-elevated) 100%
	);
	z-index: 1;
}

.type-overlay-columns {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 1rem;
}

.type-group {
	padding: 0;
	background: transparent;
	border: 0;
}

.type-group h4 {
	margin: 0 0 0.65rem;
	font-size: 0.84rem;
	text-transform: uppercase;
	letter-spacing: 0.11em;
	color: var(--text-muted);
	font-weight: 700;
}

.type-group-grid {
	display: grid;
	gap: 0.3rem;
}

.type-option {
	width: 100%;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.1rem;
	background: transparent;
	border: 1px solid transparent;
	border-radius: 10px;
	padding: 0.55rem 0.65rem;
	text-align: left;
	color: var(--text);
	font-weight: 600;
	box-shadow: none;
	transform: none;
	/* No transitions — user explicitly wanted the picker to feel
	   "simpel und effektiv". Hover/focus are an instant border + bg
	   swap. No transform, no fade. */
	transition: none;
}

.type-option:hover,
.type-option:focus-visible {
	border-color: var(--border-strong, var(--accent));
	background: var(--bg-muted, var(--accent-soft));
	outline: none;
}

.type-option:active {
	background: var(--bg-contrast, var(--accent-soft));
}

.type-option-label {
	font-size: 1.02rem;
}

.type-option-hint {
	font-size: 0.8rem;
	color: var(--text-muted);
	font-weight: 500;
}

.survey-item {
	border-radius: var(--radius-md);
	background: var(--bg-elevated);
	padding: 1.25rem;
	border: 1px solid var(--border);
	box-shadow: var(--shadow);
	overflow: visible;
	/* IMPORTANT: Do NOT add `content-visibility` or `contain: paint` on this card.
	   The admin action dropdown menus are absolutely positioned and must be allowed
	   to overflow outside the survey card without getting clipped. */
}

.survey-item-header {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.survey-item-heading h4 {
	margin: 0;
}

.survey-item-meta {
	margin: 0.35rem 0 0;
	color: var(--text-muted);
	word-break: break-all;
	overflow-wrap: anywhere;
}

.status-pill {
	padding: 0.1rem 1.6rem;
	border-radius: 999px;
	font-size: 0.78rem;
	background: var(--bg-muted);
	border: 1px solid var(--border);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.status-pill.status-active {
	background: rgba(52, 211, 153, 0.15);
	border-color: rgba(52, 211, 153, 0.6);
	color: var(--success);
}

.status-pill.status-inactive {
	background: rgba(248, 113, 113, 0.12);
	border-color: rgba(248, 113, 113, 0.6);
	color: var(--error);
}

/* #17: "Abgeschlossen" — inaktive Studie mit veröffentlichter
   Zusammenfassung. Eigener visueller Slot (lila statt rot), damit
   "pausiert" und "fertig publiziert" sich auf den ersten Blick
   unterscheiden lassen. */
.status-pill.status-concluded {
	background: var(--accent-soft);
	border-color: color-mix(in srgb, var(--accent) 45%, transparent);
	color: var(--accent-strong);
}

.survey-item-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin-top: 1rem;
}

.survey-item-actions-primary {
	align-items: center;
}

.survey-item-actions-primary .btn {
	flex: 0 1 auto;
}


.survey-actions-dropdown {
	position: relative;
	flex: 0 1 170px;
	min-width: 150px;
	max-width: 220px;
	z-index: 1;
}

.survey-actions-dropdown .actions-toggle {
	width: 100%;
}

.toggle-survey-status {
	white-space: nowrap;
}

.view-results-btn {
	white-space: nowrap;
}

.toggle-survey-status-icon {
	width: 2.45rem;
	min-width: 2.45rem;
	height: 2.45rem;
	padding: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 1.05rem;
	line-height: 1;
	/* Per-theme icon color via currentColor on the inner SVG. */
	color: var(--text);
}

.toggle-survey-status-icon svg {
	transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toggle-survey-status-icon:hover svg {
	transform: scale(1.15);
}

.toggle-survey-status-icon:active svg {
	transform: scale(0.92);
}

.toggle-survey-status-icon span {
	pointer-events: none;
	display: flex;
}

.survey-completions {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	padding: 0.35rem 0.75rem;
	border-radius: 999px;
	border: 1px dashed var(--border);
	background: var(--bg-muted);
	color: var(--text-muted);
	font-size: 0.85rem;
	white-space: nowrap;
}

.survey-abandons {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	padding: 0.35rem 0.75rem;
	border-radius: 999px;
	border: 1px dashed rgba(248, 113, 113, 0.55);
	background: rgba(248, 113, 113, 0.12);
	color: var(--error);
	font-size: 0.85rem;
	white-space: nowrap;
}

.actions-menu {
	position: absolute;
	top: calc(100% + 0.5rem);
	right: 0;
	left: auto;
	font-family: inherit;
	min-width: 220px;
	display: none;
	gap: 0.35rem;
	padding: 0.45rem;
	background: var(--bg-elevated);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	box-shadow: var(--shadow);
	opacity: 0;
	transform: translateY(-8px) scale(0.98);
	transform-origin: top center;
	pointer-events: none;
	transition: opacity 180ms ease, transform 220ms cubic-bezier(0.16, 1, 0.3, 1);
	z-index: 20;
	max-height: min(52vh, 300px);
	overflow-y: auto;
	overscroll-behavior: contain;
	scrollbar-width: thin;
	scrollbar-color: var(--border-strong) transparent;
}

.survey-main-dropdown .actions-menu {
	left: 0;
	right: auto;
}

.survey-actions-dropdown.is-upward .actions-menu {
	top: auto;
	bottom: calc(100% + 0.5rem);
	transform-origin: bottom center;
}

.actions-menu::-webkit-scrollbar {
	width: 8px;
}

.actions-menu::-webkit-scrollbar-track {
	background: transparent;
}

.actions-menu::-webkit-scrollbar-thumb {
	background: var(--border-strong);
	border-radius: 999px;
}

.survey-actions-dropdown.is-open .actions-menu {
	display: grid;
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}

.survey-actions-dropdown.is-open {
	z-index: 1200;
}

.actions-option {
	border: 1px solid transparent;
	background: transparent;
	color: var(--text);
	text-align: left;
	border-radius: 0.5rem;
	padding: 0.5rem 0.65rem;
	cursor: pointer;
	transition: transform 150ms ease, background 150ms ease, border-color 150ms ease;
}

.actions-option:hover,
.actions-option:focus-visible {
	outline: none;
	background: var(--bg-muted);
	border-color: var(--border);
	transform: translateX(2px);
}

.actions-divider {
	height: 1px;
	background: var(--border);
	margin: 0.2rem 0;
}

.actions-group-label {
	margin: 0.25rem 0.35rem 0.1rem;
	font-size: 0.72rem;
	color: var(--text-muted);
	letter-spacing: 0.08em;
	text-transform: uppercase;
	font-weight: 600;
}

.actions-option-danger {
	color: var(--error);
}
.actions-option-danger:hover {
	background: color-mix(in srgb, var(--error) 10%, var(--bg-elevated));
}
/* "Studie abschließen" — positive milestone action, highlighted
   with the success colour so it doesn't get lost between the
   neutral options and the destructive Löschen at the bottom. */
.actions-option-success {
	color: var(--success, #15803d);
	font-weight: 700;
}
.actions-option-success:hover {
	background: color-mix(in srgb, var(--success, #15803d) 12%, var(--bg-elevated));
}


.survey-shell {
	width: min(760px, 100%);
	margin: 0 auto;
	padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 4vw, 2rem);
}

.survey-page .survey-shell {
	width: min(1120px, 100%);
	padding: clamp(1rem, 2.8vw, 2.25rem) clamp(0.8rem, 2.4vw, 1.8rem) 2rem;
}

.survey-page .page-title,
.survey-page #surveyTitle {
	text-align: center;
}

.survey-page #surveyForm {
	display: grid;
	gap: 1rem;
}

.survey-page #questionsContainer {
	min-height: auto;
	display: grid;
	align-items: start;
}

.survey-page .survey-shell,
.survey-page #surveyForm,
.survey-page #questionsContainer,
.survey-page .question-block,
.survey-page .question-options,
.survey-page .ranking-layout,
.survey-page .ranking-list,
.survey-page .ranking-item {
	min-width: 0;
	max-width: 100%;
}


.question-block {
	background: var(--bg-elevated);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	padding: 1.25rem;
	box-shadow: var(--shadow);
	margin-bottom: 1rem;
}

.survey-page .question-block {
	/* content-visibility: auto was here for perf but caused a flicker on
	   mobile: tapping an option could re-layout the block off-screen
	   briefly, the browser would skip its render, and the user saw the
	   container go blank until they tapped elsewhere. The optimization
	   isn't worth the UX regression for survey forms. */
	width: 100%;
	max-width: min(1080px, 100%);
	margin: 0 auto;
	min-height: auto;
	padding: clamp(1rem, 2.8vw, 2rem);
	display: grid;
	align-content: start;
	gap: 0.8rem;
	/* Belt-and-braces: never let a single question block grow past the
	   viewport (was causing horizontal page-scroll + viewport zoom on
	   mobile when long URLs or unbreakable strings appeared in answers). */
	overflow-x: hidden;
	min-width: 0;
}

/* Allow long URLs / unbreakable strings inside question text + answers
   to wrap instead of pushing the layout wider than the screen. */
.survey-page .question-block,
.survey-page .question-label,
.survey-page .question-options,
.survey-page .option-item,
.survey-page .option-item span,
.survey-page .matrix-row,
.survey-page .matrix-row-label,
.survey-page .ranking-item,
.survey-page input,
.survey-page textarea,
.survey-page select {
	overflow-wrap: anywhere;
	word-break: break-word;
	max-width: 100%;
}

.survey-page .question-block.is-step-hidden {
	display: none !important;
}

/* Invalid-flash uses ONLY box-shadow which is a compositor property —
   no paint, no color-mix, no background recalculation. This dropped the
   "red blink lag" on low-end mobiles. */
@keyframes survey-invalid-flash {
	0%,
	100% {
		box-shadow: var(--shadow);
	}
	35% {
		box-shadow: 0 0 0 2px var(--error), 0 0 24px rgba(248, 113, 113, 0.45);
	}
}

.survey-page .question-block.is-invalid {
	animation: survey-invalid-flash 500ms ease-out 0s 2;
}

@media (prefers-reduced-motion: reduce) {
	.survey-page .question-block.is-invalid {
		animation: none;
		box-shadow: 0 0 0 2px var(--error);
	}
}

.question-label {
	display: block;
	font-weight: 600;
	margin-bottom: 0.65rem;
	overflow-wrap: anywhere;
	word-break: break-word;
}

.question-options {
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
}

.personeninfos-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: 0.65rem;
}

.personeninfos-field {
	display: grid;
	gap: 0.35rem;
	padding: 0.6rem 0.65rem;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: var(--bg-muted);
}

.personeninfos-field-label {
	font-size: 0.82rem;
	font-weight: 600;
	color: var(--text-muted);
}

.personeninfos-field input,
.personeninfos-field select {
	width: 100%;
}

.option-item {
	display: grid;
	grid-template-columns: auto 1fr;
	align-items: center;
	gap: 0.65rem;
	width: 100%;
	padding: 0.55rem 0.75rem;
	border-radius: var(--radius-sm);
	border: 1px solid var(--border);
	background: var(--bg-muted);
	cursor: pointer;
	/* Transition border + background only — both are cheap. The previous
	   transform animation forced a compositor layer on every tap which
	   ate frames on low-end Android. */
	transition: border-color 130ms ease, background 130ms ease;
}

.option-item input {
	margin: 0;
}

.option-item span {
	line-height: 1.5;
	word-break: normal;
	word-wrap: break-word;
	white-space: normal;
}

/* Only show hover-lift on devices that actually hover (desktop with mouse).
   Touch devices never benefit and pay the GPU cost. */
@media (hover: hover) and (pointer: fine) {
	.option-item:hover {
		border-color: var(--border-strong);
	}
}

.option-item:has(input:checked) {
	border-color: var(--accent);
	background: var(--accent-soft);
}

.option-item-with-inline-input {
	grid-template-columns: auto minmax(0, 1fr);
	row-gap: 0.45rem;
}

.inline-other-input {
	grid-column: 2;
	padding: 0.45rem 0.65rem;
}

.inline-other-input:disabled {
	opacity: 0.55;
}

.question-options-image .option-item {
	grid-template-columns: auto minmax(0, 1fr);
	min-height: 52px;
}

.question-options-image-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: 0.7rem;
}

.image-choice-card {
	position: relative;
	display: grid;
	border: 1px solid var(--border);
	border-radius: 14px;
	overflow: hidden;
	background: var(--bg-muted);
	cursor: pointer;
	transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.image-choice-card input[type='radio'] {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
	pointer-events: none;
}

.image-choice-card::after {
	content: '✓';
	position: absolute;
	top: 0.5rem;
	left: 0.5rem;
	width: 1.45rem;
	height: 1.45rem;
	border-radius: 999px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 0.82rem;
	font-weight: 700;
	color: #ffffff;
	background: var(--accent);
	box-shadow: 0 5px 16px rgba(15, 23, 42, 0.35);
	opacity: 0;
	transform: scale(0.7);
	transition: opacity 160ms ease, transform 160ms ease;
}

.image-choice-card-media {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: var(--bg-elevated);
	padding: 0.4rem;
}

.image-choice-card-media img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.image-choice-zoom-trigger {
	position: absolute;
	top: 0.45rem;
	right: 0.45rem;
	z-index: 3;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2rem;
	height: 2rem;
	padding: 0;
	border-radius: 999px;
	border: 1px solid rgba(255, 255, 255, 0.42);
	background: rgba(2, 6, 23, 0.72);
	color: #ffffff;
	cursor: zoom-in;
	user-select: none;
}

.image-choice-zoom-trigger svg {
	width: 1.2rem;
	height: 1.2rem;
	display: block;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.9;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.image-choice-zoom-trigger:hover {
	background: rgba(2, 6, 23, 0.86);
}

.image-choice-zoom-trigger:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

.image-choice-card-placeholder {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--text-muted);
	font-weight: 600;
}

/* #19: kein Lift, nur Border-Wechsel beim Hovern. */
.image-choice-card:hover {
	border-color: var(--border-strong);
}

.image-choice-card:hover .image-choice-card-media img {
	transform: none;
}

.image-choice-card.is-selected {
	border-color: var(--accent);
	box-shadow: 0 0 0 3px var(--accent-soft);
}

.image-choice-card.is-selected::after {
	opacity: 1;
	transform: scale(1);
}

.dropdown-stack {
	gap: 0.5rem;
}

.dropdown-other-input {
	padding: 0.65rem 0.8rem;
}

.ranking-layout {
	display: flex;
	gap: 0.75rem;
	align-items: stretch;
}

.ranking-list {
	flex: 1;
	display: grid;
	gap: 0.5rem;
	position: relative;
	touch-action: pan-y;
}

.ranking-list.is-pointer-dragging {
	touch-action: none;
}

.ranking-item {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto;
	align-items: center;
	gap: 0.55rem;
	padding: 0.55rem 0.65rem;
	border-radius: 12px;
	border: 1px solid var(--border);
	background: var(--bg-muted);
	transition: transform 170ms cubic-bezier(0.22, 1, 0.36, 1), border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.ranking-item:focus-visible {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 3px var(--accent-soft);
}

.ranking-item.is-dragging,
.ranking-item.is-dragging-touch {
	opacity: 0.94;
	border-color: var(--accent);
	box-shadow: 0 12px 34px rgba(2, 6, 23, 0.26), 0 0 0 3px var(--accent-soft);
	background: var(--bg-elevated);
}

.ranking-placeholder {
	border-radius: 12px;
	border: 1px dashed var(--border-strong);
	background: rgba(148, 163, 184, 0.12);
}

body.ranking-drag-active {
	user-select: none;
	-webkit-user-select: none;
}

.ranking-handle {
	width: 2.05rem;
	min-width: 2.05rem;
	height: 2.05rem;
	padding: 0;
	border-radius: 10px;
	background: var(--bg-elevated);
	border: 1px solid var(--border);
	cursor: grab;
	line-height: 1;
	font-size: 1rem;
	touch-action: none;
	user-select: none;
	-webkit-user-select: none;
}

.ranking-list.is-dragging-touch .ranking-handle {
	cursor: grabbing;
}

.ranking-item-label {
	font-weight: 600;
	min-width: 0;
	overflow-wrap: anywhere;
	word-break: break-word;
}

.ranking-item-rank {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2rem;
	height: 2rem;
	border-radius: 999px;
	border: 1px solid var(--border);
	background: var(--bg-elevated);
	font-weight: 700;
}

.ranking-scale-guide {
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 0.5rem 0.25rem;
	color: var(--text-muted);
	font-size: 0.85rem;
	gap: 0.25rem;
	width: 24px;
	min-width: 24px;
}

.prio-label {
	font-weight: 800;
	color: var(--accent);
	font-size: 1.25rem;
	line-height: 1;
	user-select: none;
}

.prio-arrow-line {
	flex: 1;
	width: 2px;
	background: var(--accent);
	position: relative;
	margin: 0.1rem 0;
}

.prio-arrow-line::before,
.prio-arrow-line::after {
	content: '';
	position: absolute;
	left: 50%;
	width: 8px;
	height: 8px;
	border-left: 2px solid var(--accent);
	border-top: 2px solid var(--accent);
	transform-origin: center;
}

.prio-arrow-line::before {
	top: 0;
	transform: translateX(-50%) rotate(45deg);
}

.prio-arrow-line::after {
	bottom: 0;
	transform: translateX(-50%) rotate(225deg);
}

@media (max-width: 768px) {
	.ranking-layout {
		gap: 0.4rem;
	}
	.ranking-scale-guide {
		width: 18px;
		min-width: 18px;
		padding: 0.4rem 0.15rem;
	}
}

.matrix-question {
	display: grid;
	gap: 0.6rem;
	min-width: 0;
	max-width: 100%;
}

.matrix-row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(180px, 1fr);
	gap: 0.6rem;
	align-items: center;
	padding: 0.55rem 0.65rem;
	border-radius: var(--radius-sm);
	border: 1px solid var(--border);
	background: var(--bg-muted);
	min-width: 0;
}

.matrix-row > * {
	min-width: 0;
}

.matrix-row-label {
	margin: 0;
	font-weight: 600;
	line-height: 1.4;
	overflow-wrap: anywhere;
	word-break: break-word;
}

.matrix-row-select {
	min-width: 0;
}

.matrix-rating-options {
	display: flex;
	flex-wrap: nowrap;
	gap: 0.4rem;
	align-items: stretch;
	width: 100%;
	min-width: 0;
}

.matrix-rating-option {
	flex: 1 1 0;
	min-width: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0.55rem 0.3rem;
	border-radius: 10px;
	border: 1px solid var(--border);
	background: var(--bg-elevated);
	cursor: pointer;
	transition: border-color var(--transition-fast), background var(--transition-fast),
		transform var(--transition-fast);
	position: relative;
}

/* Radio is hidden but stays in the tab order so keyboard / screen readers
   still work. The selected state is shown by the surrounding label. */
.matrix-rating-option input[type='radio'] {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	opacity: 0;
	cursor: pointer;
}

.matrix-rating-option span {
	font-weight: 600;
	font-size: 0.95rem;
	color: var(--text);
	text-align: center;
	pointer-events: none;
}

.matrix-rating-option:hover {
	border-color: var(--border-strong);
}

.matrix-rating-option:has(input:checked) {
	border-color: var(--accent);
	background: var(--accent-soft);
}

.matrix-rating-option:has(input:focus-visible) {
	outline: 2px solid var(--border-focus);
	outline-offset: 2px;
}

.scale-container {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.scale-container input[type='range'] {
	width: 100%;
}

.scale-labels {
	display: flex;
	justify-content: space-between;
	font-size: 0.9rem;
	color: var(--text-muted);
}

.scale-labels .scale-value {
	font-weight: 600;
	color: var(--text);
}

.star-rating-container {
	display: inline-grid;
	gap: 0.5rem;
	width: fit-content;
	max-width: 100%;
}

.star-rating-container .scale-labels {
	width: 100%;
}

.star-rating-input {
	display: inline-flex;
	align-items: center;
	gap: 0.18rem;
	flex-wrap: wrap;
}

.star-rating-btn {
	--star-fill: 0%;
	border: 0;
	background: transparent;
	box-shadow: none;
	padding: 0.12rem;
	min-width: 2.1rem;
	min-height: 2.1rem;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
	transition: transform 120ms ease;
	touch-action: none;
}

.star-rating-glyph {
	position: relative;
	display: inline-block;
	font-size: 2rem;
	line-height: 1;
	color: rgba(148, 163, 184, 0.48);
	user-select: none;
}

.star-rating-glyph::after {
	content: '★';
	position: absolute;
	inset: 0;
	width: var(--star-fill, 0%);
	overflow: hidden;
	color: #f59e0b;
	opacity: 1;
	transition: opacity 120ms ease;
}

.star-rating-btn.is-preview .star-rating-glyph::after {
	opacity: 0.56;
}

.star-rating-btn:hover,
.star-rating-btn:focus-visible {
	transform: scale(1.08);
}

.scale-labels .scale-value.is-preview {
	opacity: 0.72;
}

@media (hover: none), (pointer: coarse) {

	.survey-page .question-block {
		box-shadow: none;
	}

	.survey-page .option-item,
	.survey-page .image-choice-card,
	.survey-page .ranking-item,
	.survey-page .star-rating-btn,
	.survey-page input[type='checkbox'],
	.survey-page input[type='radio'] {
		transition-duration: 80ms;
	}

	.survey-page .option-item {
		min-height: 3rem;
		padding-top: 0.72rem;
		padding-bottom: 0.72rem;
	}

	.survey-page input[type='checkbox'],
	.survey-page input[type='radio'] {
		width: 1.2rem;
		height: 1.2rem;
	}

	.survey-page .option-item:hover,
	.survey-page .image-choice-card:hover,
	.survey-page .star-rating-btn:hover {
		transform: none;
	}
}

.survey-gate-overlay {
	position: fixed;
	inset: 0;
	background: rgba(5, 9, 18, 0.78);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: max(1rem, env(safe-area-inset-top, 0px)) 1rem max(1rem, env(safe-area-inset-bottom, 0px));
	z-index: 10;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

.survey-gate-fallback {
	display: flex;
	justify-content: center;
	margin: 1.5rem 0;
}

.survey-gate-dialog {
	background: var(--bg-elevated);
	border-radius: var(--radius-lg);
	padding: clamp(1.25rem, 3vw, 2.5rem);
	border: 1px solid var(--border);
	box-shadow: var(--shadow);
	max-width: 520px;
	width: 100%;
	max-height: calc(100dvh - 2rem);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.survey-gate-dialog h2 {
	flex-shrink: 0;
	margin-bottom: 0.75rem;
}

.survey-gate-dialog > p,
.survey-gate-dialog > div:not(.survey-gate-actions) {
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
	flex: 1 1 auto;
	min-height: 0;
}

.survey-gate-actions {
	display: flex;
	justify-content: flex-end;
	gap: 0.75rem;
	margin-top: 1.25rem;
	flex-shrink: 0;
}

.survey-gate-actions .primary {
	background: var(--accent);
	color: #fff;
}

.survey-gate-actions .secondary {
	background: transparent;
	border: 1px solid var(--border);
}

/* ============================================================
   Per-survey briefing inside the consent gate
   ============================================================ */
.survey-briefing {
	margin: 1rem 0 0;
	padding: 0.9rem 1rem;
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	background: var(--bg-muted, var(--bg-elevated));
	flex: 0 0 auto;
}

.survey-briefing.hidden,
.survey-briefing[hidden] {
	display: none !important;
}

.survey-briefing-title {
	margin: 0 0 0.55rem;
	font-size: 0.95rem;
	font-weight: 700;
	letter-spacing: -0.005em;
	color: var(--text);
}

/* Standalone description paragraph above the <dl>. Lets us show the
   "what is this study about?" preview prominently before the
   key-value rows. */
.survey-briefing-description {
	margin: 0 0 0.75rem;
	font-size: 0.92rem;
	line-height: 1.5;
	color: var(--text);
}
.survey-briefing-description.hidden,
.survey-briefing-description[hidden] {
	display: none !important;
}

.survey-briefing-row--requirements dt,
.survey-briefing-row--requirements dd {
	font-weight: 600;
	color: var(--text);
}

.survey-briefing-list {
	margin: 0;
	display: grid;
	gap: 0.55rem;
}

.survey-briefing-row {
	display: grid;
	grid-template-columns: minmax(7.5rem, 9rem) 1fr;
	gap: 0.75rem;
	align-items: start;
	font-size: 0.9rem;
	line-height: 1.5;
}

.survey-briefing-row.hidden,
.survey-briefing-row[hidden] {
	display: none !important;
}

.survey-briefing-row dt {
	margin: 0;
	font-weight: 600;
	color: var(--text-muted);
	letter-spacing: 0.01em;
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
}

.survey-briefing-row dd {
	margin: 0;
	color: var(--text);
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

.survey-briefing-row--warning dt,
.survey-briefing-row--warning dd {
	color: var(--warning, #b45309);
}

.survey-briefing-warning-icon {
	display: inline-flex;
	width: 1rem;
	height: 1rem;
	flex-shrink: 0;
}

.survey-briefing-warning-icon svg {
	width: 100%;
	height: 100%;
}

@media (max-width: 560px) {
	.survey-briefing {
		padding: 0.8rem 0.85rem;
	}
	.survey-briefing-row {
		grid-template-columns: 1fr;
		gap: 0.2rem;
	}
	.survey-briefing-row dt {
		font-size: 0.78rem;
		text-transform: uppercase;
		letter-spacing: 0.06em;
	}
}

.legal-content {
	background: radial-gradient(circle at top right, var(--accent-glow), transparent 60%), var(--bg-elevated);
	border-radius: var(--radius-lg);
	padding: clamp(1.5rem, 4vw, 3rem);
	border: 1px solid var(--border);
	box-shadow: var(--shadow);
}

.legal-page main,
.legal-page .legal-content {
	width: min(var(--page-max), 100%);
	max-width: 880px;
	margin: 0 auto;
}

.legal-page .legal-content {
	background: transparent;
	border-radius: 0;
	padding: clamp(0.75rem, 2vw, 1.5rem) var(--page-gutter) 3rem;
	border: none;
	box-shadow: none;
}

.legal-page .legal-header-title {
	min-width: 0;
	flex: 1 1 auto;
}

.legal-page .legal-header-title .page-title {
	font-size: clamp(1.25rem, 3vw, 2rem);
	line-height: 1.2;
}

@media (max-width: 720px) {
	.legal-page .legal-content {
		padding-left: 1.1rem;
		padding-right: 1.1rem;
	}
	.legal-page .legal-header-title .eyebrow {
		font-size: 0.65rem;
	}
	.legal-page .legal-header-title .page-title {
		font-size: 1.15rem;
	}

	/* #20: Auf dem Handy wandert der Theme-Switcher unter die Überschrift
	   statt rechts daneben — die Headline bekommt so die volle Breite. */
	.legal-page .site-header {
		display: grid;
		grid-template-columns: auto 1fr;
		grid-template-rows: auto auto;
		row-gap: 0.6rem;
		column-gap: 0.6rem;
		align-items: center;
	}
	.legal-page .site-header > .back-link {
		grid-row: 1;
		grid-column: 1;
	}
	.legal-page .site-header > .legal-header-title {
		grid-row: 1;
		grid-column: 2;
	}
	.legal-page .site-header > .header-actions {
		grid-row: 2;
		grid-column: 1 / -1;
		justify-self: start;
		padding-left: calc(2.5rem + 0.6rem); /* mit Titel oben bündig */
	}
}

.results-shell {
	background: transparent;
	border: none;
	box-shadow: none;
	padding: clamp(1.5rem, 4vw, 3rem) var(--page-gutter) 4rem;
}

.legal-section + .legal-section {
	margin-top: 1.75rem;
}

.legal-page .legal-section + .legal-section {
	margin-top: 2.5rem;
}

.legal-section h2 {
	margin-bottom: 0.5rem;
}

.results-page {
	background: var(--bg);
}

.results-page main.results-shell {
	width: min(var(--page-max), 100%);
}

.results-header {
	align-items: flex-start;
	flex-wrap: wrap;
	padding-bottom: 0.45rem;
}

.results-toolbar-panel {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: center;
	gap: 1rem;
	margin-bottom: 1.5rem;
	padding: 1.25rem;
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	background: var(--bg-elevated);
}

.results-toolbar-subtitle {
	margin: 0;
	font-size: 1.1rem;
	font-weight: 600;
}

.results-toolbar-meta {
	margin: 0.2rem 0 0;
	color: var(--text-muted);
}

.results-toolbar-actions {
	display: flex;
	gap: 0.75rem;
	flex-wrap: wrap;
	justify-content: flex-end;
}

.export-progress {
	grid-column: 1 / -1;
	display: grid;
	gap: 0.35rem;
}

.export-progress-track {
	position: relative;
	height: 0.48rem;
	border-radius: 999px;
	border: 1px solid var(--border);
	background: var(--bg-muted);
	overflow: hidden;
}

.export-progress-fill {
	height: 100%;
	width: 0;
	background: linear-gradient(90deg, #0ea5e9 0%, #22c55e 100%);
	border-radius: inherit;
	transform: translateX(0);
	transition: width 210ms cubic-bezier(0.22, 1, 0.36, 1);
}

.export-progress.is-indeterminate .export-progress-fill {
	width: 38% !important;
	animation: export-progress-indeterminate 1.1s linear infinite;
}

.export-progress.is-error .export-progress-fill {
	background: linear-gradient(90deg, #f97316 0%, #ef4444 100%);
}

.export-progress-text {
	margin: 0;
	font-size: 0.83rem;
	color: var(--text-muted);
}

.export-progress.is-error .export-progress-text {
	color: var(--error);
}

@keyframes export-progress-indeterminate {
	from {
		transform: translateX(-120%);
	}
	to {
		transform: translateX(280%);
	}
}

.results-kicker {
	margin: 0;
	text-transform: uppercase;
	letter-spacing: 0.15em;
	font-size: 0.8rem;
	color: var(--text-muted);
}

.results-shell {
	margin-top: 0;
	padding-top: 0.7rem;
}

.results-overview {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	margin-bottom: 1.5rem;
}

.results-stat-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 1rem;
}

.stat-card-skeleton,
.insight-card-skeleton,
.result-card-skeleton {
	position: relative;
	overflow: hidden;
	background: var(--bg-muted);
	border: 1px solid var(--border);
	box-shadow: none;
}

.stat-card-skeleton::after,
.insight-card-skeleton::after,
.result-card-skeleton::after {
	content: '';
	position: absolute;
	inset: 0;
	transform: translateX(-120%);
	background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
	animation: shimmer 1.6s ease-in-out infinite;
}

.stat-card-skeleton,
.insight-card-skeleton {
	gap: 0.6rem;
}

.stat-card-skeleton .skeleton-line,
.insight-card-skeleton .skeleton-line,
.result-card-skeleton .skeleton-line {
	height: 0.75rem;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.1);
}

.skeleton-line-short {
	width: 40%;
}

.skeleton-line-medium {
	width: 65%;
}

.skeleton-line-long {
	width: 85%;
}

.result-card-skeleton {
	min-height: 360px;
	gap: 0.85rem;
}

.result-card.result-card-skeleton::before {
	display: none;
}

.result-card-skeleton .skeleton-block {
	height: 140px;
	border-radius: var(--radius-sm);
	background: rgba(255, 255, 255, 0.08);
}

@keyframes shimmer {
	0% {
		transform: translateX(-120%);
	}
	100% {
		transform: translateX(120%);
	}
}

@media (prefers-reduced-motion: reduce) {
	.stat-card-skeleton::after,
	.insight-card-skeleton::after,
	.result-card-skeleton::after {
		animation: none;
	}
}

.insight-card {
	background: var(--bg-elevated);
	border-radius: var(--radius-md);
	border: 1px solid var(--border);
	padding: 0.85rem 0.95rem;
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
}

.insight-label {
	margin: 0;
	color: var(--text-muted);
	font-size: 0.85rem;
}

.insight-value {
	margin: 0;
	font-size: clamp(1.22rem, 1.55vw, 1.55rem);
	font-weight: 600;
	line-height: 1.15;
	overflow-wrap: anywhere;
}

.insight-subtext {
	margin: 0;
	color: var(--text-muted);
	font-size: 0.85rem;
}

.results-chart-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 1rem;
	align-items: start;
}

.results-chart-card {
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	background: var(--bg-elevated);
	padding: 1.25rem;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.results-chart-card .chart-empty,
.chart-empty {
	min-height: 140px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--text-muted);
}

.results-chart-card header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	flex-wrap: wrap;
}

.chart-title-group {
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
}

.results-chart-card h3 {
	margin: 0;
	font-size: 1rem;
}

.results-chart-card canvas {
	display: block;
	width: 100%;
	height: auto;
	cursor: pointer;
	touch-action: manipulation;
}


#trendChart {
	height: 240px !important;
	max-height: 300px !important;
	width: 100% !important;
}

#mixChart {
	width: 100% !important;
	height: auto !important;
}

.chart-hint {
	margin: 0;
	color: var(--text-muted);
	font-size: 0.8rem;
}

.chart-expand-btn {
	flex-shrink: 0;
	padding: 0.35rem 0.75rem;
	font-size: 0.82rem;
}

.trend-overlay {
	position: fixed;
	inset: 0;
	z-index: 270;
	display: none;
	align-items: center;
	justify-content: center;
	padding: calc(1.25rem + var(--safe-area-top)) calc(1.25rem + var(--safe-area-right)) calc(1.25rem + var(--safe-area-bottom)) calc(1.25rem + var(--safe-area-left));
}

.trend-overlay.is-open {
	display: flex;
}

.trend-overlay-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(2, 6, 23, 0.68);
}

.trend-overlay-dialog {
	position: relative;
	width: min(var(--page-max), 100%);
	max-height: calc(var(--viewport-height) - 2.5rem);
	background: var(--bg-elevated);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	box-shadow: var(--shadow);
	padding: 1.1rem;
	display: grid;
	grid-template-rows: auto 1fr;
	gap: 0.85rem;
}

.trend-overlay-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.8rem;
}

.trend-overlay-header h3 {
	margin: 0;
	font-size: 1.2rem;
}

.trend-overlay-chart {
	background: var(--bg-muted);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	padding: 0.75rem;
	min-height: min(70vh, 520px);
}

.trend-overlay-chart canvas {
	width: 100% !important;
	height: 100% !important;
}

.results-meta,
.results-grid {
	display: grid;
	gap: 1rem;
}

.results-meta {
	grid-template-columns: repeat(4, minmax(0, 1fr));
	margin-bottom: 1.1rem;
	gap: 0.7rem;
}

.results-view-switch {
	margin: 0 0 1.15rem;
	display: flex;
	justify-content: center;
}

.results-view-switch-row {
	--results-view-switch-pad: 0.36rem;
	position: relative;
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	align-items: stretch;
	gap: 0.25rem;
	padding: var(--results-view-switch-pad);
	width: min(560px, 100%);
	border-radius: 19px;
	border: 1px solid var(--border);
	background: var(--bg-elevated);
	box-shadow: var(--shadow);
}

.results-view-slider {
	position: absolute;
	top: var(--results-view-switch-pad);
	left: var(--results-view-switch-pad);
	height: calc(100% - (var(--results-view-switch-pad) * 2));
	width: 0;
	border-radius: 13px;
	pointer-events: none;
	background: var(--bg-contrast);
	border: 1px solid var(--border);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
	transition: transform 330ms cubic-bezier(0.22, 1, 0.36, 1), width 330ms cubic-bezier(0.22, 1, 0.36, 1);
}

.results-view-btn {
	position: relative;
	z-index: 1;
	border: 0;
	background: transparent;
	color: var(--text-muted);
	padding: 0 1rem;
	min-height: 3.1rem;
	min-width: 0;
	width: 100%;
	border-radius: 13px;
	font-size: 1rem;
	font-weight: 700;
	text-align: center;
	letter-spacing: 0.01em;
	cursor: pointer;
	box-shadow: none;
	transition: color 200ms ease;
}

.results-view-btn:hover {
	color: var(--text);
	transform: none;
	box-shadow: none;
}

.results-view-btn.is-active {
	color: var(--text);
	text-shadow: none;
}

.results-view-btn:active,
.results-view-btn:focus-visible {
	transform: none;
	box-shadow: none;
}

.results-controls {
	display: flex;
	flex-direction: column;
	gap: 0.7rem;
	margin-bottom: 1.5rem;
}

.results-controls-main {
	display: grid;
	grid-template-columns: minmax(280px, 1.35fr) minmax(180px, 0.72fr) minmax(160px, 0.5fr) auto;
	gap: 0.85rem;
	align-items: end;
}

.results-controls-meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.85rem;
	flex-wrap: wrap;
}

.control-field {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	min-width: 0;
}

.control-field input,
.control-field select {
	width: 100%;
}

.control-search input {
	min-width: 0;
}

.results-count {
	margin: 0;
	color: var(--text-muted);
	white-space: nowrap;
}

.results-pagination {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	justify-content: flex-end;
	margin-left: auto;
}

.results-page-label {
	min-width: 108px;
	text-align: center;
	font-size: 0.86rem;
	color: var(--text-muted);
}

.results-filter-reset-field {
	min-width: 190px;
}

.results-filter-reset-btn {
	white-space: nowrap;
}

.individual-results-controls {
	display: grid;
	grid-template-columns:
		minmax(160px, 220px)
		minmax(220px, 1fr)
		auto;
	grid-template-areas:
		'page_size filter pagination'
		'search search count';
	align-items: end;
}

.individual-results-pagination {
	grid-area: pagination;
	margin-left: 0;
	justify-content: flex-end;
	flex-wrap: nowrap;
	align-self: end;
}

.individual-page-size-field {
	grid-area: page_size;
	min-width: 150px;
	max-width: 180px;
	align-self: end;
}

.individual-page-size-field label {
	font-size: 0.74rem;
	color: var(--text-muted);
	white-space: nowrap;
}

.individual-page-size-field select {
	min-width: 0;
}

.individual-filter-menu-field {
	grid-area: filter;
	align-self: end;
	justify-self: center;
	width: min(220px, 100%);
}

.individual-search-field {
	grid-area: search;
	min-width: 0;
}

.individual-results-count {
	grid-area: count;
	justify-self: end;
	text-align: right;
	align-self: center;
}

.filter-dropdown {
	position: relative;
}

.filter-dropdown-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.45rem;
	width: 100%;
	min-width: 170px;
	font-family: inherit;
	padding: 0.68rem 0.82rem;
	border-radius: 12px;
	background: var(--bg-elevated);
	border: 1px solid var(--border);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.filter-dropdown-toggle:hover,
.filter-dropdown-toggle:active {
	transform: none;
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.filter-dropdown-toggle-label {
	font-weight: 600;
}

.filter-dropdown-toggle-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 1.45rem;
	padding: 0.05rem 0.38rem;
	border-radius: 999px;
	font-size: 0.74rem;
	font-weight: 700;
	color: var(--text);
	background: var(--bg-contrast);
	border: 1px solid var(--border);
}

.filter-dropdown-toggle-caret {
	color: var(--text-muted);
	transition: transform 220ms ease, color 220ms ease;
}

.filter-dropdown.is-open .filter-dropdown-toggle {
	border-color: var(--border-strong);
}

.filter-dropdown.is-open .filter-dropdown-toggle-caret {
	color: var(--text);
	transform: rotate(180deg);
}

.filter-dropdown-panel {
	position: absolute;
	top: calc(100% + 0.58rem);
	right: 0;
	z-index: 30;
	width: min(860px, calc(100vw - 2.8rem));
	font-family: inherit;
	padding: 0.95rem;
	border-radius: 16px;
	border: 1px solid var(--border);
	background: var(--bg-elevated);
	box-shadow: var(--shadow);
	opacity: 0;
	transform: translateY(-8px) scale(0.985);
	pointer-events: none;
	transition: opacity 190ms ease, transform 230ms cubic-bezier(0.22, 1, 0.36, 1);
}

.filter-dropdown.is-open .filter-dropdown-panel {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}

.filter-dropdown-header {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 0.75rem;
	margin-bottom: 0.8rem;
}

.filter-dropdown-title,
.filter-dropdown-summary {
	margin: 0;
}

.filter-dropdown-title {
	font-size: 0.9rem;
	font-weight: 700;
}

.filter-dropdown-summary {
	font-size: 0.82rem;
	color: var(--text-muted);
}

.filter-dropdown-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(180px, 1fr));
	gap: 0.72rem;
}

.filter-dropdown-grid .control-field {
	gap: 0.3rem;
}

.filter-dropdown-grid .control-field label {
	font-size: 0.79rem;
	color: var(--text-muted);
}

.filter-dropdown-actions {
	margin-top: 0.85rem;
	display: flex;
	justify-content: flex-end;
}

.individual-responses-table-wrap {
	display: grid;
	gap: 0.75rem;
}

.individual-responses-scroll {
	max-height: none;
	overflow-x: auto;
	overflow-y: visible;
	width: 100%;
}

.individual-result-table {
	min-width: 980px;
	table-layout: auto;
}

.individual-result-table thead th {
	position: sticky;
	top: 0;
	z-index: 1;
	background: var(--bg-elevated);
	white-space: normal;
	line-height: 1.35;
}

/* PERF: jede Zeile in der Einzelantworten-Tabelle bekommt
   `content-visibility: auto`. Bei 3000+ Antworten × N Spalten ist
   das der wichtigste Single-Win — Browser rendert nur die Zeilen
   im Viewport, alles drüber/drunter wird komplett übersprungen
   (Style + Layout + Paint). contain-intrinsic-size ist eine
   konservative Estimate (eine Zeile ≈ 48 px). */
.individual-result-table tbody tr {
	content-visibility: auto;
	contain-intrinsic-size: 1px 48px;
}

.individual-result-table .individual-question-col,
.individual-result-table .individual-answer-col {
	min-width: 240px;
}

.results-grid {
	grid-template-columns: 1fr;
	align-items: start;
	gap: 1.35rem;
}

.stat-card,
.result-card {
	background: var(--bg-elevated);
	border-radius: var(--radius-md);
	border: 1px solid var(--border);
	padding: 1rem;
	box-shadow: var(--shadow);
}

.stat-card {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	min-height: 0;
}

.stat-label {
	margin: 0;
	color: var(--text-muted);
	font-size: 0.85rem;
}

.stat-value {
	margin: 0;
	font-size: clamp(1.2rem, 2vw, 1.85rem);
	font-weight: 600;
	line-height: 1.2;
	word-break: break-word;
	overflow-wrap: anywhere;
}


.results-meta .stat-card {
	padding: 0.62rem 0.8rem;
	background: var(--bg-muted);
	border-color: var(--border);
	box-shadow: none;
}

.results-meta .stat-label {
	font-size: 0.72rem;
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

.results-meta .stat-card-count {
	flex-direction: row;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
}

.results-meta .stat-card-count .stat-value {
	font-size: clamp(1.02rem, 1.2vw, 1.22rem);
	line-height: 1;
	white-space: nowrap;
}

.results-meta .stat-card-date .stat-value {
	font-size: clamp(0.96rem, 1.05vw, 1.08rem);
	font-variant-numeric: tabular-nums;
	line-height: 1.25;
	white-space: nowrap;
}

.result-card {
	display: flex;
	flex-direction: column;
	gap: 0.85rem;
	contain: layout style paint;
	content-visibility: auto;
	contain-intrinsic-size: 760px;
	position: relative;
	overflow: hidden;
	border-color: var(--border-strong);
	background: var(--bg-elevated);
	box-shadow: 0 10px 24px rgba(2, 6, 23, 0.14);
	transition: box-shadow 200ms ease, transform 200ms ease, border-color 200ms ease;
}

.result-card::before {
	content: '';
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	width: 4px;
	background: linear-gradient(180deg, var(--accent) 0%, var(--accent-soft) 100%);
}

.result-card.is-highlight {
	border-color: var(--accent);
	box-shadow: 0 18px 36px rgba(79, 70, 229, 0.28);
	transform: translateY(-2px);
}

.result-card-header-info {
	display: grid;
	gap: 0.4rem;
	min-width: 0;
}

.loading-state {
	display: inline-flex;
	gap: 0.75rem;
	align-items: center;
	padding: 0.85rem 1rem;
	border-radius: var(--radius-md);
	border: 1px dashed var(--border);
	background: var(--bg-muted);
	color: var(--text-muted);
}

.loading-state p {
	margin: 0;
}

.results-loading-overlay {
	position: fixed;
	inset: 0;
	background: var(--bg);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 280;
}

.results-loading-overlay.hidden {
	display: none;
}

.results-loading-card {
	display: inline-flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.9rem 1.2rem;
	border-radius: var(--radius-md);
	border: 1px solid var(--border);
	background: var(--bg-elevated);
	color: var(--text-muted);
	font-weight: 600;
	box-shadow: var(--shadow);
}

.spinner {
	width: 1.25rem;
	height: 1.25rem;
	border-radius: 50%;
	border: 2px solid var(--accent-soft);
	border-top-color: #8b5cf6;
	animation: spin 0.9s linear infinite;
}

@keyframes spin {
	to {
		transform: rotate(360deg);
	}
}

.result-card-body {
	display: grid;
	grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
	gap: 1rem;
	align-items: start;
}

.question-meta-badges {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-top: 0.35rem;
}

.question-meta-badge {
	font-size: 0.8rem;
	padding: 0.15rem 0.65rem;
	border-radius: 999px;
	background: var(--bg-muted);
	border: 1px solid var(--border);
}

.question-meta-badge.badge-participation {
	background: var(--accent-soft);
	border-color: var(--accent-glow);
}

.result-summary {
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	background: var(--bg-muted);
	padding: 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

.summary-label {
	margin: 0;
	color: var(--text-muted);
	font-size: 0.85rem;
}

.summary-value {
	margin: 0;
	font-size: 1.3rem;
	font-weight: 600;
	line-height: 1.25;
	overflow-wrap: anywhere;
}

.summary-meta {
	margin: 0;
	color: var(--text-muted);
	font-size: 0.85rem;
}

.summary-top-list {
	margin: 0.35rem 0 0;
	padding-left: 1.1rem;
	display: grid;
	gap: 0.2rem;
}

.summary-top-list li {
	font-size: 0.8rem;
	color: var(--text);
}

.result-card-header {
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	align-items: flex-start;
	padding-bottom: 0.75rem;
	border-bottom: 1px solid var(--border);
}

.result-card-header h3 {
	margin: 0;
	font-size: 1.1rem;
	line-height: 1.3;
	overflow-wrap: anywhere;
}

.result-card-kicker {
	margin: 0;
	color: var(--text);
	text-transform: uppercase;
	letter-spacing: 0.1em;
	font-size: 0.68rem;
	font-weight: 700;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: fit-content;
	padding: 0.2rem 0.58rem;
	border-radius: 999px;
	border: 1px solid var(--border);
	background: var(--bg-muted);
}

.badge {
	padding: 0.35rem 0.75rem;
	border-radius: 999px;
	border: 1px solid var(--border);
}

.result-stats {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	gap: 1.5rem;
}

.result-stats li {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
	color: var(--text-muted);
}

.result-stats strong {
	color: var(--text);
	font-size: 1.1rem;
}

.result-layout {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	min-width: 0;
}

.result-question-media {
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: var(--bg-muted);
	padding: 0.75rem;
}

.result-question-media-label {
	margin: 0 0 0.55rem;
	color: var(--text-muted);
	font-size: 0.82rem;
}

.result-question-media-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 0.65rem;
}

.result-question-media-item {
	margin: 0;
	display: grid;
	gap: 0.35rem;
}

.result-question-media-name {
	font-size: 0.76rem;
	color: var(--text-muted);
	max-width: 104px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.responses-section {
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	overflow: hidden;
}

.responses-section:not(.is-open) .responses-scroll {
	display: none;
}

.responses-toggle {
	width: 100%;
	justify-content: center;
}

.responses-scroll {
	max-height: 240px;
	overflow: auto;
	border-top: 1px solid var(--border);
}

.result-table {
	width: 100%;
	border-collapse: collapse;
	table-layout: fixed;
}

.result-table th,
.result-table td {
	padding: 0.65rem 0.75rem;
	border-bottom: 1px solid var(--border);
	text-align: left;
	vertical-align: top;
	overflow-wrap: anywhere;
	word-break: break-word;
}

.response-media-cell {
	width: 86px;
}

.media-thumb-btn {
	width: 68px;
	height: 68px;
	border-radius: 10px;
	border: 1px solid var(--border);
	background: var(--bg-muted);
	padding: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	cursor: pointer;
	position: relative;
}

.media-thumb-btn.is-question-media {
	width: 104px;
	height: 72px;
}

.media-thumb-btn img,
.media-thumb-btn video {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.media-thumb-label {
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--text);
}

.media-thumb-play {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	width: 1.8rem;
	height: 1.8rem;
	border-radius: 999px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: rgba(2, 6, 23, 0.62);
	color: #fff;
	font-size: 0.85rem;
	line-height: 1;
}

.results-media-lightbox {
	position: fixed;
	inset: 0;
	background: rgba(2, 6, 23, 0.72);
	display: none;
	align-items: center;
	justify-content: center;
	padding: 1rem;
	z-index: 260;
}

.results-media-lightbox.is-open {
	display: flex;
}

.results-media-dialog {
	width: min(980px, 100%);
	max-height: 92vh;
	background: var(--bg-elevated);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	padding: 0.75rem;
	display: grid;
	gap: 0.6rem;
}

.results-media-header {
	display: flex;
	justify-content: flex-end;
}

.results-media-viewer {
	background: var(--bg-muted);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	min-height: 220px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0.5rem;
}

.results-media-viewer img,
.results-media-viewer video,
.results-media-viewer iframe {
	max-width: 100%;
	max-height: min(80vh, 760px);
	object-fit: contain;
}

.results-media-viewer iframe {
	width: min(100%, 960px);
	aspect-ratio: 16 / 9;
	border: 0;
}

.chart-duo {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: 1rem;
	align-items: stretch;
}

/* ----- Big-Stat-Tiles für 2-Optionen-Fragen (yes_no etc.) -----
   Visuell deutlich auffälliger als ein 2-Segment-Donut: zwei (oder
   drei) Prozent-Kacheln nebeneinander, mit Akzentstreifen links. */
.big-stat-tiles {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
	gap: 0.85rem;
}

.big-stat-tile {
	position: relative;
	background: var(--bg-elevated);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	padding: 1.05rem 1.2rem 1rem;
	box-shadow: var(--shadow);
	overflow: hidden;
}

.big-stat-tile::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	bottom: 0;
	width: 4px;
	background: var(--tile-accent, var(--accent));
}

.big-stat-tile-label {
	margin: 0;
	font-size: 0.78rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--text-muted);
	overflow-wrap: anywhere;
}

.big-stat-tile-value {
	margin: 0.45rem 0 0.15rem;
	font-size: clamp(1.85rem, 4.2vw, 2.6rem);
	font-weight: 800;
	line-height: 1;
	color: var(--tile-accent, var(--accent));
	font-variant-numeric: tabular-nums;
}

.big-stat-tile-unit {
	font-size: 0.6em;
	margin-left: 0.15rem;
	color: var(--text-muted);
	font-weight: 700;
}

.big-stat-tile-meta {
	margin: 0;
	font-size: 0.8rem;
	color: var(--text-muted);
}

/* ----- Numeric stat row (⌀ · Median · Min · Max · n) -----
   Steht über dem Histogramm und macht aus dem Zahlenfriedhof
   sofort lesbare Eckdaten. */
.numeric-stat-row {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
	gap: 0.5rem;
	background: var(--bg-muted);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	padding: 0.7rem 0.85rem;
	margin-bottom: 0.2rem;
}

.numeric-stat-cell {
	display: flex;
	flex-direction: column;
	gap: 0.18rem;
	align-items: flex-start;
}

.numeric-stat-label {
	font-size: 0.7rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--text-muted);
	font-weight: 700;
}

.numeric-stat-value {
	font-size: 1.15rem;
	font-weight: 700;
	color: var(--text);
	font-variant-numeric: tabular-nums;
	line-height: 1;
}

.chart-wrap {
	background: var(--bg-muted);
	border-radius: var(--radius-md);
	padding: 1rem;
	border: 1px solid var(--border);
}

.question-chart-wrap {
	display: grid;
	gap: 0.75rem;
	align-content: start;
}

.question-chart-controls {
	display: grid;
	grid-template-columns: auto minmax(140px, 1fr) auto;
	align-items: center;
	gap: 0.6rem;
}

.question-chart-label {
	font-size: 0.82rem;
	color: var(--text-muted);
}

.question-chart-select {
	min-width: 0;
}

.question-chart-load-btn {
	white-space: nowrap;
}

.chart-load-hint {
	margin: 0;
}

.question-chart-canvas {
	min-height: 260px;
}

.question-chart-canvas canvas {
	width: 100% !important;
	height: 100% !important;
}

.frequency-list {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.frequency-list-actions {
	display: flex;
	justify-content: flex-start;
}

.frequency-expand-btn {
	padding: 0.42rem 0.7rem;
	font-size: 0.82rem;
}

.segmented-frequency-panel {
	display: grid;
	gap: 0.85rem;
}

.segmented-frequency-title {
	margin: 0;
	font-size: 0.86rem;
	font-weight: 600;
	color: var(--text-muted);
}

.segmented-frequency-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: 0.75rem;
}

.segmented-frequency-card {
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: var(--bg-muted);
	padding: 0.75rem;
	display: grid;
	gap: 0.6rem;
}

.segmented-frequency-card h4 {
	margin: 0;
	font-size: 0.92rem;
}

.frequency-row {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 0.75rem;
}

.frequency-label {
	font-weight: 600;
}

.frequency-bar {
	background: var(--bg-muted);
	border-radius: 999px;
	position: relative;
	overflow: hidden;
	height: 6px;
}

.frequency-bar span {
	position: absolute;
	inset: 0;
	background: var(--accent);
}

.frequency-metrics {
	display: flex;
	gap: 0.5rem;
	align-items: center;
}

.frequency-count {
	font-size: 0.9rem;
	color: var(--text-muted);
}

.word-cloud {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.word-cloud span {
	background: var(--bg-muted);
	padding: 0.2rem 0.45rem;
	border-radius: var(--radius-sm);
}

.site-footer {
	width: min(var(--page-max), 100%);
	margin: 0 auto;
	padding: 2rem var(--page-gutter);
	border-top: 1px solid var(--border);
	text-align: center;
	color: var(--text-muted);
}

.error {
	color: var(--error);
}

.success {
	color: var(--success);
}

/* ============================================================
   Thank-you screen after survey submission
   ============================================================ */

#successMessage {
	display: block;
	padding: clamp(2rem, 6vw, 4rem) clamp(1rem, 4vw, 2rem);
}

#successMessage.hidden {
	display: none !important;
}

.thank-you-card {
	max-width: 480px;
	margin: 0 auto;
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 0.85rem;
	padding: clamp(1.75rem, 5vw, 2.75rem);
	border-radius: var(--radius-lg);
	background: var(--bg-elevated);
	border: 1px solid var(--border);
	box-shadow: var(--shadow);
	color: var(--success);
}

.thank-you-checkmark {
	width: 80px;
	height: 80px;
	color: var(--success);
}

.thank-you-checkmark svg {
	width: 100%;
	height: 100%;
	display: block;
}

.thank-you-circle {
	stroke-dasharray: 160;
	stroke-dashoffset: 160;
}

.thank-you-check {
	stroke-dasharray: 50;
	stroke-dashoffset: 50;
}

.thank-you-headline {
	font-size: clamp(1.25rem, 3vw, 1.6rem);
	font-weight: 700;
	letter-spacing: -0.02em;
	color: var(--success);
	margin: 0.35rem 0 0;
	opacity: 0;
}

.thank-you-subline {
	font-size: 0.95rem;
	color: var(--text-muted);
	margin: 0;
	opacity: 0;
}

/* Animations only run when JS adds .is-playing — so re-revealing the
   success message re-runs the animation cleanly. */
#successMessage.is-playing .thank-you-card {
	animation: thank-you-fade-in 480ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

#successMessage.is-playing .thank-you-checkmark {
	animation: thank-you-pop 600ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

#successMessage.is-playing .thank-you-circle {
	animation: thank-you-draw-circle 520ms ease-out 80ms forwards;
}

#successMessage.is-playing .thank-you-check {
	animation: thank-you-draw-check 320ms ease-out 520ms forwards;
}

#successMessage.is-playing .thank-you-headline {
	animation: thank-you-rise 420ms cubic-bezier(0.16, 1, 0.3, 1) 300ms forwards;
}

#successMessage.is-playing .thank-you-subline {
	animation: thank-you-rise 420ms cubic-bezier(0.16, 1, 0.3, 1) 420ms forwards;
}

@keyframes thank-you-fade-in {
	from { opacity: 0; transform: translateY(8px); }
	to   { opacity: 1; transform: translateY(0); }
}

@keyframes thank-you-pop {
	0%   { transform: scale(0.5); opacity: 0; }
	60%  { transform: scale(1.08); opacity: 1; }
	100% { transform: scale(1); opacity: 1; }
}

@keyframes thank-you-draw-circle {
	to { stroke-dashoffset: 0; }
}

@keyframes thank-you-draw-check {
	to { stroke-dashoffset: 0; }
}

@keyframes thank-you-rise {
	from { opacity: 0; transform: translateY(10px); }
	to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
	.thank-you-card,
	.thank-you-checkmark,
	.thank-you-circle,
	.thank-you-check,
	.thank-you-headline,
	.thank-you-subline {
		animation: none;
	}
	.thank-you-circle,
	.thank-you-check {
		stroke-dashoffset: 0;
	}
}

.muted {
	color: var(--text-muted);
}

.empty-state {
	padding: 1rem;
	text-align: center;
	border: 1px dashed var(--border);
	border-radius: var(--radius-md);
	color: var(--text-muted);
}

@media (max-width: 980px) {
	.results-page main.results-shell {
		width: min(1200px, 100%);
	}

	.results-toolbar-panel {
		grid-template-columns: 1fr;
	}

	.results-toolbar-actions {
		justify-content: flex-start;
	}

	.results-meta,
	.results-stat-grid,
	.results-chart-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.results-controls-main {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.results-controls-meta {
		flex-direction: column;
		align-items: flex-start;
	}

	.individual-results-controls {
		grid-template-columns: minmax(150px, 200px) minmax(180px, 1fr) auto;
		grid-template-areas:
			'page_size filter pagination'
			'search search count';
	}

	.filter-dropdown-panel {
		left: 0;
		right: auto;
		width: min(760px, calc(100vw - 3.6rem));
	}

	.filter-dropdown-grid {
		grid-template-columns: repeat(2, minmax(150px, 1fr));
	}

	.results-view-switch-row {
		width: 100%;
		max-width: 100%;
	}

	.results-view-btn {
		min-width: 0;
		width: 100%;
		padding-left: 0.9rem;
		padding-right: 0.9rem;
	}

	.results-pagination {
		margin-left: 0;
		justify-content: flex-start;
	}

	.results-grid {
		grid-template-columns: 1fr;
	}

	.result-card-body {
		grid-template-columns: minmax(0, 1fr);
	}

	.results-meta .stat-card-date .stat-value {
		white-space: normal;
	}

	.type-overlay-columns {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.survey-page .ranking-layout {
		display: flex;
		flex-direction: row;
		gap: 0.45rem;
	}

	.survey-page .ranking-scale-guide {
		display: flex;
		flex-direction: column;
		width: 20px;
		min-width: 20px;
		padding: 0.4rem 0.1rem;
		order: 2;
	}

	.survey-page .ranking-list {
		order: 1;
		flex: 1;
	}

	.survey-page .ranking-scale-top,
	.survey-page .ranking-scale-mid,
	.survey-page .ranking-scale-bottom {
		width: 100%;
		text-align: left;
	}

	.survey-page .ranking-scale-mid {
		font-size: 0.78rem;
	}

	.survey-page .matrix-row {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 720px) {
	.site-header,
	main,
	.site-footer {
		padding-left: 1.25rem;
		padding-right: 1.25rem;
	}

	.header-actions {
		width: 100%;
		justify-content: flex-start;
		flex-wrap: wrap;
	}

	/* Mobile header controls on key pages must stay in one row (no stacked theme/logout-back). */
	.login-page .site-header,
	.survey-page .site-header {
		flex-wrap: nowrap;
	}

	.login-page .header-actions,
	.survey-page .header-actions,
	.create-page .header-actions,
	.results-page .header-actions {
		width: auto;
		margin-left: auto;
		justify-content: flex-end;
		flex-wrap: nowrap;
		flex: 0 0 auto;
	}

	.login-page .site-header > .btn,
	.survey-page .site-header > .btn {
		flex: 1 1 auto;
		min-width: 0;
		max-width: calc(100% - 3.5rem);
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	.survey-page .survey-shell {
		padding: 1.1rem 1rem 2rem;
	}

	.survey-page #surveyTitle,
	.survey-page .page-title {
		font-size: clamp(1.25rem, 5vw, 1.75rem);
		line-height: 1.2;
		margin: 0.4rem 0 1rem;
		padding: 0 0.25rem;
	}

	.survey-page #surveyForm {
		gap: 1.1rem;
	}

	.survey-page .survey-meta {
		position: sticky;
		top: calc(0.75rem + var(--safe-area-top));
		z-index: 9;
		padding: 0.85rem 0.9rem;
		border: 1px solid var(--border);
		border-radius: var(--radius-md);
		background: color-mix(in srgb, var(--bg-elevated) 92%, transparent);
		backdrop-filter: blur(8px);
		display: grid;
		gap: 0.6rem;
	}

	.survey-page .progress-container {
		height: 0.55rem;
		margin: 0;
	}

	.survey-page .completion-status {
		font-size: 0.85rem;
		font-weight: 500;
		color: var(--text-muted);
	}

	.survey-page .question-block {
		padding: 1.2rem 1.1rem;
		border-radius: var(--radius-md);
	}

	.survey-page .survey-step-controls {
		grid-template-columns: auto 1fr auto;
		gap: 0.6rem;
		padding: 0.7rem;
		margin-top: 0.75rem;
		border-radius: var(--radius-md);
	}

	.survey-page .survey-step-controls .btn {
		width: auto;
		min-height: 2.9rem;
		padding: 0.7rem 1rem;
		font-size: 0.92rem;
	}

	.survey-page #surveyPrevBtn,
	.survey-page #surveyNextBtn {
		width: auto;
		min-width: 5.5rem;
	}

	.survey-page .survey-step-status {
		order: 0;
		font-size: 0.85rem;
		white-space: nowrap;
		text-align: center;
		color: var(--text-muted);
		font-weight: 500;
	}

	.survey-page #surveyForm > button[type='submit'] {
		width: 100%;
		min-height: 2.85rem;
	}

	/* #21: Aktionsleiste der Umfrage-Karte auf dem Handy aufräumen.
	   Vorher: Quick-Share-Buttons winzig (0,76 rem), Pause-Icon
	   2,45 rem, Dropdowns/Auswertung volle Breite — Höhen kollidieren,
	   Buttons wirken zufällig.
	   Jetzt: zwei saubere Zeilen — Quick-Share (Link + QR) volle
	   Breite, dann ein 2×2-Grid für Aktionen/Export/Auswertung/Pause
	   in einheitlicher Höhe (44 px). Die Stats fließen darunter. */
	.survey-item-actions {
		display: grid;
		grid-template-columns: 1fr 1fr;
		align-items: center;
		gap: 0.55rem;
	}

	.survey-item-actions .survey-quick-share {
		grid-column: 1 / -1;
		display: grid;
		grid-template-columns: 1fr 1fr;
		gap: 0.5rem;
		width: 100%;
	}

	.survey-item-actions .survey-quick-share .btn {
		width: 100%;
		padding: 0.55rem 0.6rem;
		font-size: 0.84rem;
		min-height: 44px;
	}

	.survey-item-actions .survey-actions-dropdown,
	.survey-item-actions .view-results-btn {
		width: 100%;
	}

	.survey-item-actions .survey-actions-dropdown {
		min-width: 0;
		max-width: none;
		flex: 1 1 auto;
	}

	.survey-item-actions .survey-actions-dropdown .actions-toggle,
	.survey-item-actions .view-results-btn {
		width: 100%;
		min-height: 44px;
		padding: 0.55rem 0.6rem;
		font-size: 0.86rem;
		white-space: nowrap;
	}

	.survey-item-actions .toggle-survey-status-icon {
		justify-self: stretch;
		width: 100%;
		min-height: 44px;
		height: 44px;
		border-radius: var(--radius-sm);
	}

	.survey-item-actions .survey-completions,
	.survey-item-actions .survey-abandons {
		grid-column: 1 / -1;
		justify-self: start;
		white-space: normal;
		font-size: 0.82rem;
	}

	.result-stats {
		flex-direction: column;
		gap: 0.75rem;
	}

	.survey-shell,
	.auth-shell,
	.create-shell,
	.legal-content,
	.results-shell {
		padding: 1.25rem;
	}

	.results-page main.results-shell {
		width: 100%;
		max-width: none;
	}

	.results-meta,
	.results-stat-grid,
	.results-chart-grid {
		grid-template-columns: 1fr;
	}

	.results-controls-main {
		grid-template-columns: 1fr;
	}

	.results-toolbar-actions {
		flex-direction: column;
		align-items: stretch;
	}

	.results-toolbar-actions .btn {
		width: 100%;
	}

	.results-controls-meta {
		flex-direction: column;
		align-items: stretch;
	}

	.individual-results-controls {
		grid-template-columns: 1fr;
		grid-template-areas:
			'page_size'
			'filter'
			'pagination'
			'search'
			'count';
	}

	.individual-results-pagination {
		width: 100%;
		justify-content: stretch;
		margin-left: 0;
		flex-wrap: wrap;
	}

	.individual-page-size-field {
		min-width: 0;
		max-width: none;
		width: 100%;
	}

	.individual-filter-menu-field {
		width: 100%;
		justify-self: stretch;
	}

	.individual-search-field {
		width: 100%;
	}

	.individual-results-count {
		justify-self: start;
		text-align: left;
	}

	.results-view-switch-row {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.results-pagination {
		width: 100%;
		justify-content: stretch;
		margin-left: 0;
	}

	.results-pagination .btn {
		flex: 1 1 0;
	}

	.results-page-label {
		flex: 1 1 0;
	}

	.question-chart-controls {
		grid-template-columns: 1fr;
	}

	.question-chart-load-btn {
		width: 100%;
	}

	.results-chart-card {
		padding: 0.95rem;
	}

	.results-chart-card header {
		flex-direction: column;
		align-items: flex-start;
	}

	.chart-expand-btn {
		width: 100%;
	}

	#trendChart {
		height: 220px !important;
		max-height: 260px !important;
	}

	#mixChart {
		width: 100% !important;
	}

	.individual-filter-menu-field {
		width: 100%;
	}

	.filter-dropdown-toggle {
		min-width: 0;
	}

	.filter-dropdown-panel {
		left: 0;
		right: auto;
		width: min(100%, calc(100vw - 2.8rem));
	}

	.filter-dropdown-grid {
		grid-template-columns: 1fr;
	}

	.filter-dropdown-actions .btn {
		width: 100%;
	}

	.result-card-header {
		flex-wrap: wrap;
	}

	.admin-overview {
		grid-template-columns: 1fr;
	}

	.admin-grid {
		grid-template-columns: 1fr;
	}

	.admin-list-controls {
		width: 100%;
	}

	.admin-list-controls input,
	.admin-list-controls select {
		min-width: 0;
		width: 100%;
	}

	.admin-list-panel #surveysList {
		max-height: none;
		overflow: visible;
		padding-right: 0;
	}

	.builder-workspace {
		grid-template-columns: 1fr;
	}

	.survey-actions-dropdown {
		flex: 1 1 100%;
		max-width: none;
		min-width: 0;
	}

	.survey-actions-dropdown .actions-menu {
		left: 0;
		right: auto;
		min-width: 100%;
	}

	.question-card {
		padding: 1rem;
	}

	.question-card-header {
		flex-wrap: wrap;
	}

	.question-layout-grid {
		grid-template-columns: 1fr;
	}

	.question-options-image-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.ranking-layout {
		display: flex;
		flex-direction: row;
		gap: 0.45rem;
	}

	.ranking-scale-guide {
		display: flex;
		flex-direction: column;
		width: 20px;
		min-width: 20px;
		padding: 0.4rem 0.1rem;
		order: 2;
	}

	.ranking-list {
		order: 1;
		flex: 1;
	}

	.ranking-scale-top,
	.ranking-scale-mid,
	.ranking-scale-bottom {
		width: 100%;
		text-align: left;
	}

	.ranking-scale-mid {
		font-size: 0.78rem;
	}

	.star-rating-input {
		gap: 0.08rem;
	}

	.star-rating-btn {
		min-width: 2.35rem;
		min-height: 2.35rem;
		padding: 0.06rem;
	}

	.star-rating-glyph {
		font-size: 2.2rem;
	}

	.builder-toolbar {
		flex-direction: column;
		align-items: flex-start;
	}

	.type-overlay-dialog {
		width: 100%;
		max-height: calc(var(--viewport-height) - 1.2rem);
		padding: 1rem;
	}

	.type-overlay-columns {
		grid-template-columns: 1fr;
		gap: 0.75rem;
	}

	.media-compact-row {
		flex-wrap: wrap;
		align-items: flex-start;
	}

	.media-grid {
		grid-template-columns: 1fr;
	}

	.media-preview img,
	.media-preview video,
	.media-preview iframe {
		max-height: 38vh;
	}

	.question-media img,
	.question-media video,
	.question-media iframe {
		max-height: 42vh;
	}
}


@media (max-width: 480px) {
	.btn,
	form button[type='submit'],
	.login_btn {
		width: 100%;
	}

	.site-header .btn,
	.site-header .login_btn {
		width: auto;
	}

	.results-toolbar-actions .btn {
		width: 100%;
	}

	.admin-list-header,
	.admin-builder-header {
		flex-wrap: nowrap;
		align-items: center;
		gap: 0.6rem;
	}

	.admin-section-title {
		flex: 1 1 auto;
		min-width: 0;
	}

	.admin-list-header .btn,
	.admin-builder-header .btn {
		width: auto;
		white-space: nowrap;
	}

	.survey-gate-dialog {
		max-width: 100%;
		padding: 1.1rem;
		/* #18: Auf dem Handy bekommt die "Über diese Umfrage"-Box sonst fast
		   den gesamten vertikalen Platz und drückt den Datenschutz-Text in
		   ein winziges Scroll-Fenster. Wir entlassen den Dialog hier aus
		   seinem internen Flex-Scroll-Korsett und lassen den umliegenden
		   Overlay (.survey-gate-overlay) die ganze Karte scrollen — Titel,
		   Text, Briefing und Buttons fließen einfach untereinander, der
		   Datenschutz-Text bekommt seine volle Höhe zurück. */
		overflow: visible;
		max-height: none;
	}

	.survey-gate-dialog > p,
	.survey-gate-dialog > div:not(.survey-gate-actions) {
		overflow: visible;
		flex: 0 0 auto;
		min-height: 0;
	}

	.survey-gate-actions {
		flex-direction: column-reverse;
	}

	.survey-gate-actions .primary,
	.survey-gate-actions .secondary {
		width: 100%;
	}

	.option-item {
		padding: 0.6rem 0.75rem;
	}

	.question-options-image-grid {
		grid-template-columns: 1fr;
	}

	.ranking-item {
		grid-template-columns: auto minmax(0, 1fr);
		gap: 0.45rem 0.55rem;
		padding: 0.6rem;
	}

	.ranking-item-rank {
		grid-column: 2;
		justify-self: end;
		min-width: 1.75rem;
		height: 1.75rem;
	}

	.ranking-handle {
		width: 1.85rem;
		min-width: 1.85rem;
		height: 1.85rem;
	}

	.ranking-scale-guide {
		padding: 0.55rem;
		font-size: 0.78rem;
	}

	.survey-item-actions-primary .toggle-survey-status-icon {
		width: 2.45rem;
		min-width: 2.45rem;
		justify-self: end;
	}

	.question-card-actions {
		width: 100%;
		justify-content: space-between;
	}

	.builder-toolbar-main {
		width: 100%;
	}

	.builder-toolbar-main .btn {
		width: 100%;
	}

	.type-overlay-header h3 {
		font-size: 1.2rem;
	}

	.type-overlay-close {
		width: 2.35rem;
		min-width: 2.35rem;
	}

	.media-preview img,
	.media-preview video,
	.media-preview iframe {
		max-height: 34vh;
	}

	.question-media img,
	.question-media video,
	.question-media iframe {
		max-height: 36vh;
	}
}

.survey-meta {
	display: grid;
	gap: 0.75rem;
	margin-bottom: 1rem;
}

.survey-step-controls {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
	align-items: center;
	gap: 0.75rem;
	margin: 0.25rem 0 1rem;
	padding: 0.75rem;
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	background: var(--bg-elevated);
	box-shadow: var(--shadow);
}

.survey-step-controls #surveyPrevBtn {
	justify-self: start;
	width: min(100%, 12rem);
}

.survey-step-controls #surveyNextBtn {
	justify-self: end;
	width: min(100%, 12rem);
}

.survey-step-controls .btn {
	min-height: 2.9rem;
}

.survey-step-status {
	margin: 0;
	text-align: center;
	font-size: 0.95rem;
	font-weight: 700;
	color: var(--text);
	white-space: nowrap;
}

.survey-submit-btn {
	width: 100%;
}

.autosave-status {
	font-size: 0.9rem;
	color: var(--text-muted);
}

.completion-status {
	font-size: 0.88rem;
	color: var(--text);
	font-weight: 600;
}

.question-media {
	margin: 0.5rem 0 0.9rem;
}

.question-media img,
.question-media video,
.question-media iframe {
	width: 100%;
	max-height: min(55vh, 460px);
	object-fit: contain;
	border-radius: var(--radius-sm);
	border: 1px solid var(--border);
	background: var(--bg-muted);
}

.question-media img {
	aspect-ratio: 16 / 9;
}

.question-media iframe {
	aspect-ratio: 16 / 9;
	max-height: none;
}


.attention-check-hint {
  margin-top: 0.35rem;
  color: #6b7280;
  font-size: 0.92rem;
}

/* ============================================================
   "Studie abschließen" modal
   ============================================================
   Standalone overlay (created on-demand in admin.js) — sits above all
   page content with a darkened backdrop. Mobile-first; on phones it
   takes ~95% of the viewport so all fields are reachable. */
.conclude-study-overlay {
	position: fixed;
	inset: 0;
	z-index: 480;
	display: grid;
	place-items: center;
	padding: calc(1rem + var(--safe-area-top)) calc(1rem + var(--safe-area-right)) calc(1rem + var(--safe-area-bottom)) calc(1rem + var(--safe-area-left));
	opacity: 0;
	transition: opacity 180ms ease;
}

.conclude-study-overlay.is-visible {
	opacity: 1;
}

.conclude-study-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(5, 9, 18, 0.65);
	backdrop-filter: blur(3px);
}

.conclude-study-dialog {
	position: relative;
	width: min(640px, 100%);
	max-height: calc(var(--viewport-height, 100vh) - 2rem);
	display: grid;
	grid-template-rows: auto 1fr auto;
	background: var(--bg-elevated);
	border: 1px solid var(--border);
	border-radius: 20px;
	box-shadow: 0 32px 72px rgba(2, 6, 23, 0.55);
	overflow: hidden;
}

.conclude-study-header {
	padding: 1.1rem 1.25rem 0.9rem;
	border-bottom: 1px solid var(--border);
}

.conclude-study-header h3 {
	margin: 0;
	font-size: 1.15rem;
	font-weight: 700;
}

.conclude-study-subtitle {
	margin: 0.2rem 0 0;
	color: var(--text-muted);
	font-size: 0.88rem;
}

.conclude-study-body {
	overflow: auto;
	padding: 1rem 1.25rem;
	display: grid;
	gap: 1rem;
}

.conclude-study-info {
	display: flex;
	gap: 0.6rem;
	padding: 0.75rem 0.9rem;
	border-radius: var(--radius-md);
	background: color-mix(in srgb, var(--accent-glow) 35%, var(--bg-elevated));
	border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border));
	color: var(--text);
	font-size: 0.88rem;
	line-height: 1.5;
	align-items: flex-start;
}

.conclude-study-info svg {
	flex-shrink: 0;
	color: var(--accent);
	margin-top: 0.1rem;
}

.conclude-study-info p { margin: 0; }

.conclude-study-field {
	display: grid;
	gap: 0.35rem;
}

.conclude-study-field label {
	font-weight: 600;
	font-size: 0.92rem;
	color: var(--text);
}

.conclude-study-field textarea {
	width: 100%;
	font: inherit;
	resize: vertical;
	min-height: 6rem;
}

.conclude-study-field textarea.is-error {
	border-color: var(--error, #be123c);
	outline: 2px solid color-mix(in srgb, var(--error, #be123c) 25%, transparent);
}

.conclude-study-hint {
	margin: 0;
	font-size: 0.8rem;
	color: var(--text-muted);
}

.conclude-links-container {
	display: grid;
	gap: 0.5rem;
}

.conclude-link-row {
	display: grid;
	grid-template-columns: 1fr 1fr auto;
	gap: 0.45rem;
	align-items: center;
}

.conclude-link-row input {
	font: inherit;
	width: 100%;
}

.conclude-link-remove {
	width: 2rem;
	height: 2rem;
	border-radius: 999px;
	border: 1px solid var(--border);
	background: var(--bg-muted);
	color: var(--text-muted);
	cursor: pointer;
	font-size: 1.05rem;
	line-height: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	flex-shrink: 0;
}

.conclude-link-remove:hover {
	color: var(--error, #be123c);
	border-color: var(--error, #be123c);
}

.conclude-add-link-btn {
	margin-top: 0.25rem;
	align-self: flex-start;
	font-size: 0.88rem;
}

.conclude-study-footer {
	padding: 0.85rem 1.25rem;
	border-top: 1px solid var(--border);
	display: flex;
	justify-content: flex-end;
	gap: 0.55rem;
	flex-wrap: wrap;
	background: var(--bg);
}

/* Endgültigkeits-Warnung (nur im Abschluss-Modus, nicht im Edit-Modus). */
.conclude-study-warning {
	margin-top: 0.85rem;
	display: flex;
	gap: 0.65rem;
	padding: 0.85rem 0.95rem;
	border-radius: 12px;
	border: 1px solid color-mix(in srgb, var(--error) 55%, var(--border));
	background: color-mix(in srgb, var(--error) 9%, var(--bg-elevated));
	color: var(--text);
}

.conclude-study-warning > svg {
	flex-shrink: 0;
	color: var(--error);
	margin-top: 0.1rem;
}

.conclude-study-warning-title {
	margin: 0 0 0.25rem;
	font-weight: 700;
	color: var(--error);
	font-size: 0.92rem;
}

.conclude-study-warning-body {
	margin: 0;
	font-size: 0.86rem;
	line-height: 1.45;
	color: var(--text);
}

.conclude-study-confirm-check {
	display: flex;
	align-items: flex-start;
	gap: 0.55rem;
	margin-top: 0.7rem;
	padding: 0.6rem 0.75rem;
	border: 1px solid var(--border);
	border-radius: 10px;
	background: var(--bg-muted);
	font-size: 0.86rem;
	line-height: 1.4;
	cursor: pointer;
	user-select: none;
}

.conclude-study-confirm-check input[type="checkbox"] {
	margin-top: 0.18rem;
	width: auto;
	min-width: 1.1rem;
	height: 1.1rem;
	accent-color: var(--accent);
	flex-shrink: 0;
}

@media (max-width: 560px) {
	.conclude-link-row {
		grid-template-columns: 1fr auto;
		grid-template-areas:
			"url remove"
			"label remove";
		gap: 0.3rem;
	}
	.conclude-link-row input[type="url"] { grid-area: url; }
	.conclude-link-row input[type="text"] { grid-area: label; }
	.conclude-link-remove {
		grid-area: remove;
		align-self: start;
	}
	.conclude-study-header { padding: 0.95rem 1rem 0.75rem; }
	.conclude-study-body   { padding: 0.85rem 1rem; }
	.conclude-study-footer { padding: 0.75rem 1rem; }
}

/* ===== Studio 2026 Refresh ===== */
.create-page {
	background:
		radial-gradient(circle at 0% -10%, color-mix(in srgb, var(--accent) 18%, transparent) 0, transparent 45%),
		radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--accent-strong) 16%, transparent) 0, transparent 40%),
		linear-gradient(180deg, var(--bg) 0%, color-mix(in srgb, var(--bg-muted) 55%, var(--bg)) 100%);
}

.create-page .admin-shell {
	display: grid;
	gap: 1rem;
}

.create-page .admin-grid {
	grid-template-columns: minmax(320px, 0.92fr) minmax(680px, 1.6fr);
	align-items: start;
}

.create-page .admin-panel {
	backdrop-filter: blur(8px);
	border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
}

.create-page .admin-builder-panel {
	background:
		linear-gradient(160deg, color-mix(in srgb, var(--bg-elevated) 90%, var(--accent-soft)) 0%, var(--bg-elevated) 65%);
}

/* #23: Builder-Outline + Live-Mobile-Preview wurden ins Studio
   verlagert (siehe studio.css/studio.js). Die ehemaligen Regeln
   für .builder-validation-summary / .builder-outline-* /
   .builder-mobile-preview / .mobile-preview-* / .builder-workspace
   sind hier komplett ersatzlos entfernt. */

.type-overlay-content .template-library-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
	gap: 0.7rem;
}

.template-card {
	border: 1px solid var(--border);
	border-radius: 14px;
	background: var(--bg-muted);
	padding: 0.85rem;
	display: grid;
	gap: 0.45rem;
	text-align: left;
	box-shadow: var(--shadow);
}

.template-card:hover {
	border-color: var(--accent);
	box-shadow: 0 10px 24px color-mix(in srgb, var(--accent-glow) 40%, transparent);
}

.template-card h4 {
	margin: 0;
	font-size: 0.95rem;
}

.template-card p {
	margin: 0;
	font-size: 0.81rem;
	color: var(--text-muted);
}

.template-card .template-meta {
	font-size: 0.75rem;
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

.type-option-mini-preview {
	display: grid;
	gap: 0.2rem;
	margin: 0.32rem 0;
	padding: 0.45rem 0.5rem;
	border-radius: 10px;
	border: 1px dashed color-mix(in srgb, var(--border-strong) 85%, transparent);
	font-size: 0.75rem;
	color: var(--text-muted);
}

.question-card {
	transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.question-card.is-drag-over {
	border-color: var(--accent);
	box-shadow: 0 16px 28px color-mix(in srgb, var(--accent-glow) 40%, transparent);
}

.question-card .drag-handle {
	cursor: grab;
	user-select: none;
	font-size: 1.05rem;
	line-height: 1;
	padding: 0.35rem 0.48rem;
}

.question-card .drag-handle:active {
	cursor: grabbing;
}

.question-card .save-template-btn {
	font-size: 0.74rem;
	padding: 0.25rem 0.5rem;
}

.question-card-validation {
	margin: 0.55rem 0 0;
	padding: 0.55rem 0.65rem;
	border-radius: 9px;
	font-size: 0.78rem;
	background: color-mix(in srgb, var(--warning) 12%, var(--bg-muted));
	border: 1px solid color-mix(in srgb, var(--warning) 45%, var(--border));
	color: var(--text);
}

.survey-item {
	gap: 0.55rem;
}

.survey-item-header {
	gap: 0.65rem;
}

.survey-item-inline-edit {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	flex-wrap: wrap;
}

.survey-item-inline-edit input {
	min-width: 230px;
}

/* #21: Den Stift-Button am Titel kompakter und als kleines Icon
   stylen — sonst zieht ihn die globale 44 px-Touch-Target-Regel auf
   eine breite Box, die wie ein "echter" Button neben der Überschrift
   wirkt. Save/Cancel bekommen ihre Mindestbreite zurück, wenn die
   Inline-Edit-Box aktiv ist. */
.survey-item-inline-edit .survey-title-edit-btn {
	width: 2.25rem;
	min-width: 2.25rem;
	height: 2.25rem;
	padding: 0;
	border-radius: 999px;
	font-size: 0.95rem;
	line-height: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: var(--text-muted);
	flex: 0 0 auto;
}

.survey-item-inline-edit .survey-title-edit-btn:hover {
	color: var(--text);
	background: var(--bg-muted);
}

.survey-item-inline-edit .survey-title-save-btn,
.survey-item-inline-edit .survey-title-cancel-btn {
	flex: 0 0 auto;
	padding: 0.4rem 0.75rem;
	font-size: 0.85rem;
}

.survey-quick-share {
	display: inline-flex;
	gap: 0.35rem;
	flex-wrap: wrap;
}

.survey-quick-share .btn {
	padding: 0.42rem 0.62rem;
	font-size: 0.76rem;
}

.survey-status-toggle-inline {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	font-size: 0.76rem;
	color: var(--text-muted);
}

/* #23: Builder-Tour-Tooltip ist mit dem Studio-Redesign weggefallen
   (Onboarding-Tour lebt nicht mehr) — Regeln entfernt. */

@media (max-width: 1160px) {
	.create-page .admin-grid {
		grid-template-columns: minmax(0, 1fr);
	}
}

@media (max-width: 840px) {
	.survey-item-inline-edit input {
		min-width: 150px;
		width: 100%;
	}
	.survey-item-inline-edit {
		width: 100%;
	}
	.survey-item-actions-primary {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 560px) {
	.survey-quick-share {
		width: 100%;
	}
}

.draft-recovery-overlay .type-overlay-dialog {
	max-width: 560px;
}

.draft-recovery-overlay .app-modal-actions {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 0.5rem;
}

@media (max-width: 640px) {
	.draft-recovery-overlay .app-modal-actions {
		grid-template-columns: 1fr;
	}
}

/* ============================================================
   Studio Builder Redesign
   ============================================================
   Sticky header always shows title + autosave + primary CTA.
   Tabs split content (questions) from study info so the editor
   stays focused. Outline + editor are the only thing visible in
   the Inhalt tab — no nested accordions, no buried metadata.
*/

.studio-form {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

/* --- Sticky header --- */
.studio-header {
	position: sticky;
	top: 0;
	z-index: 60;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 0.85rem 1rem;
	border: 1px solid var(--border);
	border-radius: 12px;
	background: var(--bg-elevated);
	box-shadow: 0 4px 12px -6px rgba(0, 0, 0, 0.25);
	flex-wrap: wrap;
}

.studio-header-title {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
	min-width: 0;
	flex: 1 1 250px;
}

.studio-header-eyebrow {
	margin: 0;
	font-size: 0.7rem;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--text-muted);
	font-weight: 600;
}

.studio-header-actions {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	flex-wrap: wrap;
}

/* Autosave pill — pulsing dot for "saving", solid green for "saved". */
.studio-autosave {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	margin: 0;
	padding: 0.3rem 0.65rem;
	border-radius: 999px;
	background: var(--bg-muted);
	border: 1px solid var(--border);
	color: var(--text-muted);
	font-size: 0.78rem;
	font-weight: 500;
	font-variant-numeric: tabular-nums;
}

.studio-autosave-dot {
	width: 0.5rem;
	height: 0.5rem;
	border-radius: 999px;
	background: var(--success, #15803d);
	flex-shrink: 0;
}

.studio-autosave[data-status="saving"] .studio-autosave-dot {
	background: var(--warning, #b45309);
	animation: studio-autosave-pulse 900ms ease-in-out infinite;
}
.studio-autosave[data-status="dirty"] .studio-autosave-dot {
	background: var(--warning, #b45309);
}
.studio-autosave[data-status="error"] .studio-autosave-dot {
	background: var(--error, #be123c);
}

@keyframes studio-autosave-pulse {
	0%, 100% { opacity: 0.4; }
	50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
	.studio-autosave-dot { animation: none; }
}

.studio-publish-btn {
	white-space: nowrap;
}

/* --- Tabs --- */
.studio-tabs {
	display: flex;
	gap: 0.15rem;
	padding: 0.3rem;
	border-radius: 12px;
	background: var(--bg-muted);
	border: 1px solid var(--border);
	width: fit-content;
}

.studio-tab {
	appearance: none;
	background: transparent;
	border: 1px solid transparent;
	border-radius: 8px;
	padding: 0.45rem 0.95rem;
	font: inherit;
	font-weight: 600;
	font-size: 0.9rem;
	color: var(--text-muted);
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	/* No animations — instant state swap. */
}

.studio-tab:hover {
	color: var(--text);
}

.studio-tab.is-active {
	background: var(--bg-elevated);
	color: var(--text);
	border-color: var(--border);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.studio-tab-panel.hidden { display: none; }

/* --- Inline add-bar (Notion-style at end of question list) --- */
.studio-add-bar {
	display: flex;
	gap: 0.4rem;
	align-items: center;
	margin-top: 0.65rem;
	padding: 0.75rem;
	border: 1px dashed var(--border);
	border-radius: 12px;
	background: var(--bg-muted);
	flex-wrap: wrap;
}

.studio-add-bar .add-question-button {
	flex-shrink: 0;
}

.studio-add-bar-secondary {
	display: flex;
	gap: 0.25rem;
	margin-left: auto;
	align-items: center;
	flex-wrap: wrap;
}

@media (max-width: 600px) {
	.studio-header {
		padding: 0.75rem 0.85rem;
	}
	.studio-publish-btn { width: 100%; }
	.studio-add-bar-secondary { margin-left: 0; }
}

/* ============================================================
   Test-Umfrage Creator (Dashboard)
   ============================================================ */
.test-creator-dialog {
    width: min(540px, 100%);
}
.test-creator-content {
    padding: 1rem 1.1rem 1.1rem;
}
.test-creator-form {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}
.test-creator-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.test-creator-field > label {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.test-creator-chips {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}
.test-creator-chip {
    appearance: none;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.42rem 0.85rem;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    /* No transitions — instant feedback, mirrors the rest of the
       redesigned tooling. */
}
.test-creator-chip:hover {
    background: var(--bg-muted);
}
.test-creator-chip.is-active {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent-strong, var(--accent));
}
.test-creator-help {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.45;
}
.test-creator-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.2rem;
    padding-top: 0.8rem;
    border-top: 1px solid var(--border);
}

/* Progress step */
.test-creator-progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.65rem;
    padding: 1.4rem 0.5rem 0.4rem;
}
.test-creator-progress.hidden { display: none; }
.test-creator-progress-spinner {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: 3px solid color-mix(in srgb, var(--accent) 25%, var(--border));
    border-top-color: var(--accent);
    animation: test-creator-spin 720ms linear infinite;
}
@keyframes test-creator-spin {
    to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
    .test-creator-progress-spinner { animation-duration: 2400ms; }
}
.test-creator-progress-label {
    margin: 0;
    font-weight: 600;
    color: var(--text);
    font-size: 0.96rem;
}
.test-creator-progress-track {
    width: 100%;
    height: 6px;
    background: var(--bg-muted);
    border-radius: 999px;
    overflow: hidden;
    margin: 0.2rem 0;
}
.test-creator-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-strong, var(--accent)));
    width: 0%;
    border-radius: inherit;
}
.test-creator-progress-detail {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.84rem;
    text-align: center;
    line-height: 1.4;
}

/* ============================================================
   Dashboard header — mobile responsive
   ============================================================
   The header has 4 action items in .header-actions on dashboard.html
   (+ Neue Umfrage, Test-Umfrage, theme toggle, Abmelden). On narrow
   phones they overflow horizontally — collapse to icon-only / shrink
   below a hard breakpoint. */

@media (max-width: 720px) {
    /* #22: Dashboard-Header auf dem Handy.
       Wir bauen den Header als Grid:
         Zeile 1 — Brand links, Theme-Toggle rechts
         Zeile 2 — "+ Neue Umfrage" (primärer CTA) volle Breite
         Zeile 3 — Test-Umfrage | Abmelden (je 50 %)
       Vorher: alle vier Buttons quetschten sich in eine einzige
       wrap-Zeile und wurden auf engen Phones unleserlich klein. */
    .create-header,
    .dashboard-page .create-header {
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 0.55rem 0.55rem;
        padding: var(--page-gutter-compact, 0.85rem);
        align-items: center;
    }
    .create-header-brand {
        grid-column: 1;
        grid-row: 1;
        min-width: 0;
    }
    .dashboard-page .create-header .header-actions {
        grid-column: 1 / -1;
        grid-row: 2;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
        justify-content: stretch;
    }
    .dashboard-page .create-header .header-actions .theme-toggle {
        /* Theme-Toggle wandert in Zeile 1 rechts neben den Brand-Block. */
        grid-column: 2;
        grid-row: 1;
        position: absolute;
        right: var(--page-gutter-compact, 0.85rem);
        top: var(--page-gutter-compact, 0.85rem);
    }
    .dashboard-page .create-header {
        position: relative;
    }
    .dashboard-page .create-header .header-actions > a.btn,
    .dashboard-page .create-header .header-actions > button.btn {
        width: 100%;
        padding: 0.55rem 0.65rem;
        font-size: 0.86rem;
        white-space: nowrap;
    }
    /* "+ Neue Umfrage" bekommt die volle Breite, weil's der primäre CTA ist. */
    .dashboard-page .create-header .header-actions > a.btn-primary {
        grid-column: 1 / -1;
        padding-block: 0.7rem;
        font-size: 0.92rem;
        font-weight: 600;
    }
}
@media (max-width: 480px) {
    /* Even tighter: collapse the long "Test-Umfrage" text. */
    .dashboard-page #openTestCreatorBtn { font-size: 0.82rem; padding: 0.5rem 0.6rem; }
    .dashboard-page #openTestCreatorBtn::before { content: '🧪'; margin-right: 0.2rem; }
}

/* Test-Creator modal — mobile portability */
@media (max-width: 560px) {
    .test-creator-dialog {
        width: 100%;
        max-width: 100%;
    }
    .test-creator-chips {
        gap: 0.3rem;
    }
    .test-creator-chip {
        padding: 0.38rem 0.65rem;
        font-size: 0.82rem;
        flex: 1 1 auto;
        min-width: 0;
        text-align: center;
    }
    .test-creator-actions {
        flex-direction: column-reverse;
        gap: 0.4rem;
        align-items: stretch;
    }
    .test-creator-actions .btn { width: 100%; }
    .test-creator-content {
        padding: 0.85rem;
    }
}

/* Dashboard-Workflow-Stepper (01 Bauen → 04 Abschließen) wurde
   entfernt — er war rein dekorativ, nicht klickbar, und nahm
   Platz weg, der jetzt für die echten Metric-Cards bleibt. */

/* ============================================================
   Survey-Results Redesign (v2) — Studio-aligned chrome.
   Sticky topbar mit Titel + Status-Pill + Export-Dropdown,
   Pill-Tabs darunter, sauberere Cards. Bleibt voll
   abwärtskompatibel — alle alten Element-IDs sind im HTML
   weiterhin vorhanden, nur die äußere Optik ändert sich.
   ============================================================ */

.results-page-v2 {
    background: var(--bg);
    /* PERF: das Body-Gradient (radial(--accent-glow)) streckt sich
       über die GANZE Seitenlänge. Bei 3000+ Tabellenzeilen ist die
       Body-Höhe 100k+ Pixel — der Browser muss diesen Pixelbrei
       auf den Compositor-Layer malen. Auf der Results-Seite killen
       wir das Gradient → spürbar weniger Paint-Arbeit. */
    background-image: none;
    /* Scroll-Anchoring deaktivieren — verhindert, dass der Browser
       bei DOM-Mutationen (Chart-Rendering, content-visibility-
       Wechsel) den Scroll künstlich kompensiert. Das verursachte
       die ruckartigen Sprünge beim Hochscrollen. */
    overflow-anchor: none;
}

/* PERF: sticky-Top als eigene GPU-Layer komponieren — verhindert
   Repaints des Headers beim Scrollen des Body. */
.results-sticky-top {
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Topbar + Tabs liegen jetzt in einem gemeinsamen sticky-Container.
   Das vermeidet das frühere Problem, dass die Tabs (`top: 64px`)
   bei langem Titel hinter der Topbar verschwanden. */
.results-sticky-top {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 4px 12px -10px rgba(0, 0, 0, 0.15);
}

/* ----- Topbar (innerhalb des sticky-Wrappers) -----
   PERF: backdrop-filter raus. Bei sticky elements zwingt blur den
   Browser, bei jedem Scroll den darunter liegenden Inhalt neu zu
   sampeln — auf einer Seite mit 3000 Antworten in der Tabelle
   killt das die FPS. Wir nutzen jetzt einen vollopaken Background. */
.results-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem clamp(1rem, 4vw, 2rem);
    background: var(--bg-elevated);
}

.results-topbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    flex: 1 1 auto;
}

.results-topbar-right {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex: 0 0 auto;
}

/* Round chevron-back (matches studio-back). Padding 0 ist Pflicht,
   sonst überschreibt die globale `button { padding: 0.65rem 1.15rem }`
   Regel das Grid-Layout und schiebt das SVG aus der Mitte. */
.results-back {
    width: 2.4rem;
    height: 2.4rem;
    padding: 0;
    line-height: 0;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text);
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast);
    flex-shrink: 0;
    box-shadow: none;
}

.results-back svg {
    display: block;
}

.results-back:hover {
    background: var(--bg-muted);
    border-color: var(--border-strong);
}

.results-title-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
    min-width: 0;
}

.results-eyebrow {
    margin: 0;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.results-title {
    margin: 0;
    font-size: clamp(1.05rem, 2.4vw, 1.45rem);
    font-weight: 700;
    line-height: 1.2;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.results-meta-line {
    margin: 0.1rem 0 0;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.1;
}

.results-meta-line:empty {
    display: none;
}

.results-icon-btn {
    width: 2.4rem;
    min-width: 2.4rem;
    height: 2.4rem;
    padding: 0;
    line-height: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text);
    cursor: pointer;
    box-shadow: none;
    transition: background var(--transition-fast), border-color var(--transition-fast);
}

.results-icon-btn:hover {
    background: var(--bg-muted);
    border-color: var(--border-strong);
}

.results-icon-btn svg {
    display: block;
}

/* Export-Dropdown — der Wrapper bleibt im DOM, das Menü wird per JS
   in den <body> umgehängt und mit position: fixed positioniert. */
.results-export-dropdown {
    position: relative;
}

/* Default (im body, schwebend). */
.results-export-menu--floating {
    position: fixed;
    min-width: 220px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
    padding: 0.35rem;
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

.results-export-menu--floating[hidden],
.results-export-menu[hidden] {
    display: none !important;
}

.results-export-item {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    color: var(--text);
    padding: 0.55rem 0.7rem;
    border-radius: 8px;
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: none;
}

.results-export-item:hover,
.results-export-item:focus-visible {
    background: var(--bg-muted);
    outline: none;
}

/* ----- Tabs-Bar (Studio-Look) -----
   Liegt innerhalb von .results-sticky-top, also automatisch
   direkt unter der Topbar. KEIN eigenes `position: sticky` mehr.
   Layout: Tabs links, Filter-Inputs inline rechts. */
.results-tabs-bar {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.4rem clamp(1rem, 4vw, 2rem) 0.55rem;
    background: var(--bg);
}

.results-tabs {
    display: inline-flex;
    gap: 0.3rem;
    flex: 0 0 auto;
    /* Beide Tabs müssen IMMER nebeneinander sichtbar bleiben — kein
       overflow-clip, kein wrap. Bei sehr engen Viewports horizontal
       scrollen statt verstecken. */
    flex-wrap: nowrap;
    min-width: max-content;
    overflow-x: visible;
}

.results-tabs::-webkit-scrollbar { display: none; }

/* WICHTIG: Tab-Buttons tragen die alte Klasse .results-view-btn
   (für JS-Klick-Selektor) PLUS unsere neue .results-tab. Die
   alte .results-view-btn-Regel weiter oben in der Datei setzt
   `width: 100%; min-height: 3.1rem` und färbt zudem
   `.results-view-btn.is-active` nur auf color. Da .results-view-btn
   und .results-tab gleich spezifisch sind, wäre die Source-Order
   entscheidend — verlässt sich aber auf Linker-Zufälligkeiten.
   Wir killen das mit `!important` für alle visuell relevanten
   Regeln, damit der Active-State garantiert mit dem Klick mitgeht. */
.results-tabs > .results-tab,
.results-tab.results-view-btn {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    width: auto !important;
    min-width: 0 !important;
    min-height: auto !important;
    background: transparent !important;
    border: 1px solid transparent !important;
    color: var(--text-muted) !important;
    padding: 0.45rem 0.95rem !important;
    border-radius: 999px !important;
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
    text-align: center !important;
    letter-spacing: 0.01em !important;
    white-space: nowrap !important;
    cursor: pointer !important;
    box-shadow: none !important;
    transition: background var(--transition-fast), color var(--transition-fast),
                border-color var(--transition-fast) !important;
}

.results-tabs > .results-tab:hover,
.results-tab.results-view-btn:hover {
    color: var(--text) !important;
    background: var(--bg-muted) !important;
    border-color: transparent !important;
}

/* Active-State NUR über .is-active und aria-pressed='true' steuern.
   aria-selected ist im HTML hartcodiert und wird vom JS nie
   aktualisiert — wenn wir das hier mit reinnehmen, würde
   Auswertung dauerhaft die Active-Pill behalten, auch wenn auf
   Einzelantworten gewechselt wird. */
.results-tabs > .results-tab.is-active,
.results-tabs > .results-tab[aria-pressed='true'],
.results-tab.results-view-btn.is-active,
.results-tab.results-view-btn[aria-pressed='true'] {
    background: var(--bg-elevated) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

/* ----- Main shell — etwas mehr Atemraum links/rechts, kein Doppel-Padding mehr ----- */
.results-shell-v2 {
    width: min(var(--page-max, 1320px), 100%);
    margin: 0 auto;
    padding: 1.25rem clamp(1rem, 4vw, 2rem) 4rem;
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
}

/* ----- Aggregate-Filter, INLINE in der sticky Top-Bar -----
   Wird ausgeblendet, sobald der Einzelantworten-Tab aktiv ist
   (über :has() weiter unten). Auf Mobile fallen die Felder in
   eine zweite Zeile. */
.results-aggregate-filters {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex: 1 1 auto;
    min-width: 0;
    justify-content: flex-end;
    flex-wrap: nowrap;
}

.results-aggregate-filters .results-filter-cell {
    display: flex;
    min-width: 0;
}

.results-aggregate-filters .results-filter-cell input,
.results-aggregate-filters .results-filter-cell select {
    width: 100%;
    padding: 0.4rem 0.7rem;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text);
    min-height: auto;
    box-shadow: none;
}

.results-aggregate-filters .control-search {
    flex: 1 1 220px;
    max-width: 320px;
}

.results-aggregate-filters .results-page-size-field {
    flex: 0 0 auto;
}

.results-aggregate-filters .results-page-size-field select {
    width: auto;
    min-width: 110px;
}

.results-aggregate-filters .results-filter-reset-btn {
    flex-shrink: 0;
    color: var(--text-muted);
}

.results-aggregate-filters .results-filter-reset-btn:hover {
    color: var(--text);
}

/* ----- Individual-Filter (Einzelantworten-Sicht), INLINE in der
   sticky Top-Bar. Spiegelt das Layout von .results-aggregate-filters
   wider — Suche links, Page-Size + Filter-Toggle rechts. */
.results-individual-filters {
    display: none; /* Default versteckt; siehe Show-Regel unten. */
    align-items: center;
    gap: 0.4rem;
    flex: 1 1 auto;
    min-width: 0;
    justify-content: flex-end;
    flex-wrap: nowrap;
}

.results-individual-filters .results-filter-cell {
    display: flex;
    min-width: 0;
    position: relative;
}

.results-individual-filters .results-filter-cell input,
.results-individual-filters .results-filter-cell select {
    width: 100%;
    padding: 0.4rem 0.7rem;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text);
    min-height: auto;
    box-shadow: none;
}

.results-individual-filters .control-search {
    flex: 1 1 240px;
    max-width: 360px;
}

.results-individual-filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.7rem;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text);
    cursor: pointer;
    min-height: auto;
    box-shadow: none;
    white-space: nowrap;
}

.results-individual-filter-toggle:hover {
    background: var(--bg-muted);
    border-color: var(--border-strong);
}

.results-individual-filter-toggle .filter-dropdown-toggle-count:not(.hidden) {
    background: var(--accent-soft);
    color: var(--accent-strong);
    border-radius: 999px;
    padding: 0 0.4rem;
    font-size: 0.75rem;
    font-weight: 700;
}

/* Toggle-Sichtbarkeit nach aktivem Tab. CSS `:has()` ist breit
   unterstützt (Chrome/Edge/Safari/Firefox 121+). Fallback: beide
   sichtbar — würde funktional nicht stören, nur eng aussehen. */
.results-sticky-top:has(#viewModeIndividualsBtn.is-active)
    .results-aggregate-filters {
    display: none !important;
}

.results-sticky-top:has(#viewModeIndividualsBtn.is-active)
    .results-individual-filters {
    display: flex !important;
}

/* Wenn Individual-Filter aktiv und im sticky-top, soll das Panel
   relativ zum Toggle erscheinen, NICHT zentral. */
.results-individual-filters #individualFilterPanel {
    position: absolute;
    top: calc(100% + 0.4rem);
    right: 0;
    z-index: 70;
    min-width: 320px;
    max-width: 92vw;
}

/* ----- Pagination-Bar (jetzt eigene Sektion unter den Charts) ----- */
.results-page-v2 .results-pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.55rem;
    flex-wrap: wrap;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.55rem 0.85rem;
}

.results-page-v2 .results-pagination-bar .results-count {
    margin: 0;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.results-page-v2 .results-pagination-bar .results-pagination {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.results-page-v2 .results-pagination-bar .results-pagination .btn {
    padding: 0.35rem 0.7rem;
    font-size: 0.82rem;
    min-height: auto;
}

.results-page-v2 .results-pagination-bar .results-page-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0 0.2rem;
}

/* Insight & Chart Cards — etwas wärmere Schatten, mehr Spacing.
   PERF: contain isoliert Repaint/Reflow pro Card, content-visibility
   überspringt Off-Screen-Karten komplett (besonders für die unten
   liegenden Insight-Karten relevant). */
.results-page-v2 .results-chart-card,
.results-page-v2 .insight-card {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    contain: layout style paint;
}

.results-page-v2 .results-chart-card {
    padding: 1.1rem 1.25rem 1.25rem;
    /* Chart-Cards sind ~320px hoch, beim Scrollen aus dem View
       muss der Browser keine Chart-Pixel mehr neu rendern. */
    content-visibility: auto;
    contain-intrinsic-size: 1px 320px;
}

.results-page-v2 .insight-card {
    contain: layout style paint;
}

/* Pagination + Counter-Bar bekommen auch contain — kleines DOM,
   wirklich nur paint isolation. */
.results-page-v2 .results-pagination-bar {
    contain: layout style;
}

/* Result-Cards (jede Frage) — etwas größere Radien, mehr Atem,
   konsistent mit Studio-Card.

   PERFORMANCE: content-visibility: auto sorgt dafür, dass nur
   die im Viewport sichtbaren Karten gerendert werden — bei 40+
   Fragen-Karten der größte Single-Win. contain-intrinsic-size
   gibt dem Browser eine realistischere Platzhalter-Höhe (vorher
   1×420 → Karten mit Charts werden eher 600-800 px hoch), damit
   die Scroll-Position nicht springt und der Scrollbalken nicht
   wandert. `contain: layout style paint` isoliert Reflow/Repaint
   pro Karte vollständig. */
.results-page-v2 .result-card {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    background: var(--bg-elevated);
    overflow: hidden;
    content-visibility: auto;
    contain-intrinsic-size: 1px 600px;
    contain: layout style paint;
}

.results-page-v2 .result-card-header {
    padding: 1.15rem 1.3rem 0.95rem;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg-elevated) 92%, var(--accent-soft));
}

.results-page-v2 .result-card-body {
    padding: 1.2rem 1.3rem 1.35rem;
}

/* Versteckt das alte Slider-Element des Toggle-Switches (wir nutzen
   jetzt Pill-Tabs, das Slider-DIV bleibt nur als sr-only erhalten,
   damit der bestehende JS-Code nichts vermisst). */
.results-page-v2 #resultsViewSlider {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

/* Mobile-Tuning. Topbar enger, Tabs+Filter wrappen auf 2 Zeilen,
   Meta-Line aus. */
@media (max-width: 980px) {
    /* Filter wickeln zur 2. Zeile, unter die Tabs. */
    .results-tabs-bar {
        flex-wrap: wrap;
    }
    .results-aggregate-filters {
        order: 2;
        flex: 1 1 100%;
        justify-content: stretch;
        margin-top: 0.3rem;
    }
    .results-aggregate-filters .control-search {
        flex: 1 1 auto;
        max-width: none;
    }
}

@media (max-width: 720px) {
    .results-topbar {
        padding: 0.55rem 0.75rem;
        gap: 0.5rem;
    }
    .results-tabs-bar {
        padding: 0.3rem 0.75rem 0.5rem;
        gap: 0.4rem;
    }
    .results-shell-v2 {
        padding: 0.85rem 0.75rem 3rem;
        gap: 0.9rem;
    }
    .results-back {
        width: 2.15rem;
        height: 2.15rem;
    }
    .results-icon-btn {
        width: 2.15rem;
        min-width: 2.15rem;
        height: 2.15rem;
    }
    .results-eyebrow { font-size: 0.6rem; letter-spacing: 0.14em; }
    .results-title { font-size: 0.95rem; }
    .results-meta-line { display: none; }
    .results-tab { padding: 0.4rem 0.85rem; font-size: 0.85rem; }
    .results-export-menu--floating { min-width: 200px; }
    .results-aggregate-filters {
        flex-wrap: wrap;
        gap: 0.35rem;
    }
    .results-aggregate-filters .control-search {
        flex: 1 1 100%;
    }
    .results-aggregate-filters .results-filter-cell {
        flex: 1 1 calc(50% - 0.4rem);
    }
    .results-aggregate-filters .results-filter-reset-btn {
        flex: 0 0 auto;
    }
}

@media (max-width: 440px) {
    .results-page-v2 .results-pagination-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.4rem;
    }
    .results-page-v2 .results-pagination-bar .results-pagination {
        justify-content: space-between;
    }
}

