/* Charts & KPI styles */
@charset "UTF-8";

.mail-doctor-card--chart {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.mail-doctor-card--chart .mail-doctor-chart-row {
	flex: 1 1 auto;
}

.mail-doctor-card--chart>.spinner {
	align-self: flex-start;
}

.mail-doctor-chart-row {
	display: flex;
	align-items: center;
	gap: 20px;
}

.mail-doctor-chart__canvas-wrap {
	position: relative;
	width: 130px;
	height: 130px;
	flex: 0 0 130px;
}

.mail-doctor-chart__canvas-wrap canvas {
	width: 100%;
	height: 100%;
	display: block;
}

.mail-doctor-chart__center {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	font-weight: 700;
	font-size: 18px;
	color: var(--mail-doctor-color-text);
	text-align: center;
	min-width: 48px;
}

.mail-doctor-chart-metrics {
	display: flex;
	flex-direction: column;
	gap: 6px;
	flex: 1 1 auto;
}

.mail-doctor-metric {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 6px 0;
	border-bottom: 1px dashed var(--mail-doctor-color-border);
}

.mail-doctor-metric:last-of-type {
	border-bottom: none;
}

.mail-doctor-metric__label {
	font-size: 13px;
	color: var(--mail-doctor-color-muted);
}

.mail-doctor-metric__value {
	font-weight: 600;
	font-size: 15px;
	color: var(--mail-doctor-color-text);
}

.mail-doctor-chart-legend {
	margin: 0;
	padding: 0;
	list-style: none;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.mail-doctor-chart-row>.mail-doctor-chart-legend {
	flex: 1 1 auto;
	min-width: 0;
}

.mail-doctor-chart-legend--stacked {
	margin-top: 10px;
	border-top: 1px solid var(--mail-doctor-color-border);
	padding-top: 10px;
}

.mail-doctor-chart-legend li {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 2px 0;
}

.mail-doctor-chart-label {
	flex: 1 1 auto;
	font-size: 13px;
	color: var(--mail-doctor-color-muted);
}

.mail-doctor-chart-legend strong {
	font-size: 14px;
	font-weight: 600;
	color: var(--mail-doctor-color-text);
}

.mail-doctor-chart-footnote {
	margin: 12px 0 0;
	font-size: 12px;
	color: var(--mail-doctor-color-muted);
}

.mail-doctor-card--chart .mail-doctor-chart-footnote {
	margin-top: auto;
	padding-top: 12px;
}

.mail-doctor-chart-dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	display: inline-block;
	margin-right: 8px;
}

.mail-doctor-chart-dot.is-sent {
	background: var(--mail-doctor-color-success);
}

.mail-doctor-chart-dot.is-failed {
	background: var(--mail-doctor-color-danger);
}

.mail-doctor-chart-dot.is-queued {
	background: var(--mail-doctor-color-accent);
}

.mail-doctor-chart-dot.is-quarantined {
	background: var(--mail-doctor-color-warning);
}

.mail-doctor-chart-dot.is-neutral {
	background: var(--mail-doctor-color-border);
}

@media (max-width: 782px) {
	.mail-doctor-chart-row {
		flex-direction: column;
		align-items: center;
		text-align: center;
	}

	.mail-doctor-chart__canvas-wrap {
		width: 140px;
		height: 140px;
	}

	.mail-doctor-chart-metrics {
		width: 100%;
		align-items: center;
		gap: 16px;
	}

	.mail-doctor-metric {
		width: 100%;
		justify-content: center;
		gap: 8px;
	}

	.mail-doctor-chart-legend {
		width: 100%;
	}

	.mail-doctor-chart-legend li {
		justify-content: center;
		gap: 16px;
	}
}

/* Stitch Layout Restructuring & Grid Rules */
#mail-doctor-status-stats .mail-doctor-chart-grid {
	display: grid;
	grid-template-columns: 1fr 180px;
	gap: 24px;
	align-items: center;
}


.mail-doctor-chart-visual-col {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
}

/* KPI Blocks & Detail Rows */
.mail-doctor-kpi-block {
	margin-bottom: 16px;
}

.mail-doctor-kpi-label {
	font-size: 13px;
	color: var(--mail-doctor-color-muted);
	display: block;
	margin-bottom: 4px;
}

.mail-doctor-kpi-rate-row {
	display: flex;
	align-items: baseline;
	gap: 12px;
}

.mail-doctor-kpi-value {
	font-size: 32px;
	font-weight: 700;
	color: var(--mail-doctor-color-text);
	line-height: 1;
}

.mail-doctor-trend-badge {
	display: inline-flex;
	align-items: center;
	padding: 2px 8px;
	border-radius: 12px;
	background: var(--mail-doctor-color-neutral-soft);
	border: 1px solid var(--mail-doctor-color-border);
}

.mail-doctor-trend-badge .mail-doctor-trend__delta {
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

/* KPI Secondary Meta Row */
.mail-doctor-kpi-meta-row {
	display: flex;
	gap: 24px;
	margin-bottom: 16px;
	border-top: 1px solid var(--mail-doctor-color-border);
	border-bottom: 1px solid var(--mail-doctor-color-border);
	padding: 12px 0;
}

.mail-doctor-kpi-meta-item {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.mail-doctor-kpi-meta-label {
	font-size: 11px;
	color: var(--mail-doctor-color-muted);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	font-weight: 600;
}

.mail-doctor-kpi-meta-value {
	font-size: 16px;
	font-weight: 700;
	color: var(--mail-doctor-color-text);
}

/* Sparkline wrap */
.mail-doctor-trend-sparkline-wrap {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.mail-doctor-trend-sparkline-wrap svg {
	width: 100%;
	height: 40px;
	display: block;
}

/* Queue Snapshot Stats Column */
.mail-doctor-queue-stats-col {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 16px;
	width: 100%;
}

.mail-doctor-queue-stat-item {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 16px;
	border: 1px solid var(--mail-doctor-color-border);
	border-radius: var(--mail-doctor-radius-md);
	background: var(--mail-doctor-color-neutral-soft);
	text-align: center;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.mail-doctor-queue-stat-item:hover {
	transform: translateY(-2px);
	box-shadow: var(--mail-doctor-shadow-sm);
}

.mail-doctor-queue-stat-label {
	font-size: 11px;
	color: var(--mail-doctor-color-muted);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	font-weight: 600;
}

.mail-doctor-queue-stat-value {
	font-size: 24px;
	font-weight: 700;
	color: var(--mail-doctor-color-text);
}

.mail-doctor-queue-stat-item.is-failed-block {
	background: rgba(186, 26, 26, 0.05);
	border-color: rgba(186, 26, 26, 0.15);
}

.mail-doctor-queue-stat-item.is-failed-block .mail-doctor-queue-stat-label {
	color: var(--mail-doctor-color-danger);
}

.mail-doctor-queue-stat-item.is-failed-block .mail-doctor-queue-stat-value {
	color: var(--mail-doctor-color-danger);
}

@media (max-width: 782px) {
	#mail-doctor-status-stats .mail-doctor-chart-grid {
		grid-template-columns: 1fr;
		gap: 20px;
		justify-items: center;
		text-align: center;
	}

	.mail-doctor-chart-metrics-col,
	.mail-doctor-queue-stats-col {
		width: 100%;
	}
	
	.mail-doctor-kpi-rate-row {
		justify-content: center;
	}

	.mail-doctor-kpi-meta-row {
		justify-content: center;
		gap: 32px;
	}
}

@media (max-width: 480px) {
	.mail-doctor-queue-stats-col {
		grid-template-columns: 1fr;
		gap: 12px;
	}
}