/* =============================================================================
   BHEProd — Produktions-Portal (MES/PPS)
   Corporate Design: BHE Metalltechnik GmbH & Co. KG

   Aufbau:
   1. Tokens (Marke, Neutral, Status, Typo, Spacing, Radius, Shadow, Z-Index)
   2. Basis (Reset, Typo, Fokus, Reduced Motion)
   3. Shell (Topbar, Logo, Navigation, Main)
   4. Komponenten (Card, Button, Form, Table, Badge, Notice, Board, Modal, Toast)
   5. Views (Station, Login, Auftragsdetail)
   6. Utilities (ersetzen die frueheren Inline-Styles)
   7. Responsive (Tablet / Mobile)

   Regeln:
   - BHE-Blau ist Marken- UND Interaktionsfarbe (Navigation, Buttons, Links, Fokus).
   - Gruen/Amber/Rot sind AUSSCHLIESSLICH Statusfarben und nie Markenflaechen.
   - Status wird nie allein ueber Farbe kommuniziert (immer Text, meist zusaetzlich Punkt).
   - Keine neuen Hex-Werte in Komponenten — nur Tokens verwenden.
   - Ausnahme: --bhp-cust (Kundenkennfarbe) kommt als Datenwert aus PHP.
   ============================================================================= */

/* ---------------------------------------------------------------- 1. Tokens */
:root {
	/* Marke (aus dem BHE-Logo abgeleitet) */
	--bhp-brand-900: #303d91; /* Primaer: Shell, Buttons, aktive Zustaende */
	--bhp-brand-700: #3b539d; /* Hover, sekundaere Markenflaeche */
	--bhp-brand-500: #4871b5; /* Links, Fokus, Fortschritt */
	--bhp-brand-300: #5a90c8; /* Akzente, Icons, Auswahl */
	--bhp-brand-050: #eef2fa; /* Auswahl-/Hover-Flaeche hell */
	--bhp-brand-025: #f4f7fc;

	/* Neutral */
	--bhp-ink: #060606; /* Ueberschriften, kontrastreicher Text */
	--bhp-text: #1c2430; /* Fliesstext */
	--bhp-muted: #55607a; /* Sekundaertext (>= 4.5:1 auf Weiss) */
	--bhp-line: #c1cddc; /* Rahmen, Divider */
	--bhp-line-soft: #dde4ee;
	--bhp-surface: #ffffff; /* Karten, Logo-Flaeche */
	--bhp-surface-2: #f1f4f8; /* Eingaben, Tabellenkopf */
	--bhp-bg: #f7f8f9; /* App-Hintergrund */

	/* Status — nur fuer Zustaende, nie fuer Marke/Navigation */
	--bhp-ok: #1e7a46; /* laeuft / fertig / erfolgreich */
	--bhp-ok-bg: #e6f4ec;
	--bhp-warn: #96590a; /* wartet / bereit / ruesten */
	--bhp-warn-bg: #fdf1de;
	--bhp-danger: #b3261e; /* Fehler / Stoerung / kritisch */
	--bhp-danger-bg: #fbe9e7;
	--bhp-info: var(--bhp-brand-500); /* Information / Auswahl */
	--bhp-info-bg: var(--bhp-brand-050);

	/* Typografie — System-Stack, keine Webfonts */
	--bhp-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--bhp-fs-xs: 0.75rem;
	--bhp-fs-sm: 0.8125rem;
	--bhp-fs-base: 0.9375rem;
	--bhp-fs-md: 1rem;
	--bhp-fs-lg: 1.125rem;
	--bhp-fs-xl: 1.375rem;
	--bhp-fs-2xl: 1.75rem;

	/* Spacing — 4px-Raster */
	--bhp-s1: 0.25rem;
	--bhp-s2: 0.5rem;
	--bhp-s3: 0.75rem;
	--bhp-s4: 1rem;
	--bhp-s5: 1.25rem;
	--bhp-s6: 1.5rem;
	--bhp-s8: 2rem;

	/* Form */
	--bhp-radius: 10px;
	--bhp-radius-sm: 6px;
	--bhp-radius-pill: 999px;
	--bhp-shadow-1: 0 1px 2px rgba(6, 6, 6, 0.06);
	--bhp-shadow-2: 0 6px 20px rgba(6, 6, 6, 0.12);
	--bhp-tap: 44px; /* Mindest-Touchziel */

	/* Z-Index-Skala */
	--bhp-z-header: 20;
	--bhp-z-modal: 50;
	--bhp-z-toast: 60;
}

/* ----------------------------------------------------------------- 2. Basis */
*,
*::before,
*::after {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	padding: 0;
}

.bhp-body {
	background: var(--bhp-bg);
	color: var(--bhp-text);
	font-family: var(--bhp-font);
	font-size: var(--bhp-fs-base);
	line-height: 1.5;
	min-height: 100dvh;
	-webkit-text-size-adjust: 100%;
}

.bhp-body h1,
.bhp-body h2,
.bhp-body h3 {
	color: var(--bhp-ink);
	font-weight: 650;
	letter-spacing: -0.01em;
}

a {
	color: var(--bhp-brand-500);
	text-underline-offset: 2px;
}

a:hover {
	color: var(--bhp-brand-900);
}

/* Zahlen tabellarisch — Mengen, Termine, Prioritaeten, Kennzahlen */
.bhp-num,
.bhp-table .num,
.bhp-stat b,
input[type="number"] {
	font-variant-numeric: tabular-nums;
}

/* Sichtbarer Tastaturfokus auf allen interaktiven Elementen */
:where(a, button, input, select, textarea, [tabindex], .bhp-drag):focus-visible {
	outline: 3px solid var(--bhp-brand-500);
	outline-offset: 2px;
	border-radius: var(--bhp-radius-sm);
}

.bhp-visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.001ms !important;
		scroll-behavior: auto !important;
	}
}

/* ----------------------------------------------------------------- 3. Shell */
.bhp-topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--bhp-s4);
	padding: calc(env(safe-area-inset-top) + var(--bhp-s3)) var(--bhp-s5) var(--bhp-s3);
	background: var(--bhp-brand-900);
	color: #fff;
	position: sticky;
	top: 0;
	z-index: var(--bhp-z-header);
}

/* Logo sitzt auf ruhiger weisser Flaeche — mehrfarbiges SVG, nicht umfaerben. */
.bhp-brand {
	display: inline-flex;
	align-items: center;
	gap: var(--bhp-s3);
	background: var(--bhp-surface);
	border-radius: var(--bhp-radius-sm);
	padding: var(--bhp-s2) var(--bhp-s3);
}

.bhp-brand__logo {
	display: block;
	height: 30px;
	width: auto; /* Seitenverhaeltnis bleibt erhalten */
	max-width: 190px;
}

.bhp-brand__app {
	color: var(--bhp-brand-900);
	font-size: var(--bhp-fs-sm);
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	border-left: 1px solid var(--bhp-line);
	padding-left: var(--bhp-s3);
}

.bhp-topbar__meta {
	display: flex;
	align-items: center;
	gap: var(--bhp-s4);
	font-size: var(--bhp-fs-sm);
	color: #dbe2f2;
}

.bhp-logout {
	display: inline-flex;
	align-items: center;
	min-height: var(--bhp-tap);
	padding: 0 var(--bhp-s3);
	color: #fff;
	text-decoration: none;
	border: 1px solid rgba(255, 255, 255, 0.45);
	border-radius: var(--bhp-radius-sm);
	font-size: var(--bhp-fs-sm);
}

.bhp-logout:hover {
	background: var(--bhp-brand-700);
	color: #fff;
}

/* Navigation — aktiver Tab in BHE-Blau, kein Amber */
.bhp-nav {
	display: flex;
	gap: var(--bhp-s1);
	overflow-x: auto;
	background: var(--bhp-surface);
	border-bottom: 1px solid var(--bhp-line);
	padding: 0 var(--bhp-s5);
	position: sticky;
	top: 0;
	z-index: calc(var(--bhp-z-header) - 1);
}

.bhp-tab {
	display: inline-flex;
	align-items: center;
	min-height: var(--bhp-tap);
	padding: 0 var(--bhp-s4);
	color: var(--bhp-muted);
	text-decoration: none;
	font-weight: 600;
	font-size: var(--bhp-fs-base);
	white-space: nowrap;
	border-bottom: 3px solid transparent;
	transition: color 0.15s ease-out, background-color 0.15s ease-out;
}

.bhp-tab:hover {
	color: var(--bhp-brand-900);
	background: var(--bhp-brand-025);
}

.bhp-tab.is-active {
	color: var(--bhp-brand-900);
	border-bottom-color: var(--bhp-brand-900);
	background: var(--bhp-brand-050);
}

.bhp-main {
	max-width: 40rem;
	margin: 0 auto;
	padding: var(--bhp-s5) var(--bhp-s4) calc(env(safe-area-inset-bottom) + var(--bhp-s8));
}

.bhp-main--wide {
	max-width: 84rem;
}

.bhp-main--full {
	max-width: none;
}

@media (min-width: 768px) {
	.bhp-main--wide,
	.bhp-main--full {
		padding-left: var(--bhp-s6);
		padding-right: var(--bhp-s6);
	}
}

/* ----------------------------------------------------------- 4. Komponenten */
.bhp-card {
	background: var(--bhp-surface);
	border: 1px solid var(--bhp-line);
	border-radius: var(--bhp-radius);
	box-shadow: var(--bhp-shadow-1);
	padding: var(--bhp-s5);
	margin-bottom: var(--bhp-s4);
}

.bhp-hello {
	margin: 0;
	font-size: var(--bhp-fs-xl);
	color: var(--bhp-ink);
}

.bhp-date {
	margin: var(--bhp-s1) 0 0;
	color: var(--bhp-muted);
	font-size: var(--bhp-fs-base);
}

.bhp-label {
	display: block;
	font-size: var(--bhp-fs-xs);
	text-transform: uppercase;
	letter-spacing: 0.07em;
	color: var(--bhp-muted);
	font-weight: 700;
	margin-bottom: var(--bhp-s2);
}

.bhp-hint {
	margin: var(--bhp-s3) 0 0;
	color: var(--bhp-muted);
	font-size: var(--bhp-fs-sm);
	line-height: 1.55;
}

.bhp-h2 {
	font-size: var(--bhp-fs-sm);
	text-transform: uppercase;
	letter-spacing: 0.07em;
	color: var(--bhp-muted);
	margin: 0 0 var(--bhp-s3);
	font-weight: 700;
}

.bhp-empty {
	color: var(--bhp-muted);
	font-style: italic;
	padding: var(--bhp-s3) 0;
}

.bhp-muted {
	color: var(--bhp-muted);
}

.bhp-ok {
	color: var(--bhp-ok);
	font-weight: 600;
}

.bhp-warn {
	color: var(--bhp-warn);
	font-weight: 600;
}

/* Formulare */
.bhp-select,
.bhp-input {
	width: 100%;
	min-height: var(--bhp-tap);
	padding: var(--bhp-s2) var(--bhp-s3);
	font-family: inherit;
	font-size: var(--bhp-fs-base);
	color: var(--bhp-text);
	background: var(--bhp-surface);
	border: 1px solid var(--bhp-line);
	border-radius: var(--bhp-radius-sm);
}

.bhp-select:hover,
.bhp-input:hover {
	border-color: var(--bhp-brand-300);
}

.bhp-select[readonly] {
	background: var(--bhp-surface-2);
	color: var(--bhp-muted);
}

.bhp-select--sm {
	min-height: 36px;
	padding: var(--bhp-s1) var(--bhp-s2);
	font-size: var(--bhp-fs-sm);
}

.bhp-select--num {
	width: 5rem;
	text-align: right;
}

input[type="checkbox"] {
	width: 1.15rem;
	height: 1.15rem;
	accent-color: var(--bhp-brand-900);
}

.bhp-check {
	display: inline-flex;
	align-items: center;
	gap: var(--bhp-s2);
	min-height: var(--bhp-tap);
	font-size: var(--bhp-fs-base);
	color: var(--bhp-text);
}

/* Buttons */
.bhp-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 56px;
	padding: var(--bhp-s3) var(--bhp-s5);
	font-family: inherit;
	font-size: var(--bhp-fs-lg);
	font-weight: 700;
	color: #fff;
	background: var(--bhp-brand-900);
	border: 1px solid transparent;
	border-radius: var(--bhp-radius);
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	transition: background-color 0.15s ease-out;
}

.bhp-btn:hover {
	background: var(--bhp-brand-700);
}

.bhp-btn:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

/* Aktionsbuttons an der Station: Status-Semantik (starten = laeuft, fertig = erledigt) */
.bhp-btn--in {
	background: var(--bhp-brand-900);
}

.bhp-btn--in:hover {
	background: var(--bhp-brand-700);
}

.bhp-btn--out {
	background: var(--bhp-ok);
}

.bhp-btn--out:hover {
	background: #176036;
}

.bhp-btn--ghost {
	background: var(--bhp-surface);
	border-color: var(--bhp-line);
	color: var(--bhp-brand-900);
	text-decoration: none;
	font-size: var(--bhp-fs-md);
}

.bhp-btn--ghost:hover {
	background: var(--bhp-brand-050);
	border-color: var(--bhp-brand-300);
}

.bhp-btn--sm {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: auto;
	min-height: var(--bhp-tap);
	padding: var(--bhp-s2) var(--bhp-s4);
	font-size: var(--bhp-fs-base);
	font-weight: 600;
	color: var(--bhp-brand-900);
	background: var(--bhp-surface);
	border: 1px solid var(--bhp-line);
	border-radius: var(--bhp-radius-sm);
	cursor: pointer;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color 0.15s ease-out, border-color 0.15s ease-out;
}

.bhp-btn--sm:hover {
	background: var(--bhp-brand-050);
	border-color: var(--bhp-brand-300);
	color: var(--bhp-brand-900);
}

.bhp-btn--primary {
	background: var(--bhp-brand-900);
	border-color: var(--bhp-brand-900);
	color: #fff;
}

.bhp-btn--primary:hover {
	background: var(--bhp-brand-700);
	border-color: var(--bhp-brand-700);
	color: #fff;
}

/* Listen (Warteschlangen, Positionen) */
.bhp-log {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: var(--bhp-s2);
}

.bhp-log li {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: var(--bhp-s3);
	padding: var(--bhp-s3);
	background: var(--bhp-surface);
	border: 1px solid var(--bhp-line-soft);
	border-radius: var(--bhp-radius-sm);
	font-size: var(--bhp-fs-base);
}

.bhp-log__empty {
	color: var(--bhp-muted);
	justify-content: flex-start;
	font-style: italic;
}

/* Badges — Status immer mit Text, Farbe nur als Verstaerkung */
.bhp-badge {
	display: inline-flex;
	align-items: center;
	gap: var(--bhp-s1);
	font-size: var(--bhp-fs-xs);
	font-weight: 700;
	padding: 0.15rem 0.5rem;
	border-radius: var(--bhp-radius-pill);
	border: 1px solid transparent;
	white-space: nowrap;
}

.bhp-badge::before {
	content: "";
	width: 0.45rem;
	height: 0.45rem;
	border-radius: 50%;
	background: currentColor;
	flex: none;
}

.bhp-badge--muted {
	color: var(--bhp-muted);
	background: var(--bhp-surface-2);
	border-color: var(--bhp-line);
}

.bhp-badge--info {
	color: var(--bhp-brand-900);
	background: var(--bhp-info-bg);
	border-color: var(--bhp-brand-300);
}

.bhp-badge--ready {
	color: var(--bhp-warn);
	background: var(--bhp-warn-bg);
	border-color: #e6c68a;
}

.bhp-badge--progress {
	color: var(--bhp-ok);
	background: var(--bhp-ok-bg);
	border-color: #a8d3bc;
}

.bhp-badge--prio {
	color: var(--bhp-danger);
	background: var(--bhp-danger-bg);
	border-color: #e8b0ab;
}

/* Notices */
.bhp-notice {
	display: flex;
	gap: var(--bhp-s2);
	background: var(--bhp-ok-bg);
	border: 1px solid #a8d3bc;
	border-left: 4px solid var(--bhp-ok);
	color: #14532d;
	border-radius: var(--bhp-radius-sm);
	padding: var(--bhp-s3) var(--bhp-s4);
	margin-bottom: var(--bhp-s4);
	font-size: var(--bhp-fs-base);
}

.bhp-notice--warn {
	background: var(--bhp-warn-bg);
	border-color: #e6c68a;
	border-left-color: var(--bhp-warn);
	color: #6b3e05;
}

.bhp-notice--err {
	background: var(--bhp-danger-bg);
	border-color: #e8b0ab;
	border-left-color: var(--bhp-danger);
	color: #7d1a15;
}

/* Kennzahlen */
.bhp-stats {
	display: grid;
	gap: var(--bhp-s4);
	grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
	margin-bottom: var(--bhp-s4);
}

.bhp-stat {
	background: var(--bhp-surface);
	border: 1px solid var(--bhp-line);
	border-radius: var(--bhp-radius);
	box-shadow: var(--bhp-shadow-1);
	padding: var(--bhp-s4);
}

.bhp-stat b {
	display: block;
	font-size: var(--bhp-fs-2xl);
	font-weight: 700;
	color: var(--bhp-brand-900);
	line-height: 1.1;
}

.bhp-stat span {
	font-size: var(--bhp-fs-xs);
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--bhp-muted);
	font-weight: 700;
}

/* Board (Plantafel) */
.bhp-board {
	display: grid;
	gap: var(--bhp-s4);
	grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
	align-items: start;
}

.bhp-board__col {
	background: var(--bhp-surface);
	border: 1px solid var(--bhp-line);
	border-radius: var(--bhp-radius);
	box-shadow: var(--bhp-shadow-1);
	padding: var(--bhp-s4);
}

.bhp-board__col--open {
	background: var(--bhp-surface-2);
	border-style: dashed;
}

.bhp-board__col h3 {
	margin: 0 0 var(--bhp-s2);
	font-size: var(--bhp-fs-md);
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: var(--bhp-s2);
}

.bhp-board__count {
	font-size: var(--bhp-fs-xs);
	color: var(--bhp-muted);
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}

.bhp-board__tags {
	display: flex;
	flex-wrap: wrap;
	gap: var(--bhp-s1);
	margin: 0 0 var(--bhp-s3);
}

/* Job-Karte: linker Balken traegt die Kundenkennfarbe (--bhp-cust aus PHP) */
.bhp-jobcard {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: var(--bhp-s3);
	border-left: 4px solid var(--bhp-cust, var(--bhp-brand-500));
}

.bhp-jobcard__main {
	min-width: 0;
}

.bhp-jobcard__meta {
	display: block;
	font-size: var(--bhp-fs-xs);
	font-weight: 700;
	color: var(--bhp-ink);
	margin-bottom: 0.1rem;
}

.bhp-jobcard__dot {
	display: inline-block;
	width: 0.6rem;
	height: 0.6rem;
	border-radius: 50%;
	background: var(--bhp-cust, var(--bhp-brand-500));
	margin-right: 0.35rem;
	vertical-align: baseline;
}

.bhp-jobcard__desc {
	display: block;
	color: var(--bhp-brand-900);
	font-size: var(--bhp-fs-sm);
	margin-top: 0.1rem;
}

.bhp-jobcard__side {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: var(--bhp-s1);
	white-space: nowrap;
}

/* Drag & Drop */
.bhp-drag {
	cursor: grab;
}

.bhp-drag:active {
	cursor: grabbing;
}

.bhp-drag.is-dragging {
	opacity: 0.45;
}

.bhp-drop.is-over {
	outline: 3px dashed var(--bhp-brand-500);
	outline-offset: -4px;
	background: var(--bhp-brand-050);
}

/* Tabellen */
.bhp-table-wrap {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	border: 1px solid var(--bhp-line);
	border-radius: var(--bhp-radius);
	background: var(--bhp-surface);
	box-shadow: var(--bhp-shadow-1);
}

.bhp-table {
	width: 100%;
	border-collapse: collapse;
	font-size: var(--bhp-fs-base);
	min-width: 560px;
}

.bhp-table th,
.bhp-table td {
	padding: var(--bhp-s3);
	text-align: left;
	border-bottom: 1px solid var(--bhp-line-soft);
	vertical-align: top;
}

.bhp-table th {
	font-size: var(--bhp-fs-xs);
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--bhp-muted);
	font-weight: 700;
	background: var(--bhp-surface-2);
	position: sticky;
	top: 0;
	z-index: 1;
}

.bhp-table tr:last-child td {
	border-bottom: none;
}

.bhp-table tbody tr:hover td {
	background: var(--bhp-brand-025);
}

.bhp-table .num {
	text-align: right;
}

.bhp-table__check {
	width: 2.5rem;
}

.bhp-table__toggle {
	width: 2.75rem;
}

/* Aufklapp-Zeile (Auftragspositionen) */
.bhp-toggle {
	background: var(--bhp-surface);
	border: 1px solid var(--bhp-line);
	color: var(--bhp-brand-900);
	border-radius: var(--bhp-radius-sm);
	width: var(--bhp-tap);
	height: var(--bhp-tap);
	line-height: 1;
	cursor: pointer;
	font-size: var(--bhp-fs-sm);
}

.bhp-toggle:hover {
	background: var(--bhp-brand-050);
	border-color: var(--bhp-brand-300);
}

.bhp-pos-row > td {
	background: var(--bhp-surface-2);
	padding: var(--bhp-s2) var(--bhp-s3) var(--bhp-s4);
}

.bhp-pos-row .bhp-table {
	min-width: 0;
	background: transparent;
}

.bhp-pos-row .bhp-table th {
	background: transparent;
}

.bhp-pos-row .bhp-table tbody tr:hover td {
	background: transparent;
}

/* Kundenfarbe */
.bhp-dot {
	display: inline-block;
	width: 0.85rem;
	height: 0.85rem;
	border-radius: 50%;
	border: 1px solid rgba(6, 6, 6, 0.12);
	vertical-align: middle;
}

.bhp-colorpick {
	width: 2.75rem;
	height: var(--bhp-tap);
	padding: 2px;
	background: var(--bhp-surface);
	border: 1px solid var(--bhp-line);
	border-radius: var(--bhp-radius-sm);
	cursor: pointer;
}

/* Modal (Auftrags-Overview) */
.bhp-modal {
	position: fixed;
	inset: 0;
	background: rgba(6, 6, 6, 0.55);
	z-index: var(--bhp-z-modal);
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: 4vh var(--bhp-s4);
	overflow: auto;
}

.bhp-modal[hidden] {
	display: none;
}

.bhp-modal__box {
	background: var(--bhp-surface);
	border: 1px solid var(--bhp-line);
	border-radius: var(--bhp-radius);
	width: 100%;
	max-width: 46rem;
	box-shadow: var(--bhp-shadow-2);
}

.bhp-modal__head {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: var(--bhp-s4);
	padding: var(--bhp-s4) var(--bhp-s5);
	border-bottom: 1px solid var(--bhp-line);
	position: sticky;
	top: 0;
	background: var(--bhp-surface);
	border-radius: var(--bhp-radius) var(--bhp-radius) 0 0;
}

.bhp-modal__title {
	margin: 0;
	font-size: var(--bhp-fs-lg);
	color: var(--bhp-ink);
	display: flex;
	align-items: center;
	gap: var(--bhp-s2);
}

.bhp-modal__close {
	background: var(--bhp-surface);
	border: 1px solid var(--bhp-line);
	color: var(--bhp-ink);
	width: var(--bhp-tap);
	height: var(--bhp-tap);
	border-radius: var(--bhp-radius-sm);
	font-size: var(--bhp-fs-xl);
	line-height: 1;
	cursor: pointer;
}

.bhp-modal__close:hover {
	background: var(--bhp-brand-050);
	border-color: var(--bhp-brand-300);
	color: var(--bhp-brand-900);
}

.bhp-modal__body {
	padding: var(--bhp-s5);
}

.bhp-orderlink {
	cursor: pointer;
	font-weight: 700;
}

/* Toast */
.bhp-toast {
	position: fixed;
	left: 50%;
	bottom: calc(env(safe-area-inset-bottom) + var(--bhp-s5));
	transform: translateX(-50%);
	background: var(--bhp-ink);
	color: #fff;
	border-radius: var(--bhp-radius);
	padding: var(--bhp-s3) var(--bhp-s5);
	font-size: var(--bhp-fs-base);
	font-weight: 600;
	box-shadow: var(--bhp-shadow-2);
	z-index: var(--bhp-z-toast);
	max-width: 90vw;
}

.bhp-toast--err {
	background: var(--bhp-danger);
}

/* ----------------------------------------------------------------- 5. Views */
/* Station (Tablet / Hallen-PC) — grosse Ziele, ruhige Hierarchie */
.bhp-job {
	background: var(--bhp-surface);
	border: 1px solid var(--bhp-line);
	border-left: 6px solid var(--bhp-cust, var(--bhp-brand-500));
	border-radius: var(--bhp-radius);
	box-shadow: var(--bhp-shadow-1);
	padding: var(--bhp-s4);
}

.bhp-job__head {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: var(--bhp-s3);
	flex-wrap: wrap;
}

.bhp-job__customer {
	margin: 0 0 var(--bhp-s1);
	font-size: var(--bhp-fs-md);
	font-weight: 700;
	color: var(--bhp-ink);
}

.bhp-job__order {
	color: var(--bhp-brand-900);
	font-variant-numeric: tabular-nums;
}

.bhp-job__qty {
	font-size: var(--bhp-fs-xl);
	color: var(--bhp-ink);
	font-variant-numeric: tabular-nums;
}

.bhp-job__desc {
	margin: var(--bhp-s2) 0 0;
	font-size: var(--bhp-fs-lg);
	font-weight: 600;
	color: var(--bhp-brand-900);
}

.bhp-job__meta {
	margin: var(--bhp-s2) 0 var(--bhp-s3);
}

.bhp-job__actions {
	display: flex;
	gap: var(--bhp-s3);
	flex-wrap: wrap;
}

.bhp-job__actions .bhp-btn {
	flex: 1 1 10rem;
	min-height: 60px; /* grosszuegiges Touchziel am Arbeitsplatz */
}

.bhp-queue {
	display: grid;
	gap: var(--bhp-s3);
}

.bhp-linkbtn {
	background: none;
	border: none;
	padding: var(--bhp-s1) 0;
	min-height: var(--bhp-tap);
	color: var(--bhp-brand-500);
	font: inherit;
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.bhp-linkbtn:hover {
	color: var(--bhp-brand-900);
}

.bhp-orderdetail {
	background: var(--bhp-surface-2);
	border: 1px solid var(--bhp-line);
	border-radius: var(--bhp-radius-sm);
	padding: var(--bhp-s4);
	margin: 0 0 var(--bhp-s3);
}

/* Mail-Text im Auftragseingang: monospaced, umbrechend, scrollbar */
.bhp-pre {
	margin: var(--bhp-s3) 0 0;
	max-height: 18rem;
	overflow: auto;
	padding: var(--bhp-s3);
	background: var(--bhp-surface);
	border: 1px solid var(--bhp-line-soft);
	border-radius: var(--bhp-radius-sm);
	font-family: ui-monospace, "SFMono-Regular", "Cascadia Code", Consolas, monospace;
	font-size: var(--bhp-fs-sm);
	line-height: 1.5;
	color: var(--bhp-text);
	white-space: pre-wrap;
	word-break: break-word;
}

/* Stiller Text-Button (z. B. „Ohne Auftrag ablegen") */
.bhp-btn--link {
	display: inline-flex;
	align-items: center;
	min-height: var(--bhp-tap);
	padding: 0;
	font-size: var(--bhp-fs-sm);
	font-weight: 600;
	color: var(--bhp-muted);
	background: none;
	border: 0;
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.bhp-btn--link:hover {
	color: var(--bhp-danger);
}

/* Kompakte Stations-Karten: Name = prominentes Feld, Tablet-Setup eingeklappt */
.bhp-station__name {
	font-weight: 700;
	font-size: var(--bhp-fs-md);
	color: var(--bhp-ink);
}

.bhp-station__tablet {
	margin-top: var(--bhp-s3);
	border-top: 1px solid var(--bhp-line-soft);
	padding-top: var(--bhp-s2);
}

.bhp-station__tablet > summary {
	display: inline-flex;
	align-items: center;
	gap: var(--bhp-s2);
	min-height: var(--bhp-tap);
	cursor: pointer;
	font-size: var(--bhp-fs-sm);
	font-weight: 600;
	color: var(--bhp-brand-500);
	list-style: none;
}

.bhp-station__tablet > summary::-webkit-details-marker {
	display: none;
}

.bhp-station__tablet > summary::before {
	content: "\25B8"; /* ▸ */
	font-size: var(--bhp-fs-xs);
	transition: transform 0.15s ease-out;
}

.bhp-station__tablet[open] > summary::before {
	transform: rotate(90deg);
}

/* Klickbare Tabellenzelle (oeffnet Detail-Popup) */
.bhp-cellbtn {
	background: none;
	border: 0;
	padding: 0;
	margin: 0;
	font: inherit;
	font-weight: 700;
	color: var(--bhp-brand-500);
	text-align: left;
	cursor: pointer;
}

.bhp-cellbtn:hover {
	color: var(--bhp-brand-900);
	text-decoration: underline;
}

.bhp-cellbtn--plain {
	font-weight: 400;
	color: var(--bhp-text);
}

.bhp-cellbtn--plain:hover {
	color: var(--bhp-brand-900);
}

/* Definitionsliste im Detail-Popup */
.bhp-deflist {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: var(--bhp-s2) var(--bhp-s4);
	margin: 0;
}

.bhp-deflist dt {
	color: var(--bhp-muted);
	font-size: var(--bhp-fs-sm);
	font-weight: 600;
}

.bhp-deflist dd {
	margin: 0;
	color: var(--bhp-text);
	font-size: var(--bhp-fs-sm);
	word-break: break-word;
}

/* Kompakte Kunden-Aktion: Dropdown + Farbe + OK in einer Zeile statt umbrechend */
.bhp-cust-form {
	flex-wrap: nowrap;
	justify-content: flex-end;
}

.bhp-cust-form .bhp-select {
	flex: 1 1 auto;
	min-width: 7rem;
}

.bhp-cust-form .bhp-colorpick {
	flex: 0 0 auto;
	width: 2.25rem;
	height: 36px;
}

/* Login */
.bhp-login {
	max-width: 26rem;
	margin: 0 auto;
}

.bhp-login__brand {
	background: var(--bhp-surface);
	border: 1px solid var(--bhp-line);
	border-radius: var(--bhp-radius);
	box-shadow: var(--bhp-shadow-1);
	padding: var(--bhp-s6);
	text-align: center;
	margin-bottom: var(--bhp-s4);
}

.bhp-login__logo {
	display: block;
	width: min(260px, 100%);
	height: auto;
	margin: 0 auto var(--bhp-s3);
}

.bhp-login__app {
	margin: 0;
	font-size: var(--bhp-fs-sm);
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--bhp-brand-900);
}

/* --------------------------------------------------------------- 6. Utility */
/* Ersetzen die frueheren Inline-Styles in den PHP-Templates. */
.bhp-u-row {
	display: flex;
	align-items: center;
	gap: var(--bhp-s3);
	flex-wrap: wrap;
}

.bhp-u-row--between {
	justify-content: space-between;
}

.bhp-u-row--end {
	justify-content: flex-end;
}

.bhp-u-row--tight {
	gap: var(--bhp-s2);
}

.bhp-u-row--top {
	align-items: flex-start;
}

.bhp-u-stack {
	display: grid;
	gap: var(--bhp-s3);
}

.bhp-u-grow {
	flex: 1 1 12rem;
	min-width: 0;
}

.bhp-u-grow-2 {
	flex: 2 1 14rem;
	min-width: 0;
}

.bhp-u-start {
	justify-self: start;
}

.bhp-u-nowrap {
	white-space: nowrap;
}

.bhp-u-block {
	display: block;
}

.bhp-u-mt0 {
	margin-top: 0;
}

.bhp-u-mt1 {
	margin-top: var(--bhp-s1);
}

.bhp-u-mt3 {
	margin-top: var(--bhp-s3);
}

.bhp-u-mt4 {
	margin-top: var(--bhp-s4);
}

.bhp-u-mb0 {
	margin-bottom: 0;
}

.bhp-u-mb2 {
	margin-bottom: var(--bhp-s2);
}

.bhp-u-mb3 {
	margin-bottom: var(--bhp-s3);
}

.bhp-u-m0 {
	margin: 0;
}

.bhp-u-w-xs {
	max-width: 6rem;
}

.bhp-u-w-md {
	max-width: 20rem;
}

.bhp-u-sub {
	font-size: var(--bhp-fs-xs);
	color: var(--bhp-muted);
}

/* ------------------------------------------------------------ 7. Responsive */
@media (max-width: 900px) {
	.bhp-topbar {
		padding-left: var(--bhp-s4);
		padding-right: var(--bhp-s4);
	}

	.bhp-nav {
		padding: 0 var(--bhp-s2);
	}

	.bhp-brand__app {
		display: none; /* kompakte Signet-Loesung: nur Logo */
	}

	.bhp-brand__logo {
		height: 26px;
		max-width: 150px;
	}
}

@media (max-width: 640px) {
	.bhp-main,
	.bhp-main--wide,
	.bhp-main--full {
		padding-left: var(--bhp-s3);
		padding-right: var(--bhp-s3);
	}

	.bhp-card {
		padding: var(--bhp-s4);
	}

	.bhp-stats {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.bhp-board {
		grid-template-columns: 1fr; /* kein horizontaler Overflow auf dem Handy */
	}

	.bhp-log li {
		flex-wrap: wrap;
	}

	.bhp-job__actions .bhp-btn {
		flex: 1 1 100%;
	}

	.bhp-modal {
		padding: 0;
	}

	.bhp-modal__box {
		border-radius: 0;
		min-height: 100dvh;
	}

	.bhp-modal__head {
		border-radius: 0;
	}
}
