/* Anamnese Manager – Formular */
.anm-form {
	--anm-primary: #0f766e;
	--anm-text: #1f2937;
	--anm-muted: #6b7280;
	--anm-border: #e5e7eb;
	--anm-bg: #ffffff;
	--anm-soft: #f8fafc;
	--anm-error: #dc2626;
	--anm-radius: 16px;
	--anm-radius-sm: calc(var(--anm-radius) * .75);
	--anm-radius-xs: calc(var(--anm-radius) * .625);
	--anm-radius-pill: calc(var(--anm-radius) * 62); /* 0 bei eckigem Design */
	--anm-font: inherit;
	max-width: 760px;
	margin: 0 auto;
	color: var(--anm-text);
	font-family: var(--anm-font);
	font-size: 17px;
	line-height: 1.5;
}
.anm-form *, .anm-form *::before, .anm-form *::after { box-sizing: border-box; }
.anm-form [hidden] { display: none !important; }

.anm-card {
	background: var(--anm-bg);
	border: 1px solid var(--anm-border);
	border-radius: var(--anm-radius);
	box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 12px 32px -12px rgba(15, 23, 42, .12);
	padding: 28px;
	margin: 0;
}
@media (max-width: 600px) {
	.anm-card { padding: 20px 16px; border-radius: var(--anm-radius-sm); }
	.anm-form { font-size: 16px; }
}

/* Fortschritt */
.anm-header { margin-bottom: 24px; }
.anm-progress-label { font-size: .85em; font-weight: 600; color: var(--anm-muted); margin-bottom: 8px; letter-spacing: .01em; }
.anm-progress-bar { height: 6px; border-radius: 99px; background: color-mix(in srgb, var(--anm-primary) 12%, #fff); overflow: hidden; }
.anm-progress-bar span { display: block; height: 100%; width: 0; background: var(--anm-primary); border-radius: inherit; transition: width .35s ease; }

/* Schritte */
.anm-step { animation: anm-in .25s ease; }
@keyframes anm-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.anm-form .anm-step-title { font-size: 1.5em; line-height: 1.25; margin: 0 0 8px; color: var(--anm-text); outline: none; }
.anm-step-intro { color: var(--anm-muted); margin: 0 0 20px; }

.anm-group { margin: 0 0 8px; }
.anm-form .anm-group-title { font-size: 1em; text-transform: uppercase; letter-spacing: .06em; color: var(--anm-muted); margin: 8px 0 12px; }
.anm-subgroup { background: var(--anm-soft); border: 1px solid var(--anm-border); border-radius: var(--anm-radius-sm); padding: 16px; margin: 0 0 20px; }

.anm-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0 16px; }
.anm-grid > .anm-field { grid-column: span 6; }
.anm-grid > .anm-w-half { grid-column: span 3; }
.anm-grid > .anm-w-third { grid-column: span 2; }
.anm-grid > .anm-w-twothird { grid-column: span 4; }
@media (max-width: 600px) {
	.anm-grid > .anm-w-half { grid-column: span 6; }
}

/* Felder */
.anm-field { border: 0; padding: 0; margin: 0 0 20px; min-width: 0; }
.anm-form .anm-label { display: block; font-weight: 600; margin: 0 0 8px; padding: 0; font-size: 1em; color: var(--anm-text); }
.anm-req { color: var(--anm-primary); }
.anm-help { color: var(--anm-muted); font-size: .9em; margin: -4px 0 10px; }

.anm-form .anm-input {
	display: block;
	width: 100%;
	font: inherit;
	color: inherit;
	background: #fff;
	border: 1.5px solid #d1d5db;
	border-radius: var(--anm-radius-xs);
	padding: 12px 14px;
	min-height: 50px;
	margin: 0;
	box-shadow: none;
	transition: border-color .15s, box-shadow .15s;
	-webkit-appearance: none;
	appearance: none;
}
.anm-form select.anm-input {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%236b7280' stroke-width='2' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 14px center;
	padding-right: 40px;
}
.anm-form textarea.anm-input { min-height: 90px; resize: vertical; }
.anm-counter { display: block; text-align: right; color: var(--anm-muted); font-size: .85em; margin: 4px 2px 0; }
.anm-counter.is-full { color: var(--anm-error); font-weight: 600; }
.anm-form .anm-input:focus {
	outline: none;
	border-color: var(--anm-primary);
	box-shadow: 0 0 0 4px color-mix(in srgb, var(--anm-primary) 18%, transparent);
}

/* Ja/Nein- und Auswahl-Pillen */
.anm-pills { display: flex; flex-wrap: wrap; gap: 10px; }
.anm-pill { position: relative; flex: 0 1 auto; margin: 0; cursor: pointer; }
.anm-pill-input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.anm-pill span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 96px;
	min-height: 48px;
	padding: 10px 20px;
	border: 1.5px solid #d1d5db;
	border-radius: var(--anm-radius-pill);
	font-weight: 600;
	background: #fff;
	transition: background .15s, border-color .15s, color .15s, transform .1s;
	user-select: none;
}
.anm-pill:hover span { border-color: var(--anm-primary); }
.anm-pill:active span { transform: scale(.97); }
.anm-pill-input:focus-visible + span { box-shadow: 0 0 0 4px color-mix(in srgb, var(--anm-primary) 25%, transparent); }
.anm-pill-input:checked + span { background: var(--anm-primary); border-color: var(--anm-primary); color: #fff; }

.anm-yesno { padding: 16px 0; margin: 0; border-bottom: 1px solid var(--anm-border); }
.anm-yesno:last-of-type { border-bottom: 0; }
.anm-yesno .anm-label { font-weight: 500; }
@media (min-width: 640px) {
	.anm-yesno { display: grid; grid-template-columns: 1fr auto; column-gap: 20px; align-items: center; }
	.anm-yesno > .anm-label { margin: 0; }
	.anm-yesno > .anm-help, .anm-yesno > .anm-error, .anm-yesno > .anm-followup { grid-column: 1 / -1; }
	.anm-yesno > .anm-help { margin: 6px 0 0; }
	.anm-yesno .anm-pill span { min-width: 80px; }
}
.anm-followup { margin: 14px 0 0; padding: 14px; background: var(--anm-soft); border-radius: var(--anm-radius-sm); border-left: 3px solid var(--anm-primary); }
.anm-followup .anm-label { font-weight: 600; }

.anm-content { background: var(--anm-soft); border-radius: var(--anm-radius-sm); padding: 14px 16px; margin: 0 0 20px; color: #374151; font-size: .95em; }
.anm-content p { margin: 0 0 10px; }
.anm-content p:last-child { margin-bottom: 0; }
.anm-content a { color: var(--anm-primary); font-weight: 600; }

/* Fehler */
.anm-error { color: var(--anm-error); font-size: .9em; font-weight: 600; margin: 8px 0 0; }
.has-error .anm-input, .has-error .anm-pill span, .has-error .anm-sig { border-color: var(--anm-error); }

/* Unterschrift */
.anm-sig { position: relative; border: 1.5px dashed #9ca3af; border-radius: var(--anm-radius-sm); background: #fff; margin-bottom: 10px; touch-action: none; }
.anm-sig-canvas { display: block; width: 100%; height: 190px; cursor: crosshair; touch-action: none; position: relative; z-index: 2; }
.anm-sig-hint { position: absolute; left: 0; right: 0; top: 42%; text-align: center; color: #9ca3af; pointer-events: none; font-size: .95em; }
.anm-sig.is-signed .anm-sig-hint { display: none; }
.anm-sig-line { position: absolute; left: 24px; right: 24px; bottom: 40px; border-bottom: 1px solid #d1d5db; pointer-events: none; }

/* Navigation */
.anm-nav { display: flex; gap: 12px; justify-content: space-between; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--anm-border); }
.anm-nav .anm-btn-primary { margin-left: auto; }
.anm-form .anm-btn {
	font: inherit;
	font-weight: 700;
	border-radius: var(--anm-radius-pill);
	padding: 14px 28px;
	min-height: 52px;
	border: 1.5px solid transparent;
	cursor: pointer;
	transition: background .15s, box-shadow .15s, opacity .15s;
	line-height: 1.2;
	text-transform: none;
	letter-spacing: 0;
}
.anm-form .anm-btn-primary { background: var(--anm-primary); color: #fff; box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--anm-primary) 60%, transparent); }
.anm-form .anm-btn-primary:hover { background: color-mix(in srgb, var(--anm-primary) 88%, #000); }
.anm-form .anm-btn-ghost { background: transparent; color: var(--anm-text); border-color: #d1d5db; }
.anm-form .anm-btn-ghost:hover { background: var(--anm-soft); }
.anm-form .anm-btn-small { padding: 8px 16px; min-height: 0; font-size: .85em; font-weight: 600; }
.anm-form .anm-btn:disabled { opacity: .6; cursor: progress; }
.anm-form .anm-btn:focus-visible { outline: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--anm-primary) 30%, transparent); }
.anm-btn.is-loading::after { content: ""; display: inline-block; width: 1em; height: 1em; margin-left: 10px; vertical-align: -2px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: anm-spin .7s linear infinite; }
@keyframes anm-spin { to { transform: rotate(360deg); } }
@media (max-width: 480px) {
	.anm-nav { flex-direction: column-reverse; }
	.anm-nav .anm-btn { width: 100%; }
}

.anm-status { margin-top: 16px; font-weight: 600; color: var(--anm-muted); }
.anm-status:empty { display: none; }
.anm-status.is-error { color: var(--anm-error); background: #fef2f2; border-radius: var(--anm-radius-xs); padding: 12px 14px; }

.anm-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

/* Übersicht */
.anm-review-card { border: 1px solid var(--anm-border); border-radius: var(--anm-radius-sm); padding: 14px 16px; margin-bottom: 12px; }
.anm-review-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 6px; }
.anm-form .anm-review-head h3 { margin: 0; font-size: 1em; }
.anm-form .anm-link { background: none; border: 0; padding: 4px 0; color: var(--anm-primary); font: inherit; font-weight: 700; cursor: pointer; text-decoration: underline; }
.anm-review-card dl { margin: 0; }
.anm-review-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 6px 0; border-top: 1px solid #f3f4f6; font-size: .92em; }
.anm-review-row dt { color: var(--anm-muted); margin: 0; }
.anm-review-row dd { margin: 0; font-weight: 600; text-align: right; word-break: break-word; max-width: 55vw; }
.anm-review-row.is-yes dd { color: var(--anm-primary); }

/* Erfolg */
.anm-success { text-align: center; padding: 32px 8px; }
.anm-success-icon { display: inline-flex; align-items: center; justify-content: center; width: 72px; height: 72px; border-radius: 50%; background: color-mix(in srgb, var(--anm-primary) 14%, #fff); color: var(--anm-primary); margin-bottom: 16px; }
.anm-form .anm-success h2 { margin: 0 0 8px; outline: none; }
.anm-success p { color: var(--anm-muted); margin: 0; }

/* Kopfbereich mit Logo */
.anm-brand { text-align: center; margin: 0 0 20px; }
.anm-brand img { display: inline-block; max-height: 72px; max-width: 260px; width: auto; height: auto; }
.anm-brand-name { font-size: 1.35em; font-weight: 700; color: var(--anm-text); }
