/* =================== Für Mitarbeiter (Adressenversand + Honorare) =================== */

.mit-trigger { margin-right: 0; }

/* Staff area — persistent left sidebar (module switcher) + content */
.staff-area { display: flex; gap: 1.5rem; align-items: flex-start; }
.staff-area[hidden] { display: none; }
.staff-sidebar {
	flex: none; width: 224px;
	position: sticky; top: 84px;
	display: flex; flex-direction: column; gap: 4px;
}
.staff-nav-item {
	display: flex; align-items: center; justify-content: flex-start; gap: 10px;
	width: 100%; height: auto; text-align: left;
	padding: 9px 12px; border-radius: var(--radius-md);
	background: transparent; border: 1px solid transparent; box-shadow: none;
	color: var(--text-muted); font-size: 0.9375rem; font-weight: 500; cursor: pointer;
}
.staff-nav-item[hidden] { display: none; }
.staff-nav-item svg { flex: none; color: var(--text-faint); }
.staff-nav-item:hover { background: var(--accent); color: var(--text-strong); }
.staff-nav-item.active { background: var(--accent); color: var(--text-strong); border-color: var(--card-border); }
.staff-nav-item.active svg { color: var(--gold); }
.staff-content { flex: 1 1 auto; min-width: 0; }
.staff-content .tab-panel { animation: none; }
@media (max-width: 760px) {
	.staff-area { flex-direction: column; gap: 0.75rem; }
	.staff-sidebar { width: 100%; position: static; flex-direction: row; flex-wrap: wrap; }
	.staff-nav-item { width: auto; }
}

.mit-dashboard-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 16px;
	max-width: 1100px;
}

/* Übersicht (Kennzahlen-Dashboard) — zwei Kachel-Ebenen: gross oben, Kontext unten */
.dash-grid { max-width: 1100px; }
.dash-tier { display: grid; gap: 14px; }
.dash-tier + .dash-tier { margin-top: 14px; }
.dash-tier-primary { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.dash-tier-secondary { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.dash-card {
	background: var(--card-bg);
	border: 1px solid var(--card-border);
	border-radius: var(--radius-xl);
	padding: 20px 22px;
	box-shadow: var(--card-shadow);
	display: flex; flex-direction: column; gap: 8px;
	text-align: left;
	font: inherit;
	color: var(--text-strong);
	min-width: 0;
	/* Neutralize the global `button` styles (fixed 2.25rem height, centered inline-flex,
	   line-height 1) — same counter-overrides as .mit-module-card, else clickable
	   cards collapse to a pill and their content overflows. */
	height: auto;
	line-height: 1.4;
	align-items: stretch;
	justify-content: flex-start;
	white-space: normal;
}
button.dash-card { cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease; }
button.dash-card:hover { border-color: var(--gold-tint-border); box-shadow: var(--shadow-md); }
button.dash-card:focus-visible { border-color: var(--ring); box-shadow: 0 0 0 3px var(--ring-soft); }
.dash-card-head { display: flex; align-items: center; gap: 10px; }
.dash-icon {
	display: inline-flex; align-items: center; justify-content: center;
	width: 38px; height: 38px; flex: 0 0 auto;
	border-radius: var(--radius-lg);
	background: var(--gold-tint); color: var(--gold-strong);
}
.dash-icon svg { display: block; width: 19px; height: 19px; }
.dash-label { font-size: 0.9rem; color: var(--text-muted); min-width: 0; }
.dash-arrow { margin-left: auto; flex: 0 0 auto; color: var(--text-muted); opacity: 0; transform: translateX(-4px); transition: opacity .15s ease, transform .15s ease; }
button.dash-card:hover .dash-arrow, button.dash-card:focus-visible .dash-arrow { opacity: 1; transform: none; }
.dash-value { font-size: 2.3rem; font-weight: 650; line-height: 1.15; letter-spacing: -0.01em; overflow-wrap: anywhere; white-space: pre-line; }
.dash-value-compact { font-size: 1.5rem; }
.dash-tier-secondary .dash-icon { width: 32px; height: 32px; }
.dash-tier-secondary .dash-icon svg { width: 16px; height: 16px; }
.dash-tier-secondary .dash-value { font-size: 1.4rem; }
.dash-sub { font-size: 0.85rem; color: var(--text-muted); margin-top: auto; }
.dash-sync { margin-top: 16px; font-size: 0.85rem; color: var(--text-muted); }
.mit-module-card {
	background: var(--card-bg);
	border: 1px solid var(--card-border);
	border-radius: var(--radius-xl);
	padding: 22px;
	text-align: left;
	cursor: pointer;
	box-shadow: var(--card-shadow);
	transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
	display: flex; flex-direction: column; gap: 10px;
	color: var(--text-strong);
	font: inherit;
	height: auto;
	align-items: stretch;
	white-space: normal;
}
.mit-module-card:hover { border-color: var(--gold-tint-border); box-shadow: var(--shadow-md); }
.mit-module-card:focus-visible { border-color: var(--ring); box-shadow: 0 0 0 3px var(--ring-soft); }
.mit-module-card[hidden] { display: none; }
.mit-module-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 46px;
	height: 46px;
	border-radius: var(--radius-lg);
	background: var(--gold-tint);
	color: var(--gold-strong);
	margin-bottom: 4px;
	transition: background .15s, color .15s;
}
.mit-module-icon svg { display: block; }
.mit-module-card:hover .mit-module-icon { background: var(--gold); color: #4a3a18; }
.mit-module-title { font-family: var(--font-head); font-size: 1.25rem; font-weight: 600; color: var(--text-strong); }
.mit-module-desc { font-size: 0.875rem; color: var(--text-muted); line-height: 1.5; }

.mit-module-header {
	display: flex; gap: 16px; align-items: center;
	margin-bottom: 28px; flex-wrap: wrap;
}
.mit-module-header h1.page-title { margin: 0; flex: 1; }

/* Small screens: stack title above the tabs, smaller text, more breathing room
   between the header (title + tabs) and the content below it. */
@media (max-width: 900px) {
	.mit-module-header { gap: 12px; margin-bottom: 32px; }
	.mit-module-header h1.page-title { flex: 1 1 100%; font-size: 1.6rem; }
	.mit-subtab { padding: 6px 10px; font-size: 13px; }
	.mit-toolbar input[type="search"], .mit-toolbar select { font-size: 13px; }
	.mit-table-wrap table, #admin-table { font-size: 13px; }
	#admin-table th, #admin-table td { padding-left: 6px; padding-right: 6px; }
}

/* Segmented control sub-tabs (shadcn Tabs look) */
.mit-subtabs {
	display: inline-flex; gap: 2px;
	background: var(--muted);
	border: 1px solid var(--card-border);
	border-radius: var(--radius-lg);
	padding: 3px;
}
.mit-subtab, .hon-subtab {
	height: auto;
	padding: 6px 14px; background: transparent; border: 1px solid transparent;
	box-shadow: none; cursor: pointer;
	border-radius: var(--radius-md);
	font-size: 14px; font-weight: 500; color: var(--text-muted);
	transition: background .15s, color .15s, box-shadow .15s;
}
.mit-subtab.active, .hon-subtab.active {
	color: var(--text-strong);
	background: var(--card-bg);
	box-shadow: var(--shadow-xs);
}
.mit-subtab:hover:not(.active), .hon-subtab:hover:not(.active) { color: var(--text-strong); }
.mit-subtab:focus-visible, .hon-subtab:focus-visible { box-shadow: 0 0 0 3px var(--ring-soft); }
/* Sync-Seite: eigene Sub-Tabs, gleiche Optik wie .mit-subtab (aber ohne dessen Klick-Logik). */
.sync-subtab {
	height: auto;
	padding: 6px 14px; background: transparent; border: 1px solid transparent;
	box-shadow: none; cursor: pointer;
	border-radius: var(--radius-md);
	font-size: 14px; font-weight: 500; color: var(--text-muted);
	transition: background .15s, color .15s, box-shadow .15s;
}
.sync-subtab.active { color: var(--text-strong); background: var(--card-bg); box-shadow: var(--shadow-xs); }
.sync-subtab:hover:not(.active) { color: var(--text-strong); }
.sync-subtab:focus-visible { box-shadow: 0 0 0 3px var(--ring-soft); }
.mit-subpanel, .hon-subpanel { display: none; }
.mit-subpanel.active, .hon-subpanel.active { display: block; }

.mit-toolbar { display: flex; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; align-items: center; }
.mit-toolbar input[type="search"], .mit-toolbar select {
	height: 2.25rem;
	padding: 8px 12px; font-size: 14px;
	border: 1px solid var(--input-border); border-radius: var(--radius-md);
	box-shadow: var(--shadow-xs);
	background: var(--input-bg); color: var(--text);
	font-family: inherit;
}
.mit-toolbar input[type="search"]:focus, .mit-toolbar select:focus {
	outline: none; border-color: var(--input-focus); box-shadow: 0 0 0 3px var(--input-focus-ring);
}
.mit-toolbar input[type="search"] { flex: 1 1 280px; max-width: 360px; }

.mit-export-toolbar { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.mit-export-section { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.mit-export-section > select { height: 2.25rem; padding: 8px 12px; font-size: 14px;
	border: 1px solid var(--input-border); border-radius: var(--radius-md);
	box-shadow: var(--shadow-xs); background: var(--input-bg); color: var(--text);
	font-family: inherit; }
.mit-export-section > select:focus { outline: none; border-color: var(--input-focus); box-shadow: 0 0 0 3px var(--input-focus-ring); }
.mit-export-section > #mit-category-filter { flex-wrap: wrap; }
.mit-export-buttons { display: flex; flex-direction: row; align-items: center; gap: 8px; }
.mit-section-label { font-size: 0.8125rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.mit-export-summary { margin-bottom: 0; }
#mit-list-body:not([hidden]) { margin-top: 20px; }

.mit-status { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 12px; }
.mit-table-wrap {
	overflow-x: auto;
	border: 1px solid var(--card-border);
	border-radius: var(--radius-lg);
	box-shadow: var(--card-shadow);
}
#mit-table, #mit-hon-table {
	width: 100%; border-collapse: collapse;
	background: var(--card-bg);
}
#mit-table th, #mit-table td,
#mit-hon-table th, #mit-hon-table td {
	text-align: left; padding: 11px 14px;
	border-bottom: 1px solid var(--section-border);
	font-size: 0.875rem; vertical-align: top;
}
#mit-table tbody tr:last-child td, #mit-hon-table tbody tr:last-child td { border-bottom: none; }
#mit-table tbody tr:hover, #mit-hon-table tbody tr:hover { background: color-mix(in srgb, var(--muted) 60%, transparent); }
#mit-table th, #mit-hon-table th {
	background: var(--muted); font-weight: 500;
	color: var(--text-muted); font-size: 0.8125rem;
	text-transform: none; letter-spacing: 0;
}

.badge-Bezahlt, .badge-active { background: rgb(220 252 231); color: rgb(22 101 52); border-color: rgb(187 247 208); }
.badge-Offen, .badge-trial, .badge-future { background: rgb(255 243 214); color: rgb(138 90 0); border-color: rgb(253 230 138); }
.badge-Storniert, .badge-cancelled_from_dunning, .badge-dunning, .badge-inactive { background: rgb(253 232 232); color: rgb(161 48 48); border-color: rgb(254 202 202); }
:root.dark .badge-Bezahlt, :root.dark .badge-active { background: rgb(26 58 42); color: rgb(121 217 164); }
:root.dark .badge-Offen, :root.dark .badge-trial, :root.dark .badge-future { background: rgb(58 46 16); color: rgb(240 195 114); }
:root.dark .badge-Storniert, :root.dark .badge-cancelled_from_dunning, :root.dark .badge-dunning, :root.dark .badge-inactive { background: rgb(58 26 26); color: rgb(242 154 154); }

.mit-hon-totals { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.mit-hon-totals .pill {
	background: var(--card-bg); border: 1px solid var(--card-border);
	padding: 12px 16px; border-radius: var(--radius-xl); font-size: 0.875rem;
	box-shadow: var(--card-shadow);
}
.mit-hon-totals .pill strong { display: block; font-size: 1.25rem; color: var(--text-strong); }

.mit-category-filter {
	display: flex; gap: 4px; align-items: center;
}
.mit-category-filter label {
	display: inline-flex; align-items: center; gap: 6px;
	padding: 4px 8px; font-size: 0.875rem; border-radius: var(--radius-sm); cursor: pointer;
}
.mit-category-filter label:hover { background: var(--accent); }
.mit-category-filter.status-filter { flex-wrap: wrap; }
.mit-category-filter.status-filter label { text-transform: capitalize; }

/* Abonnenten per-person rows: name + Zoho link, compact abo chips, selection column */
.col-sel { width: 1%; white-space: nowrap; text-align: center; padding-right: 0; }
.col-sel input { cursor: pointer; width: 16px; height: 16px; vertical-align: middle; }
.subs-person { display: inline-flex; align-items: center; gap: 2px; }
.subs-person-name { font-weight: 500; color: var(--text-strong); }
.subs-person-email { margin-top: 1px; }
.abo-list { display: flex; align-items: center; gap: 4px; flex-wrap: nowrap; overflow: hidden; }
.abo-chip {
	flex: 0 1 auto; min-width: 0; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
	font-size: 0.72rem; line-height: 1.5; padding: 1px 7px; border-radius: 999px;
	background: var(--accent); color: var(--text-strong); border: 1px solid var(--card-border);
}
.abo-more { flex: none; font-size: 0.72rem; color: var(--text-faint); white-space: nowrap; }

/* Bulk-action bar (appears when people are checked) */
.subs-actions {
	display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px;
	padding: 10px 14px; border-radius: var(--radius-md);
	background: var(--accent); border: 1px solid var(--card-border);
}
.subs-actions[hidden] { display: none; }
.subs-actions-count { font-size: 0.9rem; color: var(--text-strong); }
.subs-actions select { font-size: 0.875rem; }
.subs-actions .link { margin-left: auto; }
#subs-action-status { flex-basis: 100%; }
/* Second floating progress badge stacks above the import one when both run */
.bulk-activity { bottom: 70px; }

/* Icon + label buttons (icons replace the old emojis) */
.has-icon { display: inline-flex; align-items: center; gap: 6px; }
.has-icon svg { flex: none; }

/* Collapsible additive filter builder (Abonnenten) */
.filter-toggle.has-active { color: var(--text-strong); font-weight: 600; }
.filter-panel {
	display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px;
	background: var(--card-bg); border: 1px solid var(--card-border);
	border-radius: var(--radius-md); padding: 12px 14px; box-shadow: var(--shadow-xs);
}
.filter-panel[hidden] { display: none; }
.filter-rows { display: flex; flex-direction: column; gap: 8px; }
.filter-rows:empty { display: none; }
.filter-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-row .cs--filter-conn { min-width: 88px; }
.filter-row .filter-conn-spacer { flex: none; width: 88px; }
.filter-row .cs--filter-cat { min-width: 150px; }
.filter-row .cs--filter-op { min-width: 104px; }
.filter-row .cs--filter-val { min-width: 220px; flex: 1 1 220px; max-width: 360px; }
.filter-remove {
	flex: none; width: 2rem; height: 2rem; padding: 0; line-height: 1;
	display: inline-flex; align-items: center; justify-content: center;
	border: 1px solid var(--card-border); border-radius: var(--radius-md);
	background: var(--card-bg); color: var(--text-muted); cursor: pointer;
}
.filter-remove:hover { color: var(--danger, #c0392b); border-color: var(--danger, #c0392b); }
.filter-add { align-self: flex-start; }

.mit-settings-grid {
	/* Single column: Produkte on top, the other modules (Status-Filter, Interne
	   Verteilung, E-Mails) stacked below it. */
	display: grid; grid-template-columns: 1fr;
	gap: 24px; margin-bottom: 16px; align-items: start; /* don't stretch short blocks to full height */
	max-width: 720px;
}
.mit-settings-block {
	background: var(--card-bg); padding: 16px;
	border-radius: var(--radius-xl); border: 1px solid var(--card-border);
	box-shadow: var(--card-shadow);
}
.mit-settings-header { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }

.mit-options { display: flex; flex-direction: column; gap: 6px; }
.mit-options .option {
	display: flex; align-items: center; gap: 10px;
	padding: 6px 8px; border-radius: var(--radius-sm); font-size: 0.875rem; cursor: pointer;
}
.mit-options .option:hover { background: var(--accent); }

.mit-subhead { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); margin: 16px 0 8px; }
.mit-subhead:first-of-type { margin-top: 6px; }
/* Export-Produkte rows: Name + Abkürzung + remove. */
.ep-line { display: grid; grid-template-columns: 1fr 90px auto auto; gap: 14px; align-items: center; }
.ep-move { display: inline-flex; flex-direction: column; gap: 0; }
/* Compact arrows: override the global button height (2.25rem) so the two stack tightly and keep rows short. */
.ep-arrow { height: 14px; min-height: 0; padding: 0 6px; font-size: 9px; line-height: 1; border: none; background: transparent; box-shadow: none; color: var(--text-muted); cursor: pointer; border-radius: var(--radius-sm); }
.ep-arrow:hover:not(:disabled) { color: var(--text-strong); background: var(--accent); }
.ep-arrow:disabled { opacity: .25; cursor: default; }
.ep-line [data-remove-ep] { height: auto; min-height: 0; border: none; background: transparent; box-shadow: none; cursor: pointer; padding: 3px 8px; color: var(--destructive); font-size: 17px; line-height: 1; border-radius: var(--radius-sm); }
.ep-line [data-remove-ep]:hover { background: var(--accent); }
.ep-line input { height: 2rem; padding: 6px 8px; font-size: 13px; min-width: 0; border: 1px solid var(--input-border); border-radius: var(--radius-md); box-shadow: var(--shadow-xs); background: var(--input-bg); color: var(--text); font-family: inherit; }
.ep-line input[data-ep="code"] { text-align: center; text-transform: uppercase; font-family: var(--font-mono); }
.ep-line input:focus { outline: none; border-color: var(--input-focus); box-shadow: 0 0 0 3px var(--input-focus-ring); }
.mit-product-codes { display: flex; flex-direction: column; gap: 0; }
/* Flat list row: [× entfernen] · [Name/Code] · [Zuordnungs-Dropdown] — same
   layout whether the row is a whole product or a single plan. */
.pc-row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(150px, 230px) auto;
	align-items: center; gap: 10px;
	padding: 10px 6px; border-bottom: 1px solid var(--section-border);
}
.pc-row:last-child { border-bottom: none; }
.pc-row select { width: 100%; min-width: 0; }
.mit-product-codes .product-row {
	display: block;
	padding: 12px 6px; border-bottom: 1px solid var(--section-border);
}
.mit-product-codes .product-head {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(150px, 230px) 2rem;
	align-items: center; gap: 12px;
}
.mit-product-codes .product-head select { width: 100%; min-width: 0; }
.mit-product-codes .product-head .pc-perplan-hint {
	font-size: 12px; font-style: italic; text-align: right; align-self: center;
}
/* Plan row: [× entfernen] · [Name/Code] · [Zuordnungs-Dropdown]. */
.plan-row {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) minmax(150px, 230px);
	align-items: center; gap: 10px;
}
.plan-remove {
	width: 22px; height: 22px; padding: 0; flex: 0 0 auto;
	display: inline-flex; align-items: center; justify-content: center;
	border: none; background: transparent; box-shadow: none; cursor: pointer;
	font-size: 18px; line-height: 1; color: var(--text-faint);
	border-radius: var(--radius-sm);
}
.plan-remove:hover { color: var(--destructive); background: var(--destructive-soft); }
.mit-product-codes .product-name { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.product-name .product-title {
	font-size: 14px; font-weight: 600; color: var(--text-strong);
	overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.product-name .plan-count { font-size: 11px; color: var(--text-faint); }
.plan-toggle-bar {
	display: flex; align-items: center; gap: 8px; width: 100%;
	margin: 10px 0 2px; padding: 7px 12px;
	border: 1px dashed var(--input-border); border-radius: var(--radius-md);
	background: transparent; color: var(--text-muted); cursor: pointer;
	font-size: 12px; font-family: inherit; text-align: left; box-shadow: none;
}
.plan-toggle-bar:hover { color: var(--text); border-color: var(--text-muted); background: var(--input-bg); }
.plan-toggle-bar .chev { font-size: 13px; line-height: 1; }
.prod-spacer { display: inline-block; width: 22px; flex: 0 0 auto; }
.prod-plans {
	margin: 8px 0 2px; padding: 2px 0 2px 16px;
	border-left: 2px solid var(--section-border);
	display: flex; flex-direction: column; gap: 9px;
}
.prod-plans[hidden] { display: none; }
.plan-text { min-width: 0; display: flex; flex-direction: column; gap: 1px; line-height: 1.3; }
.plan-text .plan-name {
	font-size: 13px; color: var(--text);
	overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.plan-text .plan-code {
	font-family: var(--font-mono); font-size: 11px; color: var(--text-faint);
	overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.plan-row.plan-off .plan-text { opacity: 0.4; }
.plan-row select[data-plan-export] {
	width: 100%; min-width: 0; height: 1.85rem; padding: 3px 8px; font-size: 12px;
}
.mit-add-product {
	margin-top: 12px; height: 2rem; padding: 6px 8px; font-size: 13px;
	border: 1px solid var(--input-border); border-radius: var(--radius-md);
	background: var(--input-bg); color: var(--text); font-family: inherit;
}
.mit-add-product:disabled { opacity: 0.5; }
/* Kommentar (Standard): free-text line for the PDF — full width so the whole comment is visible. */
.mit-comment-input { display: block; width: 100%; box-sizing: border-box; }
/* "For Goetheanum internal use only" caption above the internal-distribution block. */
.mit-internal-note {
	margin: 24px 0 -4px; font-family: var(--font-head); font-size: 0.75rem;
	font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
	color: var(--gold-strong, #e0a23f);
}

/* «+ Produkt aus Zoho» — custom dropdown with expandable tarif lists per product. */
.zp-wrap { position: relative; }
.zp-btn {
	width: 100%; display: flex; align-items: center; justify-content: space-between;
	gap: 8px; cursor: pointer; text-align: left;
}
.zp-btn .zp-caret { color: var(--text-faint); transition: transform 0.15s; }
.zp-btn.zp-btn-open .zp-caret { transform: rotate(180deg); }
.zp-panel {
	position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px);
	max-height: 340px; overflow-y: auto;
	background: var(--card-bg); border: 1px solid var(--card-border);
	border-radius: var(--radius-md); box-shadow: var(--card-shadow), 0 12px 32px rgb(0 0 0 / 0.35);
	padding: 4px;
}
.zp-panel[hidden] { display: none; }
.zp-row {
	width: 100%; display: flex; align-items: center; gap: 8px;
	border: none; background: transparent; color: var(--text); font-family: inherit;
	font-size: 13px; padding: 8px 10px; border-radius: var(--radius-sm);
	cursor: pointer; text-align: left;
}
.zp-row:hover:not(:disabled) { background: var(--accent); }
.zp-row:disabled { opacity: 0.45; cursor: default; }
.zp-row .zp-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zp-row .zp-chev { width: 14px; color: var(--text-faint); font-size: 12px; }
.zp-row .zp-badge {
	flex: none; font-size: 11px; color: var(--text-faint);
	border: 1px solid var(--card-border); border-radius: 999px; padding: 1px 8px;
}
.zp-head { font-weight: 600; }
.zp-plans {
	margin: 0 0 4px 0; padding: 2px 0 2px 20px;
	border-left: 2px solid var(--card-border); margin-left: 16px;
}
.zp-plan { font-size: 12.5px; padding: 6px 10px; }
.zp-empty { padding: 10px; }

/* Status-Filter as chips: only chosen statuses, one line, + Hinzufügen dropdown. */
.status-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.status-chip { display: inline-flex; align-items: center; gap: 0; }
/* The × lives INSIDE the coloured badge — one self-contained tag. */
.status-chip .badge { gap: 4px; padding-right: 0.3125rem; }
.status-chip-label { display: inline-flex; align-items: center; }
.status-chip-x {
	border: none; background: transparent; cursor: pointer; color: currentColor;
	opacity: .55; font-size: 13px; line-height: 1; padding: 0; margin: 0;
	border-radius: 999px; display: inline-flex; align-items: center;
}
.status-chip-x:hover { opacity: 1; color: var(--destructive, #c0392b); }
.status-add-wrap { display: inline-flex; }
.status-add-panel { min-width: 260px; left: auto; right: auto; }
.status-add-panel .zp-row { gap: 0; }

/* Interne Verteilung — add-lines list: Produkt + Anzahl + Beschreibung per line. */
.mit-internal-list { display: flex; flex-direction: column; gap: 8px; }
.id-line, .iv-line { display: grid; grid-template-columns: minmax(0,1.3fr) minmax(0,1.4fr) 56px auto; gap: 8px; align-items: center; }
.iv-line { margin: 6px 0; }
.id-line select, .id-line input, .iv-line select, .iv-line input {
	height: 2rem; padding: 6px 8px; font-size: 13px; min-width: 0;
	border: 1px solid var(--input-border); border-radius: var(--radius-md);
	box-shadow: var(--shadow-xs); background: var(--input-bg); color: var(--text); font-family: inherit;
}
.id-line input[type="number"], .iv-line input[type="number"] { text-align: center; font-family: var(--font-mono); }
.id-line select:focus, .id-line input:focus, .iv-line select:focus, .iv-line input:focus { outline: none; border-color: var(--input-focus); box-shadow: 0 0 0 3px var(--input-focus-ring); }
.id-line .icon-btn, .iv-line .icon-btn { border: none; background: transparent; box-shadow: none; cursor: pointer; padding: 2px 6px; color: var(--destructive); font-size: 16px; line-height: 1; }
/* Externe Verteilung: gleiche Zeilen-Optik wie die Interne Verteilung. */
.ed-line { display: grid; grid-template-columns: minmax(0,1.3fr) minmax(0,1.4fr) 56px auto; gap: 8px; align-items: center; margin: 6px 0; }
.ed-line select, .ed-line input { height: 2rem; padding: 6px 8px; font-size: 13px; min-width: 0; border: 1px solid var(--input-border); border-radius: var(--radius-md); box-shadow: var(--shadow-xs); background: var(--input-bg); color: var(--text); font-family: inherit; }
.ed-line input[type="number"] { text-align: center; font-family: var(--font-mono); }
.ed-line select:focus, .ed-line input:focus { outline: none; border-color: var(--input-focus); box-shadow: 0 0 0 3px var(--input-focus-ring); }
.ed-line .icon-btn { border: none; background: transparent; box-shadow: none; cursor: pointer; padding: 2px 6px; color: var(--destructive); font-size: 16px; line-height: 1; }
.iv-footer { margin-top: 8px; display: flex; align-items: center; gap: 12px; font-size: 12px; min-height: 1.2em; }
.iv-footer a { color: var(--accent); }
.iv-saved { color: var(--text-muted); opacity: 0; transition: opacity .2s; }
.iv-saved.show { opacity: 1; }
.pv-internal-headrow { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.pv-reset { font-size: 12px; color: var(--accent); white-space: nowrap; }
.iv-group { margin-top: 12px; }
.iv-group-head { font-style: italic; font-weight: 600; margin-bottom: 4px; }
.iv-remaining { font-weight: 600; margin-top: 4px; }
/* Feste, automatisch aus Notion befüllte Zeile (z. B. Extra-Auflage Redaktion) — nicht editierbar. */
.iv-fixed { margin-top: 4px; color: var(--text-muted); }
.iv-fixed-val { font-variant-numeric: tabular-nums; }
.pv-kommentar-input {
	width: 100%; height: 2rem; padding: 6px 8px; font-size: 13px; margin-top: 6px;
	border: 1px solid var(--input-border); border-radius: var(--radius-md);
	box-shadow: var(--shadow-xs); background: var(--input-bg); color: var(--text); font-family: inherit;
}
.pv-kommentar-input:focus { outline: none; border-color: var(--input-focus); box-shadow: 0 0 0 3px var(--input-focus-ring); }
/* Standalone add buttons reuse the SAME mini component as the tag-picker add button
   (.tp-add): identical dashed pill. .btn-add-line only adds the block spacing below a
   list — the visual comes entirely from .tp-add, so there is ONE source of truth. */
.btn-add-line { margin-top: 10px; }
.mit-product-codes .product-row:last-child { border-bottom: none; }
.mit-product-codes input[type="text"] {
	width: 80px; height: 2rem; padding: 6px 8px; font-size: 13px;
	font-family: var(--font-mono);
	border: 1px solid var(--input-border); border-radius: var(--radius-md);
	box-shadow: var(--shadow-xs);
	background: var(--input-bg); color: var(--text);
	text-align: center; text-transform: uppercase;
}
.mit-product-codes input[type="text"]:focus { outline: none; border-color: var(--input-focus); box-shadow: 0 0 0 3px var(--input-focus-ring); }
.mit-product-codes select {
	height: 2rem; padding: 6px 8px; font-size: 13px;
	border: 1px solid var(--input-border); border-radius: var(--radius-md);
	box-shadow: var(--shadow-xs);
	background: var(--input-bg); color: var(--text); min-width: 160px;
	font-family: inherit;
}

/* "Sync prüfen" — non-prominent cache verification control */
.check-sync { white-space: nowrap; }
.check-sync-result {
	display: inline-flex; align-items: center; gap: 6px;
	font-size: 0.8125rem; color: var(--text-muted);
}
.check-sync-result .spinner { width: 12px; height: 12px; border-width: 2px; margin: 0; }
.check-sync-result .check-ok { color: var(--text-muted); }
.check-sync-result .check-all { font-size: 0.8125rem; }

/* Login-Admin sync bar + table controls */
.admin-syncbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.admin-syncbar .spinner { border-color: currentColor; border-right-color: transparent; }
.admin-role {
	height: 2rem; padding: 6px 8px; font-size: 13px;
	border: 1px solid var(--input-border); border-radius: var(--radius-md);
	box-shadow: var(--shadow-xs);
	background: var(--input-bg); color: var(--text); font-family: inherit;
}
.admin-role:focus { outline: none; border-color: var(--input-focus); box-shadow: 0 0 0 3px var(--input-focus-ring); }
/* Berechtigungen: module access as compact toggle chips (replaces 8 separate columns). */
.admin-mods-cell { min-width: 240px; max-width: 400px; }
.admin-mod-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-mod-chip {
	display: inline-flex; align-items: center; gap: 6px;
	padding: 3px 10px 3px 8px; border-radius: 999px;
	border: 1px solid var(--card-border); background: var(--muted);
	font-size: 12px; line-height: 1.4; color: var(--text-muted);
	cursor: pointer; user-select: none;
	transition: background .12s, color .12s, border-color .12s;
}
.admin-mod-chip .admin-mod {
	position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none;
}
.admin-mod-chip::before {
	content: ''; width: 13px; height: 13px; flex: none; box-sizing: border-box;
	border: 1.5px solid var(--input-border); border-radius: 4px; background: var(--input-bg);
	transition: background .12s, border-color .12s;
}
.admin-mod-chip:has(.admin-mod:checked) {
	background: var(--gold-tint); border-color: var(--gold-tint-border); color: var(--text-strong);
}
.admin-mod-chip:has(.admin-mod:checked)::before {
	border-color: var(--gold-strong); background-color: var(--gold-strong);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M2.5 6.2l2.2 2.3 4.8-5'/%3E%3C/svg%3E");
	background-size: 11px 11px; background-position: center; background-repeat: no-repeat;
}
.admin-mod-chip:has(.admin-mod:disabled) { cursor: default; opacity: .55; }
.admin-mod-chip:hover:not(:has(.admin-mod:disabled)) { border-color: var(--input-focus); }
.admin-mod-chip:has(.admin-mod:focus-visible) { box-shadow: 0 0 0 3px var(--ring-soft); }
#admin-table td { vertical-align: middle; }
.admin-save { height: 2rem; padding: 0.4rem 0.875rem; font-size: 0.75rem; }
.admin-rowstatus { margin-left: 8px; white-space: nowrap; }

/* Admin-Tools sub-tabs keep the segmented-control pill look. */
.admin-subtabs { display: inline-flex; }

/* Settings sub-tabs — minimalist, full-bleed underline bar. One row, horizontally
   scrollable with soft edge fades; the active section gets a gold underline. This
   replaces the old segmented pill (which overflowed / had to stack). */
.settings-subtabs {
	flex: 1 1 100%;
	display: flex; flex-wrap: nowrap; gap: 0;
	margin: 4px calc(-1 * var(--app-pad)) 0;
	padding: 0 var(--app-pad);
	border-bottom: 1px solid var(--card-border);
	overflow-x: auto; overflow-y: hidden;
	scrollbar-width: none; -webkit-overflow-scrolling: touch;
	-webkit-mask-image: linear-gradient(to right, transparent, #000 var(--app-pad), #000 calc(100% - var(--app-pad)), transparent);
	        mask-image: linear-gradient(to right, transparent, #000 var(--app-pad), #000 calc(100% - var(--app-pad)), transparent);
}
.settings-subtabs::-webkit-scrollbar { display: none; }
.settings-subtabs .admin-subtab {
	flex: 0 0 auto; height: auto;
	margin: 0; padding: 12px 16px 13px;
	background: none; border: none; border-bottom: 2px solid transparent;
	border-radius: 0; box-shadow: none; cursor: pointer;
	font-size: 14px; font-weight: 500; white-space: nowrap; color: var(--text-muted);
	transition: color .15s, border-color .15s;
}
.settings-subtabs .admin-subtab:hover:not(.active) { color: var(--text-strong); background: none; }
.settings-subtabs .admin-subtab.active {
	color: var(--text-strong); background: none; box-shadow: none;
	border-bottom-color: var(--gold-strong);
}
.settings-subtabs .admin-subtab:focus-visible { color: var(--text-strong); border-bottom-color: var(--ring); }
/* Admin Tools sub-tabs (Import / Bereinigung) — same look as admin sub-tabs */
.tools-subtab {
	height: auto; padding: 6px 14px; background: transparent; border: 1px solid transparent;
	box-shadow: none; cursor: pointer; border-radius: var(--radius-md);
	font-size: 14px; font-weight: 500; color: var(--text-muted);
	transition: background .15s, color .15s, box-shadow .15s;
}
.tools-subtab.active { color: var(--text-strong); background: var(--card-bg); box-shadow: var(--shadow-xs); }
.tools-subtab:hover:not(.active) { color: var(--text-strong); }
.tools-subpanel { display: none; }
.tools-subpanel.active { display: block; }
.sync-subpanel { display: none; }
.sync-subpanel.active { display: block; }

/* Generic admin/list tables — one harmonized look for every staff list
   (Abonnenten/Kunden, Rechnungen, Produkte, Pläne, plus the Notion-Listen and
   Zahlungen). All share: header band, row padding, hover, borderless last row and
   the leading selection column. */
#subs-table, #prods-table, #plans-table, #inv-table,
#nart-table, #naut-table, #nkun-table, #zlist-table {
	width: 100%; border-collapse: collapse;
	background: var(--card-bg); font-size: 0.875rem;
}
#subs-table th, #prods-table th, #plans-table th, #inv-table th,
#nart-table th, #naut-table th, #nkun-table th, #zlist-table th,
#subs-table td, #prods-table td, #plans-table td, #inv-table td,
#nart-table td, #naut-table td, #nkun-table td, #zlist-table td {
	text-align: left; padding: 11px 14px;
	border-bottom: 1px solid var(--section-border); vertical-align: middle;
}
#subs-table tbody tr:last-child td, #prods-table tbody tr:last-child td,
#plans-table tbody tr:last-child td, #inv-table tbody tr:last-child td,
#nart-table tbody tr:last-child td, #naut-table tbody tr:last-child td,
#nkun-table tbody tr:last-child td, #zlist-table tbody tr:last-child td { border-bottom: none; }
#subs-table th, #prods-table th, #plans-table th, #inv-table th,
#nart-table th, #naut-table th, #nkun-table th, #zlist-table th {
	background: var(--muted); font-weight: 500;
	color: var(--text-muted); font-size: 0.8125rem;
}
#subs-table tbody tr:hover, #prods-table tbody tr:hover,
#plans-table tbody tr:hover, #inv-table tbody tr:hover,
#nart-table tbody tr:hover, #naut-table tbody tr:hover,
#nkun-table tbody tr:hover, #zlist-table tbody tr:hover { background: color-mix(in srgb, var(--muted) 60%, transparent); }
/* Right-aligned numeric cells keep their alignment even under the generic rule above. */
#nart-table td.num, #naut-table td.num, #nkun-table td.num, #zlist-table td.num,
#nart-table th.num, #naut-table th.num, #nkun-table th.num, #zlist-table th.num { text-align: right; }

/* Dialog — shadcn modal */
.mit-dialog {
	position: fixed; inset: 0; background: rgba(0,0,0,.6);
	display: flex; align-items: center; justify-content: center; z-index: 50;
	animation: overlay-in .2s ease both;
}
.mit-dialog[hidden] { display: none; }
.mit-dialog-card {
	background: var(--card-bg); color: var(--text);
	padding: 24px; border-radius: var(--radius-xl);
	border: 1px solid var(--card-border);
	width: min(780px, 96vw); max-height: 92vh; overflow-y: auto;
	box-shadow: var(--shadow-lg);
	animation: dialog-in .2s cubic-bezier(.2,.7,.2,1) both;
}
.mit-dialog-card h2 {
	font-family: var(--font-head); font-size: 1.125rem; font-weight: 600;
	text-transform: none; letter-spacing: 0; color: var(--text-strong); margin: 0 0 12px;
}
.mit-dialog-grid {
	display: grid; grid-template-columns: 1.6fr 1fr; gap: 12px;
}
.mit-issue-grid { grid-template-columns: 1.6fr 1fr 1fr; align-items: end; }
/* Read-only values (Ausgabe / Datum / Seitenanzahl) — shown as plain text, NOT as edit fields. */
.mit-readonly {
	height: 2.25rem; display: flex; align-items: center;
	padding: 8px 2px; font-size: 14px; font-weight: 600;
	border: none; background: transparent; color: var(--text-strong); font-variant-numeric: tabular-nums;
}
.mit-dialog-grid select, .mit-dialog-grid input {
	height: 2.25rem; padding: 8px 10px; font-size: 14px;
	border: 1px solid var(--input-border); border-radius: var(--radius-md);
	box-shadow: var(--shadow-xs);
	background: var(--input-bg); color: var(--text); width: 100%;
	font-family: inherit;
}
.mit-dialog-grid select:focus, .mit-dialog-grid input:focus { outline: none; border-color: var(--input-focus); box-shadow: 0 0 0 3px var(--input-focus-ring); }
.mit-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.mit-field input { height: 2.25rem; padding: 8px 12px; font-size: 14px; border: 1px solid var(--input-border); border-radius: var(--radius-md); box-shadow: var(--shadow-xs); background: var(--input-bg); color: var(--text); }
.mit-ausgabe-blocks { display: flex; flex-direction: column; gap: 16px; margin-top: 12px; }
.ausgabe-block {
	border: 1px solid var(--card-border); border-radius: var(--radius-lg);
	padding: 12px 14px; background: var(--sub-bg);
}
.ausgabe-block h3 { font-size: 14px; margin: 0 0 8px; color: var(--text-strong); }
.ausgabe-block .field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; margin: 0; }
.ausgabe-block .field > span { color: var(--text-muted); }
.ausgabe-block .row { display: grid; grid-template-columns: 1fr 90px auto; gap: 8px; align-items: center; margin-bottom: 6px; }
.ausgabe-block input[type="text"], .ausgabe-block input[type="number"] {
	height: 2rem; padding: 6px 8px; font-size: 13px; border: 1px solid var(--input-border); border-radius: var(--radius-md);
	box-shadow: var(--shadow-xs);
	background: var(--input-bg); color: var(--text); width: 100%;
}
.ausgabe-block input:focus { outline: none; border-color: var(--input-focus); box-shadow: 0 0 0 3px var(--input-focus-ring); }
.ausgabe-block input[type="number"] { text-align: right; font-variant-numeric: tabular-nums; }
.ausgabe-block .block-grid { display: grid; grid-template-columns: 1fr 90px; gap: 8px; margin-bottom: 8px; }
.ausgabe-block .auto-stat { display: flex; justify-content: space-between; font-size: 13px; padding: 4px 0; color: var(--text-muted); }
.ausgabe-block .icon-btn { height: auto; border: none; background: transparent; box-shadow: none; cursor: pointer; padding: 2px 6px; color: var(--destructive); font-size: 16px; line-height: 1; }
.ausgabe-block .add-line {
	height: auto;
	background: transparent; border: 1px dashed var(--card-border); color: var(--text-muted);
	padding: 4px 10px; font-size: 12px; border-radius: var(--radius-md); margin-top: 4px; cursor: pointer;
	box-shadow: none;
}
.ausgabe-block .add-line:hover { background: var(--accent); color: var(--text); }
/* Export dialog: read-only preview that mirrors the exported PDF. */
#mit-preview { max-width: 620px; }
.pv-title { font-weight: 700; font-size: 15px; margin: 2px 0 14px; }
.pv-subtitle { display: block; font-weight: 400; font-size: 0.85em; color: var(--text-muted); margin-top: 3px; }
.pv-block { border: 1px solid var(--card-border); border-radius: var(--radius-lg); padding: 12px 14px; }
.pv-block h3 { margin: 0 0 2px; font-size: 14px; }
.pv-sub { color: var(--text-muted); font-size: 12px; margin-bottom: 8px; }
.pv-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding: 3px 0; font-variant-numeric: tabular-nums; }
.pv-total { border-top: 1px solid var(--section-border); margin-top: 4px; padding-top: 6px; font-weight: 700; }
.pv-internal { background: var(--muted); }
.pv-internal-note { font-style: italic; color: var(--text-muted); font-size: 12px; }
.pv-internal-head { font-weight: 700; margin: 2px 0 6px; }
.mit-dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
/* Confirmation dialog: compact card + destructive confirm button. */
.mit-confirm-card { width: min(420px, 94vw); }
.mit-confirm-card .hint { margin: 0 0 4px; color: var(--text); }
.mit-confirm-card .hint[hidden] { display: none; }
.app-modal-input { width: 100%; height: 2.25rem; margin-top: 10px; padding: 8px 12px; font-size: 14px; border: 1px solid var(--input-border); border-radius: var(--radius-md); box-shadow: var(--shadow-xs); background: var(--input-bg); color: var(--text); font-family: inherit; }
.app-modal-input:focus { outline: none; border-color: var(--input-focus); box-shadow: 0 0 0 3px var(--input-focus-ring); }
.app-modal-input[hidden] { display: none; }
button.primary.danger { background: var(--destructive); border-color: var(--destructive); color: #fff; }
button.primary.danger:hover { background: #e35d5d; border-color: #e35d5d; }

/* Administrator hinzufügen dialog */
#admin-add-search {
	width: 100%; height: 2.25rem; padding: 8px 12px; margin: 4px 0 12px;
	font-size: 14px; border: 1px solid var(--input-border); border-radius: var(--radius-md);
	box-shadow: var(--shadow-xs); background: var(--input-bg); color: var(--text); font-family: inherit;
}
#admin-add-search:focus { outline: none; border-color: var(--input-focus); box-shadow: 0 0 0 3px var(--input-focus-ring); }
.admin-add-results {
	display: flex; flex-direction: column;
	max-height: 50vh; overflow-y: auto;
	border: 1px solid var(--card-border); border-radius: var(--radius-lg);
}
.admin-add-item {
	display: flex; flex-direction: column; gap: 2px;
	align-items: flex-start; justify-content: center;
	width: 100%; height: auto; text-align: left;
	background: transparent; border: none; border-bottom: 1px solid var(--section-border);
	border-radius: 0; box-shadow: none; padding: 10px 12px; cursor: pointer;
}
.admin-add-item:last-child { border-bottom: none; }
.admin-add-item:hover { background: var(--accent); }
.admin-add-name { font-size: 0.9375rem; color: var(--text-strong); font-weight: 500; }
.admin-add-email { font-size: 0.8125rem; color: var(--text-muted); }
.admin-add-empty { padding: 12px; margin: 0; }

/* All pages/modules share ONE container width for a coherent layout.
   Wide tables scroll horizontally inside .mit-table-wrap rather than
   widening the page, so switching tabs never shifts the body width. */
.mit-dashboard-grid { max-width: none; }

/* Benutzer table: full-bleed — spans the whole content width edge-to-edge next to the
   sidebar. Cancel the page gutter, drop side borders/rounding so it isn't a boxed card. */
#admin-sub-users .mit-table-wrap {
	margin-left: calc(-1 * var(--app-pad));
	margin-right: calc(-1 * var(--app-pad));
	border-left: none; border-right: none; border-radius: 0;
	box-shadow: none;
}
/* A real, tabular list — single-line rows, clean header, row dividers + hover. */
#admin-table { width: 100%; border-collapse: collapse; background: var(--card-bg); font-size: 0.875rem; }
#admin-table th, #admin-table td { text-align: left; vertical-align: middle; }
#admin-table thead th {
	padding: 11px 14px; background: var(--muted); border-bottom: 1px solid var(--section-border);
	font-weight: 500; color: var(--text-muted); font-size: 0.8125rem;
}
#admin-table tbody td { padding: 13px 14px; border-bottom: 1px solid var(--section-border); }
#admin-table tbody tr:last-child td { border-bottom: none; }
#admin-table tbody tr:hover { background: color-mix(in srgb, var(--muted) 55%, transparent); }
/* First/last cells keep the page gutter so text lines up with the title, not the pixel edge. */
#admin-table th:first-child, #admin-table td:first-child { padding-left: var(--app-pad); }
#admin-table th:last-child, #admin-table td:last-child { padding-right: var(--app-pad); }
.admin-name-cell { font-weight: 500; color: var(--text-strong); white-space: nowrap; }
.admin-email-cell { color: var(--text-muted); }
.admin-perm-cell { max-width: 460px; }
.perm-list { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; color: var(--text-muted); }
.perm-all { color: var(--text); font-size: 0.8125rem; }
.admin-detail-td { text-align: right; white-space: nowrap; width: 1%; }
.admin-detail-btn {
	height: auto; padding: 6px 15px; font-size: 0.8125rem; font-weight: 500; cursor: pointer;
	border: 1px solid var(--input-border); border-radius: var(--radius-md);
	background: var(--input-bg); color: var(--text); box-shadow: none;
}
.admin-detail-btn:hover { border-color: var(--input-focus); }

/* Role badge (read-only in the table; editable in the detail dialog). */
.role-badge {
	display: inline-block; padding: 3px 10px; border-radius: 999px;
	font-size: 0.75rem; font-weight: 500; white-space: nowrap;
	border: 1px solid var(--card-border); color: var(--text-muted); background: var(--muted);
}
.role-badge.role-super_admin { color: var(--gold-strong); border-color: var(--gold-tint-border); background: var(--gold-tint); }

/* Discreet "add person" button — pushed to the far right of the toolbar. */
.admin-add-btn {
	margin-left: auto; height: 2.25rem; padding: 0 14px; cursor: pointer;
	font-size: 0.8125rem; font-weight: 500; color: var(--text-muted);
	background: transparent; border: 1px solid var(--card-border);
	border-radius: var(--radius-md); box-shadow: none;
}
.admin-add-btn:hover { color: var(--text-strong); border-color: var(--input-focus); background: var(--accent); }

/* Benutzer-Detail dialog */
.admin-detail-card { max-width: 560px; width: 92%; }
.admin-detail-card h2 { margin-bottom: 2px; }
#admin-detail-body .detail-email { font-size: 0.875rem; margin: 0 0 16px; }
.detail-field { margin-bottom: 18px; }
.detail-label { display: block; font-size: 0.75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin-bottom: 8px; }
.detail-role { width: 100%; max-width: 260px; height: 2.25rem; padding: 6px 10px; font-family: inherit; border: 1px solid var(--input-border); border-radius: var(--radius-md); background: var(--input-bg); color: var(--text); }
.detail-role:focus { outline: none; border-color: var(--input-focus); box-shadow: 0 0 0 3px var(--input-focus-ring); }
.detail-mods { gap: 8px; }
.detail-views { display: flex; flex-direction: column; gap: 2px; max-height: 220px; overflow-y: auto; }
.detail-view { display: flex; align-items: center; gap: 8px; font-size: 0.875rem; padding: 6px 8px; border-radius: var(--radius-sm); cursor: pointer; }
.detail-view:hover { background: var(--accent); }
.detail-view input { width: 15px; height: 15px; accent-color: var(--gold-strong); }
.detail-subhint { margin: 8px 0 0; }
.detail-meta { margin-bottom: 0; }
.detail-actions { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--card-border); }
.admin-imp-btn {
	height: auto; padding: 8px 16px; font-size: 0.875rem; cursor: pointer;
	border: 1px solid var(--input-border); border-radius: var(--radius-md);
	background: var(--input-bg); color: var(--text); box-shadow: none;
}
.admin-imp-btn:hover { border-color: var(--input-focus); }
.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.admin-remove-btn {
	height: auto; padding: 8px 16px; font-size: 0.875rem; cursor: pointer;
	border: 1px solid var(--input-border); border-radius: var(--radius-md);
	background: var(--input-bg); color: var(--danger, #c0392b); box-shadow: none;
}
.admin-remove-btn:hover { border-color: var(--danger, #c0392b); }
.admin-detail-status { margin-right: auto; }
/* "Produkte" restriction — a button (shows the allowed product names) that opens a modal. */
.prod-restrict-btn {
	cursor: pointer; padding: 4px 10px; font-size: 0.8125rem; white-space: normal; text-align: left; max-width: 340px; line-height: 1.3;
	border: 1px solid var(--input-border); border-radius: var(--radius-md); background: var(--input-bg); color: var(--text); box-shadow: none;
}
.prod-restrict-btn:hover:not([disabled]) { border-color: var(--input-focus); }
.prod-restrict-btn[disabled] { opacity: .5; cursor: default; }
.prod-modal-list { margin: 10px 0; max-height: 50vh; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.prod-opt { display: flex; align-items: center; gap: 8px; font-size: 0.875rem; padding: 6px 8px; border-radius: var(--radius-sm); cursor: pointer; }
.prod-opt:hover { background: var(--accent); }

/* ---------- Abonnenten-Views editor ---------- */
.views-list { display: flex; flex-direction: column; gap: 16px; }
.view-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; background: var(--card); }
.view-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.view-card-head .view-name { flex: 1; font-size: 1rem; font-weight: 600; padding: 6px 8px; }
.view-card-head .view-rowstatus { margin-left: auto; }
.view-subhead { font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin: 14px 0 6px; }
.view-plans { display: flex; flex-wrap: wrap; gap: 14px; }
.view-plan-group { min-width: 200px; }
.view-plan-prod { font-weight: 600; font-size: 0.8125rem; margin-bottom: 2px; }
.view-tabs { display: flex; flex-direction: column; gap: 10px; }
.view-tab { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; }
.view-tab-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.view-tab-head .view-tab-name { flex: 1; padding: 5px 8px; font-weight: 500; }
.view-tab-crits { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.view-crit { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.view-crit select, .view-crit input { padding: 4px 6px; font-size: 0.875rem; }
.view-crit .view-crit-value { flex: 1; min-width: 140px; }
.view-card-actions { margin-top: 12px; display: flex; gap: 8px; }
.view-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; background: var(--card); }
.view-summary-main { display: flex; flex-direction: column; gap: 2px; }
.view-summary-name { font-weight: 600; }
.view-summary-actions { display: flex; gap: 4px; }
.view-plan-prodhead { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.view-plan-caret { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 0.9rem; width: 18px; padding: 0; }
.view-plan-prodlabel { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.view-plan-plans { padding: 4px 0 8px 26px; display: flex; flex-direction: column; gap: 2px; }
.view-plan-group { border-bottom: 1px solid var(--border); }
.view-plans { display: block; }

/* Websites (SSO) admin panel — uses theme vars so it reads in light AND dark mode */
/* ── SSO website modal — one systematic layout ───────────────────────────────
   Every row: a muted label on top, a full-width control below. Read-only values
   (callback, credentials, endpoints) all share .sso-val-row: value stretches,
   action icons sit inline on the right — never below. Spacing comes from flex
   `gap`, never ad-hoc margins. Title + footer are fixed; only the body scrolls. */
.sso-modal-card { max-width: 760px; width: 94vw; max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; }
.sso-modal-card .sso-form { overflow-y: auto; min-height: 0; padding-right: 6px; }
.sso-modal-card .mit-dialog-actions { border-top: 1px solid var(--card-border); padding-top: 14px; margin-top: 14px; }

.sso-modal-titlebar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.sso-modal-titlebar .sso-modal-title { margin: 0; }
.sso-copyall { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--input-border); border-radius: var(--radius-md); background: var(--input-bg); color: var(--text-muted); font: inherit; font-size: 0.8rem; cursor: pointer; white-space: nowrap; }
.sso-copyall:hover { color: var(--text); border-color: var(--ghost-border); }
.sso-copyall svg { width: 15px; height: 15px; }

.sso-form { display: flex; flex-direction: column; gap: 16px; margin: 6px 0 8px; }
.sso-field { display: flex; flex-direction: column; gap: 6px; font-size: 0.875rem; }
.sso-field > span { color: var(--text-muted); font-size: 0.8rem; }
.sso-field > input, .sso-field > textarea, .sso-field > select,
.sso-val-row > input, .sso-val {
	padding: 9px 12px; border: 1px solid var(--input-border); border-radius: var(--radius-sm);
	font: inherit; background: var(--input-bg); color: var(--text); resize: vertical;
}
.sso-field-error { color: var(--destructive); font-size: 0.78rem; line-height: 1.3; min-height: 1.3em; }
.sso-field > input.invalid { border-color: var(--destructive); }
.sso-checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }

/* Read-only value row: stretchy value + inline action icon(s). */
.sso-val-row { display: flex; align-items: center; gap: 8px; }
.sso-val-row > input, .sso-val-row > .sso-val { flex: 1; min-width: 0; }
.sso-val { display: block; font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-muted); word-break: break-all; }
.sso-field > input[readonly], .sso-val-row > input[readonly] { color: var(--text-muted); cursor: default; }

/* Icon-only action button — square, used for copy / edit / reset / regenerate. */
.sso-icon-btn { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; padding: 0; border: 1px solid var(--input-border); border-radius: var(--radius-sm); background: var(--input-bg); color: var(--text-muted); cursor: pointer; }
.sso-icon-btn:hover { color: var(--text); border-color: var(--ghost-border); }
.sso-icon-btn.ok { color: var(--gold-strong); border-color: var(--gold-strong); }

/* Einrichtung group — always visible (no collapsible); separated by a hairline. */
.sso-advanced { display: flex; flex-direction: column; gap: 16px; border-top: 1px solid var(--card-border); padding-top: 16px; margin-top: 2px; }
.sso-modal-instructions { display: flex; flex-direction: column; gap: 16px; }
.sso-modal-instructions > * { margin: 0; }
.sso-fields { display: flex; flex-direction: column; gap: 16px; }

.sso-check-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sso-check-row input { padding: 9px 12px; border: 1px solid var(--input-border); border-radius: var(--radius-sm); font: inherit; background: var(--input-bg); color: var(--text); flex: 1 1 240px; }
.sso-check-result { line-height: 1.6; }
.sso-caveat { padding: 12px 14px; border-left: 3px solid var(--gold-strong); background: var(--gold-tint); border-radius: var(--radius-sm); font-size: 0.82rem; line-height: 1.55; }

/* Tag picker (reusable multi-select with chips + searchable dropdown) */
.tp-chips { display: flex; flex-wrap: wrap; align-items: stretch; gap: 6px; margin-bottom: 0; min-height: 4px; }
.tp-empty { color: var(--text-muted); font-size: 0.8rem; }
/* Chips AND the add button are the SAME mini component: identical solid pill
   (same background, border box, radius, colour, font-size). The add button is just
   a chip without a × — so it inherits the whole look from this shared rule. */
.tp-chip, .tp-add { display: inline-flex; align-items: center; gap: 6px; background: var(--ghost-hover-bg); color: var(--text); border: 1px solid transparent; border-radius: 999px; padding: 3px 6px 3px 11px; font-size: 0.82rem; }
.tp-chip-x { appearance: none; -webkit-appearance: none; border: none; background: none; box-shadow: none; height: auto; cursor: pointer; color: var(--text-muted); font-size: 1rem; line-height: 1; padding: 0 2px; border-radius: 999px; }
.tp-chip-x:hover { background: none; color: var(--destructive); }
/* The × is a <button>, so the global button:focus-visible ring would draw a small
   circle around it — suppress it here so no border ever frames the cross. */
.tp-chip-x:focus, .tp-chip-x:focus-visible { border-color: transparent; box-shadow: none; outline: none; }
/* The add button is the last chip in the .tp-chips flow: symmetric padding (no ×),
   a pointer cursor, and a subtle hover so it reads as clickable. Spacing to the chips
   comes from the row gap, like every other chip — no extra margin. */
/* Neutralise the global `button {}` chrome (fixed height, box-shadow, line-height)
   so the add button is pixel-identical to a chip <span>, not a taller raised button.
   The global button:hover is switched off for .tp-add in base.css. */
.tp-add { padding-right: 11px; padding-left: 11px; cursor: pointer; font-family: inherit; height: auto; line-height: 1.4; box-shadow: none; }
.tp-add:hover { filter: brightness(1.25); }
/* Nothing left to add: greyed out; clicking flashes the "Keine weitere Optionen"
   note (.tp-note) instead of opening an empty popup, and hover shows it as a title. */
.tp-add--empty { opacity: .5; cursor: default; }
.tp-note { display: inline-flex; align-items: center; font-size: 0.78rem; color: var(--text-muted); background: var(--ghost-hover-bg); border-radius: 999px; padding: 3px 11px; }
/* In-flow (not absolute) so it can never be clipped by a scrolling modal/panel. */
.tp-pop { margin-top: 6px; width: 100%; max-width: 460px; background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius); box-shadow: var(--shadow-md, 0 4px 16px rgba(0,0,0,.18)); padding: 8px; box-sizing: border-box; }
/* Modal flavour: a small centred popup over a dimmed backdrop. */
.tp-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1200; }
.tp-pop--modal { position: fixed; left: 50%; top: 50%; transform: translate(-50%,-50%); z-index: 1201; margin: 0; width: min(360px, 92vw); max-width: none; max-height: 72vh; overflow: auto; }
.tp-search { width: 100%; box-sizing: border-box; padding: 7px 10px; border: 1px solid var(--input-border); border-radius: var(--radius-sm); font: inherit; background: var(--input-bg); color: var(--text); margin-bottom: 6px; }
.tp-list { max-height: 260px; overflow: auto; }
.tp-group { font-size: 0.72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); padding: 8px 6px 3px; }
.tp-opt { display: block; width: 100%; text-align: left; border: none; background: none; cursor: pointer; padding: 7px 8px; border-radius: var(--radius-sm); font: inherit; font-size: 0.85rem; color: var(--text); }
.tp-opt:hover { background: var(--ghost-hover-bg); }
.tp-hint { color: var(--text-muted); font-size: 0.78rem; }
.tp-none { color: var(--text-muted); font-size: 0.82rem; padding: 8px; }
/* Coloured flavour: the chip / option IS a badge (Status-Auswahl). The badge class
   supplies the colours, so the neutral chip shell is stripped and the × lives inside. */
.tp-chip--badge { background: none; border: none; padding: 0; border-radius: 0; }
.tp-chip--badge .badge { gap: 4px; padding-right: 0.3125rem; }
.tp-chip--badge .tp-chip-x {
	border: none; background: transparent; cursor: pointer; color: currentColor;
	opacity: .55; font-size: 13px; line-height: 1; padding: 0 0 0 2px; margin: 0;
	border-radius: 999px; display: inline-flex; align-items: center;
}
.tp-chip--badge .tp-chip-x:hover { opacity: 1; color: var(--destructive, #c0392b); }
.tp-opt--badge { padding: 5px 6px; }
/* Export-Produkt-Filter im Druckauftrag-Toolbar hostet einen Tag-Picker. `display:contents`
   dissolves the wrapper so its chips row sits on the SAME toolbar line as the Ausgabe-Select
   (instead of a full-width block below it); the dropdown still drops to its own full-width line. */
#mit-category-filter { display: contents; }
#mit-category-filter .tp-chips { flex: 1 1 240px; margin: 0; }
#mit-category-filter .tp-pop { flex-basis: 100%; }
/* Druckauftrag: Ausgabe-Nummer + Export-Button direkt nebeneinander auf der ersten
   Zeile, die Export-Produkt-Tags brechen auf eine eigene Zeile darunter um. */
.mit-export-toolbar #mit-category-filter .tp-chips { flex: 1 1 100%; }

/* Druckauftrag → E-Mails settings */
/* Box-Kopf: Titel links, Aktions-Button (Senden / Testen) oben rechts. */
.mit-box-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.mit-box-head h2 { margin: 0; }
.mit-box-head button { flex: 0 0 auto; }
.mit-email-actions { margin-top: 10px; display: flex; gap: 10px; align-items: center; min-height: 1.2em; }
.mit-field-row { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.mit-field-row > span { font-size: 0.875rem; }

/* E-Mail-Tab: Betreff/Text-Felder über die volle Breite des Blocks. */
#mit-sub-email .mit-add-product { display: block; width: 100%; box-sizing: border-box; }
#mit-sub-email textarea.mit-add-product { height: auto; resize: vertical; line-height: 1.45; }

/* E-Mail-Empfänger — Tags OBEN (separate Chips, kein Feld), darunter das Hinzufügen-Formular. */
.mit-email-taglist, .mit-email-autolist { margin-top: 6px; }
.mit-tags-row { margin-bottom: 10px; }
.mit-tag-input { flex: 1 1 220px; min-width: 160px; margin-top: 0 !important; }
.mit-tag-add { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* Automatik-Formular: E-Mail + Zeitplan-Felder + Button in einer Zeile. */
.mit-auto-add { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.mit-auto-add .mit-tag-input { flex: 1 1 200px; }
.mit-auto-field { display: flex; flex-direction: column; gap: 3px; font-size: 0.72rem; color: var(--text-muted); }
.mit-auto-field select, .mit-auto-field input {
	height: 2rem; padding: 3px 8px; font-size: 13px; border: 1px solid var(--input-border);
	border-radius: var(--radius-md); background: var(--input-bg); color: var(--text); font-family: inherit;
}
.mit-auto-field input[type="number"] { width: 5.5rem; }

/* Automatik-Tag: Adresse + Zeitplan in einem Chip. */
.tp-chip--auto { gap: 8px; }
.mit-auto-chip-email { font-weight: 600; }
.mit-auto-chip-sched { color: var(--text-muted); font-size: 0.76rem; }

/* Wiederkehrende Nachrichten: je Nachricht eine Karte mit eigenem Rahmen. */
.mit-rt-card {
	border: 1px solid var(--input-border); border-radius: var(--radius-md);
	padding: 14px 16px 16px; margin-bottom: 14px; background: var(--card-bg, transparent);
}
.mit-rt-head { align-items: center; }
.mit-rt-name {
	flex: 1 1 auto; min-width: 0; font-weight: 600; font-size: 0.95rem;
	height: 2.1rem; padding: 3px 10px; border: 1px solid var(--input-border);
	border-radius: var(--radius-md); background: var(--input-bg); color: var(--text); font-family: inherit;
}
.mit-rt-head-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.mit-rt-del { font-size: 1.15rem; color: var(--text-muted); }
.mit-rt-del:hover { color: var(--destructive, #c0392b); }
.mit-rt-card .mit-subhead { margin-top: 14px; }
/* Ein-/Ausklapp-Pfeil links im Kopf jeder Nachricht. */
.mit-rt-collapse {
	flex: 0 0 auto; width: 1.9rem; height: 2.1rem; padding: 0; line-height: 1;
	border: 1px solid var(--input-border); border-radius: var(--radius-md);
	background: var(--input-bg); color: var(--text-muted); cursor: pointer; font-size: 0.9rem;
}
.mit-rt-collapse:hover { color: var(--text); }
/* Zugeklappte Nachricht: nur der Kopf, kompakt. */
.mit-rt-card--collapsed { padding-bottom: 14px; }
.mit-rt-card--collapsed .mit-rt-head { margin: 0; }
.mit-rt-collapsed-info { flex: 0 0 auto; white-space: nowrap; }

/* Kopfzeile über einem Feld: nur der Titel (der „+ Platzhalter"-Knopf sitzt IM Feld). */
.mit-field-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 16px 0 8px; }
.mit-field-head .mit-subhead { margin: 0; }
/* Feld + „+ Platzhalter"-Knopf: der Knopf liegt oben rechts INNERHALB des Feldes. */
/* Honorare-Einstellungen: Felder über die ganze Breite (wie in den Druckauftrag-
   Einstellungen); nur die Währung bleibt schmal. */
#hon-settings-form .mit-add-product { display: block; width: 100%; box-sizing: border-box; }
#hon-settings-form textarea.mit-add-product { height: auto; resize: vertical; line-height: 1.45; }
#hon-set-admin-email, #hon-set-sender { max-width: 32rem; }
#hon-set-currency { max-width: 8rem; }

.mit-field-wrap { position: relative; display: block; margin-top: 12px; }
/* Kill the field's own top margin so the absolutely-positioned button anchors to the
   field's TOP EDGE (not the margin gap above it) — that gap is what pushed it "outside". */
.mit-field-wrap > .mit-add-product { width: 100%; box-sizing: border-box; margin-top: 0; }
.mit-field-wrap > input.mit-add-product { padding-right: 128px; }
.mit-field-wrap > textarea.mit-add-product { padding-top: 36px; }
.mit-ph-select {
	height: 1.9rem; padding: 2px 8px; font-size: 0.78rem;
	border: 1px solid var(--input-border); border-radius: var(--radius-md);
	background: var(--input-bg); color: var(--text-muted); font-family: inherit; cursor: pointer;
	max-width: 60%;
}
.mit-ph-select:focus { outline: none; border-color: var(--input-focus); box-shadow: 0 0 0 3px var(--input-focus-ring); }
/* The native <select> is progressively enhanced into a custom widget (.cs--mit-ph-select
   by dropdown.js), so the VISIBLE control is that wrapper — float IT (not the hidden
   native select) inside the field, top-right, small, with a shadow so it reads as floating. */
.mit-field-wrap > .cs--mit-ph-select {
	position: absolute; top: 5px; right: 6px; z-index: 3;
	min-width: 0; max-width: 116px;
}
.mit-field-wrap > .cs--mit-ph-select .cs-trigger {
	height: 1.6rem; padding: 0 5px 0 8px; gap: 0.25rem; font-size: 0.72rem;
	box-shadow: 0 2px 6px rgba(0,0,0,.35);
}

/* „+"-Knopf am Ende der Empfängerliste (inline, gleiche Zeile). */
.tp-add--plus {
	appearance: none; -webkit-appearance: none;
	width: 1.75rem; height: 1.75rem; padding: 0; align-self: center;
	display: inline-flex; align-items: center; justify-content: center;
	border: 1px dashed var(--card-border); background: transparent; color: var(--text-muted);
	border-radius: 999px; font-size: 1.1rem; line-height: 1; cursor: pointer;
	box-shadow: none;
}
.tp-add--plus:hover { border-style: solid; border-color: var(--input-focus); color: var(--text); background: var(--ghost-hover-bg); }

/* Anklickbarer Empfänger-Chip: öffnet das Bearbeiten-Modal. */
.tp-chip--click { cursor: pointer; }
.tp-chip--click:hover { border-color: var(--input-border); }
.tp-chip--click:focus-visible { outline: 2px solid var(--input-focus); outline-offset: 1px; }

/* Empfänger-Modal (Adresse + optional Zeitplan). */
.mit-recipient-card { width: min(460px, 94vw); }
.mit-recipient-card .mit-recipient-email { margin-bottom: 14px; }
.mit-recipient-card .mit-field > span { color: var(--text-muted); }
.mit-recipient-sched { grid-template-columns: 1fr 1fr 1fr; }
.mit-recipient-sched .mit-field { font-size: 0.72rem; }

/* Import Script module */
.imp-step { margin: 12px 0; display: flex; align-items: center; gap: 12px; }
.imp-upload {
	display: inline-flex; align-items: center; gap: 8px;
	padding: 0.55rem 1rem;
	border-radius: var(--radius-md);
	border: 1px solid var(--card-border);
	background: var(--card-bg);
	color: var(--text-strong);
	font-size: 0.9375rem; font-weight: 600;
	cursor: pointer;
	transition: background .15s, border-color .15s, box-shadow .15s;
}
.imp-upload:hover { border-color: var(--ring); background: var(--toggle-hover-bg); }
.imp-upload:focus-within { border-color: var(--ring); box-shadow: 0 0 0 3px var(--ring-soft); }
.imp-upload svg { flex: 0 0 auto; opacity: 0.8; }
.imp-paste-or { display: flex; align-items: center; gap: 10px; margin: 16px 0 6px; max-width: 640px; color: var(--text-muted); font-size: 0.8125rem; }
.imp-paste-or::before, .imp-paste-or::after { content: ""; flex: 1; height: 1px; background: var(--card-border); }
.imp-paste-box { display: flex; flex-direction: column; gap: 8px; max-width: 640px; }
.imp-paste-label { font-size: 0.8125rem; color: var(--text-muted); }
#imp-paste {
	width: 100%; box-sizing: border-box; resize: vertical; min-height: 96px;
	padding: 0.55rem 0.7rem;
	border-radius: var(--radius-md);
	border: 1px solid var(--card-border);
	background: var(--card-bg); color: var(--text-strong);
	font: inherit; font-size: 0.875rem; line-height: 1.4;
	white-space: pre; overflow-wrap: normal; overflow-x: auto;
}
#imp-paste:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px var(--ring-soft); }
#imp-paste-btn { align-self: flex-start; }
.imp-actions { margin: 14px 0; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.imp-opt { display: flex; align-items: center; gap: 6px; font-size: 0.875rem; }
.imp-req { color: var(--destructive); }
/* Abo-Start preset: radios + date, dark-mode-readable native date control. */
.imp-startmode { flex-wrap: wrap; gap: 10px 16px; }
.imp-startmode-radios { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.imp-startmode-radios label { display: inline-flex; align-items: center; gap: 4px; }
.imp-startmode-date { display: inline-flex; align-items: center; gap: 6px; }
.imp-startmode input[type="date"] { color-scheme: dark; background: var(--input-bg, #1d2127); color: var(--text, #e6e6e6); border: 1px solid var(--card-border, #3a3f47); border-radius: 6px; padding: 3px 8px; }
.imp-startmode input[type="date"]:disabled { opacity: 0.55; }
.imp-warn { color: #b07b00; font-size: 0.8125rem; }
#imp-mapping-table select.imp-map { padding: 4px 6px; min-width: 180px; }
.imp-badge { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 0.7rem; font-weight: 600; white-space: nowrap; line-height: 1.45; }
.imp-badge.imp-ok { background: #e8f4e8; color: #1e6b32; }
.imp-badge.imp-skip { background: #eee; color: #555; }
.imp-badge.imp-new { background: #e6eefb; color: #2a3f9c; }
.imp-badge.imp-warn { background: #fdf0d5; color: #8a5a00; }
.imp-badge.imp-err { background: #fde8e8; color: #a13030; }
.danger-action { background: var(--destructive, #b8336a); }
/* Step-1 correspondence cell with a per-row Zoho-customer picker */
.imp-corr { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.imp-row-commit, .imp-pick-customer, .imp-pick-plan { padding: 3px 12px; font-size: 0.8rem; }

/* 4-step wizard: progress menu */
.imp-steps { display: flex; gap: 6px; margin: 18px 0; flex-wrap: wrap; }
.imp-stepbtn { display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px; background: var(--card); border: 1px solid var(--border); color: var(--text-muted); font-size: 0.9rem; cursor: pointer; }
.imp-stepbtn .imp-stepno { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 999px; background: var(--border); color: var(--text); font-size: 0.78rem; font-weight: 700; }
.imp-stepbtn.active { border-color: var(--link-color); color: var(--text); font-weight: 600; }
.imp-stepbtn.active .imp-stepno { background: var(--link-color); color: #fff; }
.imp-nav-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; }
.imp-nav-actions .imp-next { margin-left: auto; }

/* Import + cleanup tables — full width, same look as the other staff tables */
#imp-cust-table, #imp-sub-table, #imp-plans-table, #cleanup-table {
	width: 100%; border-collapse: collapse; background: var(--card-bg);
}
#imp-cust-table th, #imp-cust-table td,
#imp-sub-table th, #imp-sub-table td,
#imp-plans-table th, #imp-plans-table td,
#cleanup-table th, #cleanup-table td {
	text-align: left; padding: 5px 10px;
	border-bottom: 1px solid var(--section-border);
	font-size: 0.82rem; line-height: 1.3; vertical-align: middle;
}
#imp-cust-table th, #imp-sub-table th, #imp-plans-table th, #cleanup-table th {
	background: var(--muted); font-weight: 500; color: var(--text-muted); font-size: 0.76rem; padding-top: 6px; padding-bottom: 6px;
}
#imp-cust-table tbody tr:last-child td, #imp-sub-table tbody tr:last-child td, #imp-plans-table tbody tr:last-child td, #cleanup-table tbody tr:last-child td { border-bottom: none; }
#imp-cust-table tbody tr:hover, #imp-sub-table tbody tr:hover, #imp-plans-table tbody tr:hover, #cleanup-table tbody tr:hover { background: color-mix(in srgb, var(--muted) 60%, transparent); }
.imp-corr { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: space-between; }
.imp-corr .imp-pick-customer { margin-left: auto; }

/* Search-picker modal list */
.imp-picker-list { margin: 10px 0; max-height: 56vh; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.imp-picker-item { text-align: left; background: transparent; border: none; border-radius: var(--radius-sm); padding: 8px 10px; cursor: pointer; font-size: 0.875rem; color: var(--text); }
.imp-picker-item:hover { background: var(--accent); }
#imp-picker-search { width: 100%; padding: 8px 10px; }
/* mapping: example navigator + matched grids (horizontal) + not-recognized list */
.imp-example-nav { display: flex; align-items: center; gap: 8px; margin: 6px 0 12px; font-size: 0.85rem; }
.imp-example-nav button { padding: 1px 10px; line-height: 1.4; font-size: 1rem; }
.imp-example-nav button:disabled { opacity: 0.4; cursor: default; }
.imp-group-head { font-size: 0.95rem; margin: 16px 0 6px; }
.imp-fgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 28px; }
.imp-frow { display: grid; grid-template-columns: minmax(110px, max-content) auto minmax(120px, 1fr) minmax(0, 1.1fr); align-items: center; gap: 8px; padding: 3px 6px; border-radius: 6px; font-size: 0.85rem; }
.imp-frow:hover { background: rgba(127,127,127,0.06); }
.imp-frow-req { background: rgba(176,123,0,0.10); }
.imp-flabel { white-space: nowrap; font-weight: 500; }
.imp-arrow { color: var(--text-muted); }
.imp-frow select.imp-map { padding: 3px 6px; width: 100%; min-width: 0; font-size: 0.82rem; }
.imp-fsample { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imp-mok { color: #1e9e4a; font-weight: 700; }
.imp-mdash { color: var(--text-muted); }
@media (max-width: 1100px) { .imp-fgrid { grid-template-columns: 1fr; } }

/* ---------- "Für Mitarbeiter" empty state (staff with no modules) ---------- */
.mit-empty {
	margin: 8px 4px;
	padding: 18px 20px;
	border: 1px dashed var(--gold-tint-border);
	border-radius: var(--radius-xl);
	background: var(--gold-tint);
	color: var(--text-muted, inherit);
	max-width: 640px;
}

/* ---------- Login-Admin sub-panels (Benutzer / Abonnements / Produkte / Pläne / Rechnungen) ---------- */
.admin-subpanel { display: none; }
.admin-subpanel.active { display: block; }
/* invoice / status badge colours reusing the existing palette */
.badge-paid { background: rgb(220 252 231); color: rgb(22 101 52); border-color: rgb(187 247 208); }
.badge-overdue { background: rgb(254 226 226); color: rgb(153 27 27); border-color: rgb(254 202 202); }
html.dark .badge-paid { background: rgba(22,101,52,.25); color: rgb(187 247 208); border-color: rgba(22,101,52,.5); }
html.dark .badge-overdue { background: rgba(153,27,27,.25); color: rgb(254 202 202); border-color: rgba(153,27,27,.5); }

/* Section headings inside the combined "Produkte & Pläne" sub-panel */
.admin-section-title {
	font-family: var(--font-head);
	font-size: 1.05rem; font-weight: 600; margin: 22px 4px 10px;
	color: var(--text-strong);
}
.admin-subpanel > .admin-section-title:first-child { margin-top: 4px; }

/* Öffentliche Module (Login-Admin → Module) */
.pubmods-list { display: flex; flex-direction: column; gap: 4px; max-width: 28rem; }

/* Clickable customer rows (Abonnenten / Rechnungen) → open the cached-data dialog */
tr.row-clickable { cursor: pointer; }
tr.row-clickable:hover td { background: color-mix(in srgb, var(--muted) 60%, transparent); }
.cust-detail h3 { font-size: 13px; margin: 14px 0 6px; }
.cust-detail .cust-list { margin: 0; padding-left: 18px; }
.cust-detail .cust-list li { margin: 2px 0; }

/* Zoho-Import (batched backfill) */
.zimport-list { display: flex; flex-direction: column; gap: 12px; max-width: 640px; }
.zimport-row { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.zimport-row-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.zimport-step { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent, #2d6cdf); color: #fff; font-size: 12px; font-weight: 600; }
.zimport-row-ctrls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.zimport-row-ctrls select { margin-left: 4px; }

/* ---- Sync-Übersicht: eine Karte je Datenquelle (Zoho / Notion) ---- */
.sync-list { display: flex; flex-direction: column; gap: 10px; max-width: 680px; }
.sync-source {
	display: flex; align-items: center; gap: 14px;
	border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px;
	background: var(--card-bg); transition: border-color .15s ease, box-shadow .15s ease;
}
.sync-source.is-active { border-color: var(--gold, #c8a04a); box-shadow: 0 0 0 3px rgba(200,160,74,.12); }
.sync-source-main { flex: 1 1 auto; min-width: 0; }
.sync-source-head { display: flex; align-items: center; gap: 9px; }
.sync-source-head strong { font-size: 0.95rem; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sync-source-meta { margin-top: 3px; font-size: 0.8125rem; color: var(--text-muted); }
.sync-source-ctrl { flex: none; }
.sync-source-ctrl .primary { padding: 6px 14px; font-size: 0.85rem; }
.sync-err { color: #b4231c; }
:root.dark .sync-err { color: #f3968f; }

/* Group badge — same palette family as the sidebar nav tags. */
.sync-badge {
	flex: none; font-size: 0.625rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
	padding: 2px 8px; border-radius: 999px; line-height: 1.5;
}
.sync-badge-zoho { background: rgba(59,130,190,.16); color: rgb(37 99 145); }
.sync-badge-notion { background: rgba(120,113,108,.18); color: rgb(87 83 78); }
:root.dark .sync-badge-zoho { color: rgb(140 190 232); }
:root.dark .sync-badge-notion { color: rgb(198 193 188); }

/* Indeterminate progress bar while a source is syncing (Zoho background + Notion foreground). */
.sync-bar { position: relative; height: 6px; margin-top: 8px; border-radius: 999px; background: var(--accent, #eee); overflow: hidden; }
.sync-bar > span {
	position: absolute; top: 0; bottom: 0; left: 0; width: 40%; border-radius: 999px;
	background: var(--gold, #c8a04a); animation: syncBar 1.1s ease-in-out infinite;
}
@keyframes syncBar { 0% { left: -40%; } 100% { left: 100%; } }
.sync-progress-text { margin-top: 5px; font-size: 0.75rem; color: var(--text-muted); }

@media (max-width: 560px) {
	.sync-source { flex-wrap: wrap; }
	.sync-source-ctrl { width: 100%; }
	.sync-source-ctrl .primary { width: 100%; }
}

/* Abonnenten / Rechnungen list pagination (200 per page) */
.mit-pager { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 12px 0; }
.mit-pager[hidden] { display: none; }
.mit-pager button { background: none; border: 0; color: var(--accent, #2d6cdf); cursor: pointer; font-size: 13px; padding: 4px 6px; }
.mit-pager button[disabled] { opacity: .4; cursor: default; }
.mit-pagesize { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.mit-pagesize select { font-size: 13px; }

/* ---- Import: background-run activity indicator + Zoho deep-links ---- */
.imp-activity {
	position: fixed; right: 18px; bottom: 18px; z-index: 1200;
	display: inline-flex; align-items: center; gap: 8px;
	padding: 10px 16px; border: none; border-radius: 999px;
	background: var(--primary-bg, #37404c); color: #fff;
	box-shadow: 0 6px 20px rgba(0, 0, 0, .28); cursor: pointer;
	font-size: 13px; font-weight: 600; line-height: 1;
}
.imp-activity:hover { background: var(--primary-bg-hover, #2a313b); }
.imp-activity[hidden] { display: none; }
.imp-activity-spinner {
	width: 14px; height: 14px; border-radius: 50%;
	border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff;
	animation: imp-spin .8s linear infinite;
}
@keyframes imp-spin { to { transform: rotate(360deg); } }
.imp-zoho-link {
	display: inline-block; margin-left: 6px;
	text-decoration: none; font-weight: 700; font-size: 14px;
	color: var(--primary-bg, #37404c); opacity: .75;
}
.imp-zoho-link:hover { opacity: 1; text-decoration: underline; }

.imp-cur-btn {
	display: inline-block; padding: 1px 7px; margin: 0;
	border: 1px solid var(--primary-bg, #37404c); border-radius: 999px;
	background: transparent; color: var(--primary-bg, #6f9bff); white-space: nowrap;
	font-size: 10px; font-weight: 600; cursor: pointer; line-height: 1.5;
}
.imp-cur-btn:hover { background: var(--primary-bg, #37404c); color: #fff; }
.imp-cur-status { margin-left: 2px; }

.imp-diff-btn {
	display: inline-block; padding: 1px 7px; margin: 0;
	border: 1px solid #c2841b; border-radius: 999px;
	background: transparent; color: #c2841b; white-space: nowrap;
	font-size: 10px; font-weight: 600; cursor: pointer; line-height: 1.5;
}
.imp-diff-btn:hover { background: #c2841b; color: #fff; }
.imp-diff-status-OBSOLETE { margin-left: 2px; }
/* Clarifies that a conflict isn't auto-resolved by the bulk import. */
.imp-diff-note { margin-top: 4px; max-width: 260px; font-size: 11px; line-height: 1.35; color: var(--text-muted); }

/* Easy case: Zoho field is empty, the file fills it → informational green badge (auto-imported). */
/* Consolidated status cell: one bold status-coloured comment + small inline chips, all on one line
   so every row keeps the same height. */
.imp-status-cell { display: flex; flex-direction: row; align-items: center; gap: 8px; flex-wrap: nowrap; min-width: 0; }
.imp-status-text { font-weight: 600; font-size: 0.82rem; line-height: 1.35; white-space: nowrap; }
.imp-status-text.imp-ok { color: #3fae6e; }
.imp-status-text.imp-new { color: #6f9bff; }
.imp-status-text.imp-warn { color: #d49a3a; }
.imp-status-text.imp-err { color: #e06a6a; }
.imp-status-text.imp-skip { color: var(--text-muted); font-weight: 500; }
/* Equal-height rows: single line, clipped, vertically centred — regardless of content. */
#imp-sub-table td { height: 38px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
#imp-sub-table td:last-child { overflow: visible; }
.imp-fill-badge {
	display: inline-block; padding: 1px 7px; margin: 0;
	border: 1px solid rgba(46,139,87,.35); border-radius: 999px;
	background: rgba(46,139,87,.16); color: #3fae6e; white-space: nowrap;
	font-size: 10px; font-weight: 600; line-height: 1.5; cursor: pointer;
}
.imp-fill-badge:hover { background: rgba(46,139,87,.30); }

.imp-diff-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.imp-diff-table th, .imp-diff-table td { padding: 6px 10px; text-align: left; border-bottom: 1px solid var(--card-border); vertical-align: top; }
.imp-diff-table th { font-weight: 600; color: var(--text-muted); }
.imp-diff-table td input[type="checkbox"] { transform: scale(1.1); }
/* Conflict report: file value stands out, Zoho's current value is muted/struck context. */
.imp-diff-table .imp-diff-file strong { color: var(--text-strong); }
.imp-diff-table .imp-diff-zoho { color: var(--text-muted); }
/* Person/context header on the conflict modal (good for screenshots to customer service). */
.imp-diff-ctx { margin: 2px 0 10px; }
.imp-diff-ctx .imp-diff-person { font-size: 15px; }
#imp-diff .mit-dialog-card { max-width: 640px; width: 92%; }

/* Per-row selection checkboxes in the import table. */
.imp-sel-th, .imp-sel-td { width: 34px; text-align: center !important; }
.imp-sel-td input[type="checkbox"], .imp-sel-th input[type="checkbox"] { transform: scale(1.15); cursor: pointer; }
/* Rows that already exist in Zoho (Übersprungen): dimmed, nothing to import. */
.imp-row-done td { opacity: 0.5; }
.imp-row-done td:last-child { opacity: 1; }
/* Post-import results: green tint for rows that were actually written to Zoho. */
.imp-row-ok td { background: rgba(46,139,87,.12); }
/* Date + commit controls pinned above the import list. */
.imp-actions-top { margin: 6px 0 12px; padding-bottom: 12px; border-bottom: 1px solid var(--card-border); }

/* Compact import result list (step 5) */
#imp-sub-table { font-size: 12.5px; }
#imp-sub-table th, #imp-sub-table td { padding: 4px 8px; }
#imp-sub-table td:first-child { font-weight: 600; white-space: nowrap; }

/* ---- Webhook log (Administration → Webhooks): incoming hooks + queue outcome ---- */
#wh-table { width: 100%; }
#wh-table td.nowrap { white-space: nowrap; }
#wh-table td.wh-result { max-width: 520px; overflow-wrap: anywhere; color: var(--text-muted); }
.wh-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid transparent; }
.wh-badge.wh-ok { background: rgb(220 252 231); color: rgb(22 101 52); border-color: rgb(187 247 208); }
.wh-badge.wh-err { background: rgb(253 232 232); color: rgb(161 48 48); border-color: rgb(254 202 202); }
.wh-badge.wh-queue { background: rgb(255 243 214); color: rgb(138 90 0); border-color: rgb(253 230 138); }
:root.dark .wh-badge.wh-ok { background: rgb(26 58 42); color: rgb(121 217 164); }
:root.dark .wh-badge.wh-err { background: rgb(58 26 26); color: rgb(242 154 154); }
:root.dark .wh-badge.wh-queue { background: rgb(58 46 16); color: rgb(240 195 114); }
/* E-Mail-Versand (Postmark/SMTP) status card in the E-Mails admin panel */
.mail-status-card { border: 1px solid var(--input-border); border-radius: var(--radius-md); padding: 14px 16px; margin-bottom: 18px; background: var(--input-bg); }
.mail-status-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.mail-dot { width: 10px; height: 10px; border-radius: 999px; background: rgb(180 180 180); flex: 0 0 auto; }
.mail-dot.mail-dot-ok { background: rgb(34 160 90); }
.mail-dot.mail-dot-err { background: rgb(200 60 60); }
.mail-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid transparent; margin-left: auto; }
.mail-badge.wh-ok { background: rgb(220 252 231); color: rgb(22 101 52); border-color: rgb(187 247 208); }
.mail-badge.wh-err { background: rgb(253 232 232); color: rgb(161 48 48); border-color: rgb(254 202 202); }
:root.dark .mail-badge.wh-ok { background: rgb(26 58 42); color: rgb(121 217 164); }
:root.dark .mail-badge.wh-err { background: rgb(58 26 26); color: rgb(242 154 154); }
.mail-status-detail { line-height: 1.5; }
.mail-test-row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.mail-test-row input { flex: 1 1 240px; min-width: 0; padding: 7px 10px; border: 1px solid var(--input-border); border-radius: var(--radius-md); background: var(--bg); color: var(--text); font: inherit; }
.mit-status.wh-ok { color: rgb(22 101 52); }
.mit-status.wh-err { color: rgb(161 48 48); }
:root.dark .mit-status.wh-ok { color: rgb(121 217 164); }
:root.dark .mit-status.wh-err { color: rgb(242 154 154); }
.wh-more { margin-top: 12px; display: flex; align-items: center; gap: 12px; }
.wh-more button { padding: 6px 14px; border: 1px solid var(--input-border); border-radius: var(--radius-md); background: var(--input-bg); color: var(--text); font: inherit; font-size: 0.85rem; cursor: pointer; }
.wh-more button:hover { border-color: var(--accent); }

/* Druckauftrag: serverseitig paginierte Adressliste */
.mit-list-block { margin-top: 28px; }
.mit-list-title { font-size: 1.05rem; margin: 0 0 10px; }
/* Kleiner, unterstrichener Textlink zum Ein-/Ausklappen der Adressliste. */
.mit-list-toggle {
	background: none; border: none; box-shadow: none; padding: 0; height: auto;
	font: inherit; font-size: 0.85rem; color: var(--text-muted);
	text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}
.mit-list-toggle:hover { background: none; color: var(--text); }
.mit-list-pager { display: flex; align-items: center; gap: 12px; margin-top: 10px; }

/* ===== Erinnerungen / Mahnwesen ============================================ */
/* Sub-Tabs — gleicher Look wie die Admin-Tools-Sub-Tabs */
.erin-subtab {
	height: auto; padding: 6px 14px; background: transparent; border: 1px solid transparent;
	box-shadow: none; cursor: pointer; border-radius: var(--radius-md);
	font-size: 14px; font-weight: 500; color: var(--text-muted);
	transition: background .15s, color .15s, box-shadow .15s;
}
.erin-subtab.active { color: var(--text-strong); background: var(--card-bg); box-shadow: var(--shadow-xs); }
.erin-subtab:hover:not(.active) { color: var(--text-strong); }
.erin-subpanel { display: none; }
.erin-subpanel.active { display: block; }

/* Kandidaten-/Logs-Tabellen — gleiche Optik wie die anderen Admin-Tabellen */
#erin-cand-table, #erin-logs-table {
	width: 100%; border-collapse: collapse;
	background: var(--card-bg); font-size: 0.875rem;
}
#erin-cand-table th, #erin-logs-table th,
#erin-cand-table td, #erin-logs-table td {
	text-align: left; padding: 11px 14px;
	border-bottom: 1px solid var(--section-border); vertical-align: middle;
}
#erin-cand-table th, #erin-logs-table th {
	background: var(--muted); font-weight: 500; color: var(--text-muted); font-size: 0.8125rem;
}
#erin-cand-table tbody tr:last-child td, #erin-logs-table tbody tr:last-child td { border-bottom: none; }
#erin-cand-table tbody tr:hover, #erin-logs-table tbody tr:hover { background: color-mix(in srgb, var(--muted) 60%, transparent); }
#erin-cand-table td.num, #erin-cand-table th.num { text-align: right; white-space: nowrap; }

.badge-warn { background: rgb(255 243 214); color: rgb(138 90 0); border-color: rgb(253 230 138); margin-left: 6px; }
:root.dark .badge-warn { background: rgb(58 46 16); color: rgb(240 195 114); }

/* Mahnstufe farblich codiert (eskalierend): 1 = gelb, 2 = orange, 3+ = rot. */
.erin-lvl-1 { background: rgb(255 243 214); color: rgb(138 90 0); border-color: rgb(253 230 138); }
.erin-lvl-2 { background: rgb(255 231 204); color: rgb(154 74 0); border-color: rgb(253 205 150); }
.erin-lvl-3 { background: rgb(253 232 232); color: rgb(161 48 48); border-color: rgb(254 202 202); }
:root.dark .erin-lvl-1 { background: rgb(58 46 16); color: rgb(240 195 114); border-color: rgba(146,64,14,.5); }
:root.dark .erin-lvl-2 { background: rgb(64 40 14); color: rgb(244 178 120); border-color: rgba(154,74,0,.5); }
:root.dark .erin-lvl-3 { background: rgb(58 26 26); color: rgb(242 154 154); border-color: rgba(153,27,27,.5); }

/* Vorschau als reines Auge-Icon. */
.erin-eye {
	display: inline-flex; align-items: center; justify-content: center;
	background: none; border: 0; padding: 4px; cursor: pointer;
	color: var(--text-muted); border-radius: 6px; line-height: 0;
}
.erin-eye:hover { color: var(--link-hover); background: var(--muted); }
.chk-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 0.875rem; color: var(--text); cursor: pointer; }

/* Einstellungen */
.erin-settings-grid { display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 16px; }
.erin-settings-grid label, .erin-block, .erin-level label { display: flex; flex-direction: column; gap: 4px; font-size: 0.875rem; color: var(--text-muted); }
.erin-settings-grid input { width: 120px; }
.erin-block { max-width: 520px; margin-bottom: 16px; }
.erin-block input, .erin-block textarea,
.erin-level input, .erin-level textarea {
	font: inherit; padding: 8px 10px; border: 1px solid var(--section-border);
	border-radius: var(--radius-md); background: var(--card-bg); color: var(--text); width: 100%;
}
.erin-ph code { background: var(--muted); padding: 1px 6px; border-radius: 4px; font-size: 0.8em; margin-right: 2px; white-space: nowrap; }
.erin-level {
	border: 1px solid var(--section-border); border-radius: var(--radius-lg);
	padding: 14px 16px; margin: 0 0 16px; max-width: 700px; display: flex; flex-direction: column; gap: 12px;
}
.erin-level legend { font-weight: 600; color: var(--text-strong); padding: 0 6px; }

/* Brief-Vorschau-Modal (Erinnerungen) */
.erin-modal {
	position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.55);
	display: flex; align-items: center; justify-content: center; padding: 24px;
}
.erin-modal[hidden] { display: none; }
.erin-modal-card {
	background: var(--card-bg); color: var(--text); border-radius: var(--radius-xl);
	box-shadow: var(--shadow-lg, 0 10px 40px rgba(0,0,0,.3));
	width: min(760px, 100%); max-height: 90vh; display: flex; flex-direction: column; overflow: hidden;
}
.erin-modal-head {
	display: flex; align-items: center; justify-content: space-between; gap: 12px;
	padding: 12px 16px; border-bottom: 1px solid var(--section-border);
}
.erin-modal-title { font-weight: 600; color: var(--text-strong); font-size: 0.95rem; }
.erin-modal-close {
	background: transparent; border: none; cursor: pointer; font-size: 16px;
	color: var(--text-muted); padding: 4px 8px; border-radius: var(--radius-md);
}
.erin-modal-close:hover { background: var(--muted); color: var(--text-strong); }
.erin-modal-body { padding: 20px; overflow: auto; background: var(--muted); }
.erin-sheet {
	width: 100%; min-height: 60vh; border: none; background: #fff;
	box-shadow: 0 1px 6px rgba(0,0,0,.15); border-radius: 4px; padding: 0;
	/* A4-Seitenverhältnis-Gefühl; der Briefinhalt selbst bringt seine Ränder mit */
	aspect-ratio: 210 / 297; padding: 28px;
}

/* Erinnerungen — „+ Platzhalter"-Dropdown in Betreff/Text (wie Druckauftrag-Mails) */
.erin-level .mit-field-wrap { margin-top: 0; }
.erin-level .mit-field-wrap > input,
.erin-level .mit-field-wrap > textarea { width: 100%; box-sizing: border-box; }
.erin-level .mit-field-wrap > input { padding-right: 122px; }
.erin-level .mit-field-wrap > textarea { padding-top: 34px; }
/* Falls dropdown.js den Select (noch) nicht in ein Widget verwandelt hat: nativen
   Select trotzdem oben rechts schweben lassen, damit er das Feld nicht verschiebt. */
.erin-level .mit-field-wrap > select.mit-ph-select { position: absolute; top: 5px; right: 6px; z-index: 3; max-width: 150px; }

/* ===== Bankzahlungen / Zahlungsabgleich ===== */
.zahl-upload-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 12px 0 16px; }
.zahl-subpanel { display: none; }
.zahl-subpanel.active { display: block; }
#zahl-match-table td.num, #zahl-verlauf-table td.num { text-align: right; white-space: nowrap; }
#zahl-match-table select.zahl-inv { max-width: 320px; }
tr.zahl-booked { opacity: 0.6; }
.zahl-badge { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 1px 8px; border-radius: 999px; white-space: nowrap; }
.zahl-badge.zahl-ok { background: rgba(34, 160, 90, 0.16); color: rgb(22 101 52); }
.zahl-badge.zahl-warn { background: rgba(214, 158, 46, 0.18); color: rgb(146 94 12); }
.zahl-badge.zahl-muted { background: var(--toggle-hover-bg); color: var(--text-muted); }
:root.dark .zahl-badge.zahl-ok { color: rgb(121 217 164); }
:root.dark .zahl-badge.zahl-warn { color: rgb(233 190 118); }

/* ===== Provenienz-Etiketten (Datenquelle je Modul) ===== */
/* Kompaktes Chip in der Seitenleiste (rechtsbündig, im eingeklappten Menü ausgeblendet). */
.nav-tag {
	margin-left: auto; flex: none;
	font-size: 0.625rem; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase;
	padding: 1px 6px; border-radius: 999px; line-height: 1.5;
}
.nav-tag-zoho { background: rgba(59, 130, 190, 0.16); color: rgb(37 99 145); }
.nav-tag-test { background: rgba(214, 158, 46, 0.20); color: rgb(146 94 12); }
:root.dark .nav-tag-zoho { color: rgb(140 190 232); }
:root.dark .nav-tag-test { color: rgb(233 190 118); }
.nav-tag-notion { background: rgba(120, 113, 108, 0.16); color: rgb(87 83 78); }
:root.dark .nav-tag-notion { color: rgb(190 185 180); }

/* Grösseres Etikett neben dem Modultitel. */
.prov-tag {
	display: inline-flex; align-items: center; gap: 5px;
	font-size: 0.75rem; font-weight: 600; padding: 2px 10px; border-radius: 999px; white-space: nowrap;
}
.prov-tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: 0.85; }
.prov-zoho { background: rgba(59, 130, 190, 0.14); color: rgb(37 99 145); }
.prov-test { background: rgba(214, 158, 46, 0.18); color: rgb(146 94 12); }
:root.dark .prov-zoho { color: rgb(140 190 232); }
:root.dark .prov-test { color: rgb(233 190 118); }
.prov-notion { background: rgba(120, 113, 108, 0.14); color: rgb(87 83 78); }
:root.dark .prov-notion { color: rgb(190 185 180); }


#zlist-table td.num { text-align: right; white-space: nowrap; }
