/*
 * Junior Handling Manager - Frontend.
 *
 * Eigenstaendiges, bewusst zurueckhaltendes Aussehen: alle Regeln haengen am
 * Praefix .jhm, damit weder das Theme noch andere Plugins beeinflusst werden.
 * Farben und Abstaende kommen aus Custom Properties und lassen sich vom Theme
 * ueberschreiben, ohne dass hier etwas geaendert werden muss.
 */

.jhm {
	--jhm-fg: #1d2327;
	--jhm-muted: #5b6871;
	--jhm-line: #d7dde2;
	--jhm-bg: #ffffff;
	--jhm-soft: #f3f5f7;
	--jhm-accent: #1f5c3d;
	--jhm-accent-fg: #ffffff;
	--jhm-warn: #8a2b2b;
	--jhm-warn-bg: #fdecec;
	--jhm-ok: #1f5c3d;
	--jhm-ok-bg: #e8f3ec;
	--jhm-info-bg: #eef2f6;
	--jhm-radius: 6px;
	--jhm-gap: 1rem;

	box-sizing: border-box;
	color: var(--jhm-fg);
	font-size: 1rem;
	line-height: 1.5;
}

.jhm *,
.jhm *::before,
.jhm *::after {
	box-sizing: inherit;
}

/* --- Typografie ------------------------------------------------------- */

.jhm .jhm-title {
	margin: 0 0 0.25rem;
	font-size: 1.5rem;
	line-height: 1.2;
}

.jhm .jhm-section-title {
	margin: 0 0 0.5rem;
	font-size: 1.25rem;
	line-height: 1.3;
}

.jhm .jhm-class-title {
	margin: 1.25rem 0 0.35rem;
	font-size: 1.05rem;
}

.jhm .jhm-subtitle {
	margin: 0.5rem 0 0.25rem;
	font-weight: 600;
	color: var(--jhm-muted);
}

.jhm .jhm-lead {
	margin: 0 0 0.75rem;
	color: var(--jhm-muted);
}

.jhm .jhm-hint {
	margin: 0.5rem 0 0;
	font-size: 0.875rem;
	color: var(--jhm-muted);
}

.jhm .jhm-empty {
	margin: 0.5rem 0;
	padding: 0.75rem;
	background: var(--jhm-soft);
	border-radius: var(--jhm-radius);
	color: var(--jhm-muted);
}

.jhm .jhm-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* --- Bausteine -------------------------------------------------------- */

.jhm .jhm-section {
	margin: 2rem 0;
	padding-top: 1rem;
	border-top: 1px solid var(--jhm-line);
}

.jhm .jhm-block {
	margin: 0 0 2rem;
}

.jhm .jhm-card {
	padding: 1rem;
	background: var(--jhm-bg);
	border: 1px solid var(--jhm-line);
	border-radius: var(--jhm-radius);
}

.jhm .jhm-card h3 {
	margin-top: 0;
}

.jhm .jhm-notice {
	margin: 0 0 1rem;
	padding: 0.75rem 1rem;
	border-left: 4px solid var(--jhm-line);
	border-radius: var(--jhm-radius);
	background: var(--jhm-info-bg);
}

.jhm .jhm-notice-error {
	border-left-color: var(--jhm-warn);
	background: var(--jhm-warn-bg);
	color: var(--jhm-warn);
}

.jhm .jhm-notice-success {
	border-left-color: var(--jhm-ok);
	background: var(--jhm-ok-bg);
	color: var(--jhm-ok);
}

.jhm .jhm-badge {
	display: inline-block;
	margin-left: 0.4rem;
	padding: 0.05rem 0.45rem;
	border-radius: 999px;
	background: var(--jhm-accent);
	color: var(--jhm-accent-fg);
	font-size: 0.75rem;
	white-space: nowrap;
}

/* --- Tabellen --------------------------------------------------------- */

.jhm .jhm-table-wrap {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	margin: 0 0 1rem;
}

.jhm .jhm-table {
	width: 100%;
	min-width: 32rem;
	border-collapse: collapse;
	background: var(--jhm-bg);
	font-size: 0.95rem;
}

.jhm .jhm-table th,
.jhm .jhm-table td {
	padding: 0.5rem 0.6rem;
	border-bottom: 1px solid var(--jhm-line);
	text-align: left;
	vertical-align: top;
}

.jhm .jhm-table thead th {
	background: var(--jhm-soft);
	font-size: 0.85rem;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	white-space: nowrap;
}

.jhm .jhm-table tfoot th,
.jhm .jhm-table tfoot td {
	border-top: 2px solid var(--jhm-fg);
	border-bottom: none;
	font-weight: 700;
}

.jhm .jhm-table .jhm-num {
	text-align: right;
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

.jhm .jhm-table tbody tr:hover {
	background: var(--jhm-soft);
}

.jhm .jhm-day-winner {
	background: var(--jhm-ok-bg);
}

.jhm .jhm-day-winner td {
	font-weight: 600;
}

.jhm .jhm-row-link {
	color: inherit;
	text-decoration: underline;
}

/* --- Formulare -------------------------------------------------------- */

.jhm .jhm-form {
	margin: 0 0 1rem;
}

.jhm .jhm-fieldset {
	margin: 0 0 1.25rem;
	padding: 1rem;
	border: 1px solid var(--jhm-line);
	border-radius: var(--jhm-radius);
}

.jhm .jhm-fieldset > legend {
	padding: 0 0.4rem;
	font-weight: 600;
}

.jhm .jhm-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
	gap: var(--jhm-gap);
}

.jhm .jhm-field {
	display: flex;
	flex-direction: column;
	margin: 0 0 0.5rem;
}

.jhm .jhm-label {
	margin: 0 0 0.2rem;
	font-size: 0.9rem;
	font-weight: 600;
}

.jhm .jhm-req {
	color: var(--jhm-warn);
}

.jhm .jhm-input {
	width: 100%;
	max-width: 100%;
	padding: 0.5rem 0.6rem;
	border: 1px solid var(--jhm-line);
	border-radius: var(--jhm-radius);
	background: var(--jhm-bg);
	color: var(--jhm-fg);
	font: inherit;
}

.jhm .jhm-input:focus {
	outline: 2px solid var(--jhm-accent);
	outline-offset: 1px;
}

.jhm select.jhm-input {
	min-height: 2.4rem;
}

.jhm .jhm-code-input {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	letter-spacing: 0.15em;
	text-transform: uppercase;
}

.jhm .jhm-choices {
	margin: 0;
	padding: 0;
	list-style: none;
}

.jhm .jhm-choice {
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
	padding: 0.4rem 0;
	flex-wrap: wrap;
}

.jhm .jhm-choice-name {
	font-weight: 600;
}

.jhm .jhm-choice-meta {
	color: var(--jhm-muted);
	font-size: 0.9rem;
}

.jhm .jhm-honeypot {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.jhm .jhm-button {
	display: inline-block;
	margin: 0.5rem 0 0;
	padding: 0.55rem 1rem;
	border: 1px solid var(--jhm-accent);
	border-radius: var(--jhm-radius);
	background: var(--jhm-accent);
	color: var(--jhm-accent-fg);
	font: inherit;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
}

.jhm .jhm-button:hover,
.jhm .jhm-button:focus {
	filter: brightness(1.1);
	color: var(--jhm-accent-fg);
}

.jhm .jhm-button-quiet {
	background: transparent;
	color: var(--jhm-fg);
	border-color: var(--jhm-line);
}

.jhm .jhm-button-small {
	padding: 0.3rem 0.6rem;
	font-size: 0.85rem;
	white-space: nowrap;
}

.jhm .jhm-button-primary {
	font-weight: 600;
}

/* --- Portal ----------------------------------------------------------- */

.jhm-portal .jhm-login-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
	gap: var(--jhm-gap);
	margin: 1rem 0;
}

.jhm-portal .jhm-portal-head {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	justify-content: space-between;
	gap: var(--jhm-gap);
}

.jhm .jhm-lang {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 0.35rem;
	margin: 0.5rem 0;
}

.jhm .jhm-lang-label {
	font-size: 0.85rem;
	color: var(--jhm-muted);
}

.jhm .jhm-lang-button {
	padding: 0.2rem 0.6rem;
	border: 1px solid var(--jhm-line);
	border-radius: 999px;
	background: transparent;
	color: var(--jhm-fg);
	font: inherit;
	font-size: 0.85rem;
	cursor: pointer;
}

.jhm .jhm-lang-button.is-active {
	background: var(--jhm-accent);
	border-color: var(--jhm-accent);
	color: var(--jhm-accent-fg);
}

.jhm .jhm-stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
	gap: 0.5rem;
	margin: 0 0 0.75rem;
	padding: 0;
	list-style: none;
}

.jhm .jhm-stats li {
	padding: 0.6rem 0.75rem;
	background: var(--jhm-soft);
	border-radius: var(--jhm-radius);
}

.jhm .jhm-stat-label {
	display: block;
	font-size: 0.8rem;
	color: var(--jhm-muted);
}

.jhm .jhm-stat-value {
	display: block;
	font-size: 1.35rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.jhm .jhm-progress {
	height: 0.75rem;
	background: var(--jhm-soft);
	border-radius: 999px;
	overflow: hidden;
}

.jhm .jhm-progress-bar {
	display: block;
	height: 100%;
	background: var(--jhm-accent);
}

.jhm .jhm-readonly {
	margin-top: 1.5rem;
	padding: 1rem;
	background: var(--jhm-soft);
	border-radius: var(--jhm-radius);
}

.jhm .jhm-readonly h4 {
	margin: 0 0 0.5rem;
}

/* --- Bewertungsbogen -------------------------------------------------- */

.jhm .jhm-sheet-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 0 0 1rem;
}

.jhm .jhm-sheet {
	padding: 1.25rem;
	border: 1px solid var(--jhm-fg);
	border-radius: var(--jhm-radius);
	background: var(--jhm-bg);
}

.jhm .jhm-sheet-head {
	margin: 0 0 1rem;
	padding-bottom: 0.75rem;
	border-bottom: 2px solid var(--jhm-fg);
}

.jhm .jhm-sheet-head h2 {
	margin: 0;
	font-size: 1.3rem;
}

.jhm .jhm-sheet-sub {
	margin: 0.25rem 0 0;
	color: var(--jhm-muted);
}

.jhm .jhm-sheet-meta {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
	gap: 0.5rem 1rem;
	margin: 0 0 1rem;
}

.jhm .jhm-sheet-meta > div {
	padding-bottom: 0.3rem;
	border-bottom: 1px dotted var(--jhm-line);
}

.jhm .jhm-sheet-meta dt {
	font-size: 0.78rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--jhm-muted);
}

.jhm .jhm-sheet-meta dd {
	margin: 0;
	font-weight: 600;
}

.jhm .jhm-criterion-de {
	display: block;
	font-weight: 600;
}

.jhm .jhm-criterion-en {
	display: block;
	font-weight: 400;
	font-style: italic;
	font-size: 0.85rem;
	color: var(--jhm-muted);
}

.jhm .jhm-total {
	font-size: 1.1rem;
}

.jhm .jhm-sheet-comment {
	margin: 1rem 0;
	padding: 0.75rem 1rem;
	background: var(--jhm-soft);
	border-radius: var(--jhm-radius);
}

.jhm .jhm-sheet-comment h3 {
	margin: 0 0 0.35rem;
	font-size: 1rem;
}

.jhm .jhm-sheet-foot {
	padding-top: 0.75rem;
	border-top: 1px solid var(--jhm-line);
}

/* Unterschrift des Richters: das Bild sitzt auf der Linie. */
.jhm .jhm-sheet-signature {
	margin: 0 0 1rem;
	max-width: 320px;
}

.jhm .jhm-signature-image {
	display: block;
	max-width: 100%;
	max-height: 80px;
	object-fit: contain;
	object-position: left bottom;
}

.jhm .jhm-signature-line {
	display: block;
	border-top: 1px solid var(--jhm-ink, #111);
	padding-top: 0.25rem;
}

.jhm .jhm-signature-label {
	display: block;
	font-size: 0.8rem;
	color: var(--jhm-muted, #555);
}

.jhm .jhm-signature-note {
	display: block;
	margin-top: 0.25rem;
	font-size: 0.8rem;
	color: var(--jhm-muted, #555);
}

/* --- Veranstaltungen, Filter, Meldung --------------------------------- */

.jhm-events .jhm-event {
	margin: 0 0 1rem;
}

.jhm .jhm-event-title {
	margin: 0 0 0.25rem;
	font-size: 1.15rem;
}

.jhm .jhm-event-meta {
	margin: 0 0 0.5rem;
	color: var(--jhm-muted);
}

.jhm .jhm-event-place::after {
	content: " \00b7 ";
}

.jhm .jhm-event-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.jhm .jhm-event-list li {
	padding: 0.4rem 0;
	border-top: 1px solid var(--jhm-line);
}

.jhm .jhm-event-sub {
	display: inline-block;
	margin-right: 0.75rem;
	font-size: 0.9rem;
	color: var(--jhm-muted);
}

.jhm .jhm-filter {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
	margin: 0 0 1rem;
}

.jhm .jhm-chip {
	padding: 0.25rem 0.7rem;
	border: 1px solid var(--jhm-line);
	border-radius: 999px;
	color: var(--jhm-fg);
	font-size: 0.9rem;
	text-decoration: none;
}

.jhm .jhm-chip.is-active {
	background: var(--jhm-accent);
	border-color: var(--jhm-accent);
	color: var(--jhm-accent-fg);
}

.jhm .jhm-code {
	padding: 0.15rem 0.4rem;
	background: var(--jhm-soft);
	border-radius: 4px;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 1.05rem;
	letter-spacing: 0.12em;
}

.jhm-kiosk {
	font-size: 1.1rem;
}

.jhm-kiosk .jhm-input,
.jhm-kiosk .jhm-button {
	padding: 0.7rem 0.9rem;
	font-size: 1.05rem;
}

.jhm .jhm-pay-note {
	font-weight: 600;
}

/* --- Druck ------------------------------------------------------------ */

@media print {
	.jhm .jhm-no-print,
	.jhm .jhm-sheet-actions,
	.jhm .jhm-lang,
	.jhm .jhm-logout,
	.jhm .jhm-button {
		display: none !important;
	}

	.jhm {
		--jhm-soft: #ffffff;
		--jhm-muted: #333333;
		font-size: 11pt;
		color: #000000;
	}

	.jhm .jhm-sheet {
		border: none;
		padding: 0;
	}

	.jhm .jhm-table-wrap {
		overflow: visible;
	}

	.jhm .jhm-table {
		min-width: 0;
		page-break-inside: avoid;
	}

	.jhm .jhm-table thead th {
		background: transparent;
		border-bottom: 1px solid #000000;
	}

	.jhm .jhm-sheet-comment {
		background: transparent;
		border: 1px solid #000000;
	}

	.jhm .jhm-criterion-en {
		color: #333333;
	}

	.jhm a[href]::after {
		content: "";
	}

	@page {
		margin: 15mm;
	}
}

/* --- Portal-QR auf der Meldebestaetigung --- */

.jhm-portal-qr {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 20px;
	margin: 22px 0;
	padding: 18px 20px;
	border: 1px solid var(--jhm-line, #d6d9de);
	border-radius: 6px;
	background: var(--jhm-surface-2, #f6f7f9);
}

.jhm-portal-qr-image {
	flex: 0 0 auto;
	line-height: 0;
	padding: 10px;
	background: #fff;
	border-radius: 4px;
}

.jhm-portal-qr-image svg {
	display: block;
	width: 170px;
	height: 170px;
}

.jhm-portal-qr-text {
	flex: 1 1 240px;
	min-width: 220px;
}

.jhm-portal-qr-text h4 {
	margin: 0 0 6px;
	font-size: 1.1em;
}

.jhm-portal-qr-text p {
	margin: 0 0 8px;
}

.jhm-kiosk-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
}

.jhm-button-quiet {
	background: transparent;
	border: 1px solid var(--jhm-line, #d6d9de);
	color: inherit;
}

.jhm-button-quiet[disabled] {
	opacity: .5;
	cursor: default;
}

/* Im Kiosk-Modus wird aus mehreren Metern Abstand gelesen. */
.jhm-kiosk .jhm-portal-qr-image svg {
	width: 220px;
	height: 220px;
}

.jhm-kiosk .jhm-code {
	font-size: 1.6em;
	letter-spacing: .08em;
}

/* Startnummer der Nachmeldung: gross genug zum Abfotografieren. */
.jhm .jhm-startnumber {
	display: flex;
	align-items: baseline;
	gap: 0.75rem;
	margin: 0 0 1rem;
	padding: 0.75rem 1rem;
	background: var(--jhm-soft);
	border-radius: var(--jhm-radius);
}

.jhm .jhm-startnumber-label {
	font-weight: 600;
}

.jhm .jhm-startnumber-value {
	font-size: 2.6rem;
	line-height: 1;
	letter-spacing: 0.02em;
}

.jhm-kiosk .jhm-startnumber-value {
	font-size: 4rem;
}

@media print {
	.jhm-kiosk-actions { display: none; }
}

/* Dezenter Hinweis auf den vorigen Portalzugriff. */
.jhm .jhm-last-access {
	margin: 0 0 1rem;
	padding: 0.5rem 0.75rem;
	background: var(--jhm-soft);
	border-radius: var(--jhm-radius);
}

/* Anmeldelink an die hinterlegte Adresse, wenn die E-Mail gesperrt ist. */
.jhm .jhm-magic-self {
	margin-top: 0.75rem;
}

.jhm .jhm-input[disabled] {
	background: var(--jhm-soft);
	cursor: not-allowed;
}

/*
 * Abzeichen "Finale ja/nein" in der Uebersicht "Meine Bewertungsboegen".
 *
 * Ohne Klick erkennbar und bewusst nicht allein ueber Farbe: jedes
 * Abzeichen traegt zusaetzlich ein Zeichen und den ausgeschriebenen Text.
 */
.jhm-final-badge {
	display: inline-flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 0.35em;
	padding: 0.25em 0.7em;
	border: 2px solid currentColor;
	border-radius: 999px;
	font-weight: 700;
	font-size: 0.95em;
	line-height: 1.3;
}

.jhm-final-mark { font-weight: 700; }

.jhm-final-badge.is-in {
	color: var(--jhm-ok);
	background: var(--jhm-ok-bg);
}

.jhm-final-badge.is-out {
	color: var(--jhm-muted);
	background: var(--jhm-bg);
	font-weight: 400;
}

.jhm-final-badge.is-pending {
	color: var(--jhm-warn);
	background: var(--jhm-info-bg);
}

.jhm-final-prep {
	display: block;
	width: 100%;
	font-weight: 400;
	font-size: 0.9em;
}
