/**
 * Modul „Benachrichtigungen & Fristen" — ergänzende Styles.
 *
 * Nur kleine Layout-Helfer für die Verwaltungs-UI (Sub-Navigation, Zeilen-
 * Aktionen, Filter). Das übrige Styling kommt aus fm-app.css / TailAdmin.
 */

.fm-subnav {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	margin: 0 0 1rem;
}

.fm-row-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
	align-items: center;
}

.fm-inline-form {
	display: inline;
	margin: 0;
}

.fm-text-danger {
	color: #b91c1c;
}

/* Zeitraum-Filter (von/bis) mit beschriftetem Eingabefeld in der Toolbar. */
.fm-toolbar label.fm-toolbar-filter {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
}

.fm-toolbar label.fm-toolbar-filter .fm-muted {
	white-space: nowrap;
}

/* ---------- Topbar-Glocke ---------- */

.fm-bell {
	position: relative;
	display: inline-flex;
}

.fm-bell-toggle {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.5rem;
	height: 2.5rem;
	border-radius: 0.5rem;
	color: inherit;
	text-decoration: none;
}

.fm-bell-toggle:hover {
	background: rgba(100, 116, 139, 0.12);
}

.fm-bell-badge {
	position: absolute;
	top: 0.15rem;
	right: 0.15rem;
	min-width: 1.1rem;
	height: 1.1rem;
	padding: 0 0.25rem;
	border-radius: 999px;
	background: #ef4444;
	color: #fff;
	font-size: 0.68rem;
	font-weight: 700;
	line-height: 1.1rem;
	text-align: center;
}

.fm-bell-panel {
	position: absolute;
	top: calc(100% + 0.4rem);
	right: 0;
	z-index: 60;
	width: 22rem;
	max-width: 90vw;
	max-height: 70vh;
	overflow-y: auto;
	background: var(--fm-white, #fff);
	border: 1px solid rgba(100, 116, 139, 0.2);
	border-radius: 0.75rem;
	box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
	padding: 0.5rem;
}

.fm-bell-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	padding: 0.35rem 0.5rem 0.5rem;
	border-bottom: 1px solid rgba(100, 116, 139, 0.15);
}

.fm-bell-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.fm-bell-item {
	padding: 0.55rem 0.5rem;
	border-bottom: 1px solid rgba(100, 116, 139, 0.1);
}

.fm-bell-item.is-unread {
	background: rgba(59, 130, 246, 0.08);
	border-left: 3px solid #3b82f6;
}

.fm-bell-item-title {
	font-weight: 600;
	font-size: 0.9rem;
}

.fm-bell-item-msg {
	font-size: 0.82rem;
	color: #64748b;
	margin-top: 0.15rem;
}

.fm-bell-item-read {
	margin-top: 0.3rem;
	background: none;
	border: 0;
	padding: 0;
	color: #2563eb;
	font-size: 0.8rem;
	cursor: pointer;
}

.fm-bell-empty {
	padding: 1rem 0.5rem;
	text-align: center;
	color: #64748b;
}

.fm-bell-all {
	display: block;
	text-align: center;
	padding: 0.55rem;
	font-weight: 600;
	text-decoration: none;
}

/* ---------- Kritischer Hinweis ---------- */

.fm-critical-banner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	flex-wrap: wrap;
	margin-bottom: 1rem;
}

/* ---------- Persönliche Liste ---------- */

.fm-notif-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
}

.fm-notif-item {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 0.75rem;
	flex-wrap: wrap;
	background: var(--fm-white, #fff);
	border: 1px solid rgba(100, 116, 139, 0.18);
	border-left: 4px solid transparent;
	border-radius: 0.6rem;
	padding: 0.75rem 0.9rem;
}

.fm-notif-item.is-unread {
	border-left-color: #3b82f6;
	background: rgba(59, 130, 246, 0.06);
}

.fm-notif-item.is-unread .fm-notif-title {
	font-weight: 700;
}

.fm-notif-item.is-urgent {
	border-left-color: #ef4444;
}

.fm-notif-main {
	flex: 1 1 18rem;
	min-width: 0;
}

.fm-notif-head {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	flex-wrap: wrap;
}

.fm-notif-title {
	font-size: 0.95rem;
}

.fm-notif-msg {
	margin: 0.3rem 0 0;
	color: #475569;
}

.fm-notif-meta {
	margin: 0.3rem 0 0;
	font-size: 0.8rem;
	color: #94a3b8;
}

.fm-notif-actions {
	flex: 0 0 auto;
}

@media (max-width: 640px) {
	.fm-notif-item {
		flex-direction: column;
	}

	.fm-notif-actions {
		width: 100%;
	}
}

/* ---------- Persönliche E-Mail-Einstellungen (ausklappbar) ---------- */

.fm-email-prefs {
	margin: 0.75rem 0;
}

.fm-email-prefs > summary {
	cursor: pointer;
	padding: 0.75rem 0.9rem;
	font-weight: 600;
	list-style: none;
}

.fm-email-prefs > summary::-webkit-details-marker {
	display: none;
}

.fm-email-prefs[open] > summary {
	border-bottom: 1px solid rgba(100, 116, 139, 0.15);
}

/* ---------- Dashboard-Widgets (Fristen/Benachrichtigungen) ---------- */

/*
 * Raster für die reichhaltigen Dashboard-Widgets (Filter 'fm_dashboard_widgets').
 * Mobile: eine Spalte; ab Tablet automatisch mehrspaltig. Mit #fm-app geprägt,
 * damit Karten-/Icon-Overrides die TailAdmin-Regeln sicher überschreiben.
 */
#fm-app .fm-grid-widgets {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
	gap: 1rem;
	margin-top: 1.25rem;
}

#fm-app .fm-widget {
	display: flex;
	flex-direction: column;
}

#fm-app .fm-widget .fm-card-body {
	flex: 1 1 auto;
}

/* Akzent-Streifen oben je nach Dringlichkeit des Widgets. */
#fm-app .fm-widget-danger {
	border-top: 3px solid #ef4444;
}

#fm-app .fm-widget-warning {
	border-top: 3px solid #f59e0b;
}

#fm-app .fm-widget-info {
	border-top: 3px solid #3b82f6;
}

#fm-app .fm-widget-neutral {
	border-top: 3px solid #94a3b8;
}

#fm-app .fm-widget-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
}

#fm-app .fm-widget-head .fm-card-title {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	margin: 0;
}

#fm-app .fm-widget-icon {
	display: inline-flex;
	color: #64748b;
}

#fm-app .fm-widget-icon .fm-icon {
	width: 1.15rem;
	height: 1.15rem;
}

#fm-app .fm-widget-empty {
	text-align: center;
	color: #64748b;
	padding: 1rem 0.5rem;
}

#fm-app .fm-widget-empty p {
	margin: 0;
}

#fm-app .fm-widget-foot {
	margin-top: auto;
	padding: 0.7rem 1.25rem;
	border-top: 1px solid rgba(100, 116, 139, 0.15);
}

#fm-app .fm-widget-foot a {
	font-size: 0.85rem;
	font-weight: 600;
	text-decoration: none;
}

/* Fristen-Liste innerhalb der Widgets. */
#fm-app .fm-dl-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

#fm-app .fm-dl-item {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 0.6rem;
	flex-wrap: wrap;
	padding: 0.5rem 0.6rem;
	border: 1px solid rgba(100, 116, 139, 0.16);
	border-left: 4px solid transparent;
	border-radius: 0.5rem;
}

#fm-app .fm-dl-item.is-overdue {
	border-left-color: #ef4444;
	background: rgba(239, 68, 68, 0.05);
}

#fm-app .fm-dl-item.is-today {
	border-left-color: #f59e0b;
	background: rgba(245, 158, 11, 0.05);
}

#fm-app .fm-dl-item.is-soon {
	border-left-color: #3b82f6;
}

#fm-app .fm-dl-main {
	flex: 1 1 12rem;
	min-width: 0;
}

#fm-app .fm-dl-title {
	font-size: 0.92rem;
	font-weight: 600;
}

#fm-app .fm-dl-title a {
	text-decoration: none;
}

#fm-app .fm-dl-meta {
	margin: 0.2rem 0 0;
	font-size: 0.78rem;
	color: #94a3b8;
}

#fm-app .fm-dl-side {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	flex-wrap: wrap;
	justify-content: flex-end;
}

#fm-app .fm-dl-date {
	font-size: 0.78rem;
	color: #64748b;
	white-space: nowrap;
}

/* Bereichsübersicht („Fristen nach Bereich“). */
#fm-app .fm-cat-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
}

#fm-app .fm-cat-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.6rem;
	padding: 0.45rem 0.5rem;
	border-radius: 0.5rem;
}

#fm-app .fm-cat-row:hover {
	background: rgba(100, 116, 139, 0.07);
}

#fm-app .fm-cat-link {
	display: inline-flex;
	align-items: center;
	gap: 0.55rem;
	min-width: 0;
	color: inherit;
	text-decoration: none;
}

#fm-app .fm-cat-icon {
	display: inline-flex;
	color: #64748b;
}

#fm-app .fm-cat-icon .fm-icon {
	width: 1.1rem;
	height: 1.1rem;
}

#fm-app .fm-cat-label {
	font-weight: 600;
	font-size: 0.9rem;
}

#fm-app .fm-cat-counts {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	flex: 0 0 auto;
}

@media (max-width: 640px) {
	#fm-app .fm-dl-item {
		flex-direction: column;
	}

	#fm-app .fm-dl-side {
		justify-content: flex-start;
	}
}

/* ---------- Protokoll / Diagnose ---------- */

/* Mehrspaltige Filterleiste (Zeitraum/Ereignis/Quelle/IDs/Suche) umbrechen. */
#fm-app .fm-toolbar-wrap {
	flex-wrap: wrap;
}

#fm-app .fm-log-settings {
	margin-bottom: 1rem;
}

#fm-app .fm-log-settings > summary {
	cursor: pointer;
	padding: 0.75rem 1rem;
	font-weight: 600;
	list-style: none;
}

#fm-app .fm-log-settings > summary::-webkit-details-marker {
	display: none;
}

#fm-app .fm-log-settings-form {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem 1rem;
	align-items: flex-end;
}

#fm-app .fm-log-purge {
	margin-top: 0.9rem;
	display: flex;
	align-items: center;
	gap: 0.6rem;
	flex-wrap: wrap;
}

/* Detailansicht eines Protokolleintrags. */
#fm-app .fm-detail-list {
	margin: 0;
}

#fm-app .fm-detail-row {
	display: grid;
	grid-template-columns: 12rem 1fr;
	gap: 0.5rem;
	padding: 0.5rem 0;
	border-bottom: 1px solid rgba(100, 116, 139, 0.12);
}

#fm-app .fm-detail-row dt {
	margin: 0;
	font-weight: 600;
	color: #475569;
}

#fm-app .fm-detail-row dd {
	margin: 0;
	min-width: 0;
	word-break: break-word;
}

#fm-app .fm-detail-payload-title {
	margin: 1rem 0 0.5rem;
}

#fm-app .fm-code {
	margin: 0;
	background: #0f172a;
	color: #e2e8f0;
	padding: 0.9rem 1rem;
	border-radius: 0.5rem;
	overflow-x: auto;
	font-size: 0.82rem;
	line-height: 1.5;
	white-space: pre-wrap;
	word-break: break-word;
}

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

@media (max-width: 640px) {
	#fm-app .fm-detail-row {
		grid-template-columns: 1fr;
		gap: 0.15rem;
	}
}
