.sleep-graph-legend {
	margin-bottom: 8px;
	font-size: 1rem;
	font-weight: 500;
	color: white;
	display: flex;
	align-items: center;
	gap: 0.5em;
}
.legend-dot {
	display: inline-block;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	margin-right: 6px;
	vertical-align: middle;
}


html, body {
	height: 100%;
	margin: 0;
	padding: 0;
	font-family: 'Roboto', Arial, Helvetica, sans-serif;
	background: #f4f8fb;
	color: #222;
}

body {
	min-height: 100vh;
	background: linear-gradient(135deg, #e3ecf7 0%, #f4f8fb 100%);
	margin: 0;
	padding: 0;
}

.overview-container {
	max-width: 640px;
	margin: 0 auto;
	padding: 0 0 32px 0;
	background: #fff;
	border-radius: 32px;
	box-shadow: 0 4px 24px rgba(44, 62, 80, 0.10);
	display: flex;
	flex-direction: column;
	align-items: stretch;
	min-height: 100vh;
}

/* Header */
.overview-header {
	display: flex;
	align-items: center;
	padding: 32px 32px 0 32px;
	background: transparent;
}
.overview-logo {
	display: flex;
	align-items: center;
	gap: 12px;
}
.logo-img {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: #e0f7fa;
}
.overview-app-title {
	font-size: 2rem;
	font-weight: 700;
	color: #222;
	letter-spacing: 0.5px;
}

/* AHI Arc */
.overview-ahi-arc {
	display: flex;
	justify-content: center;
	align-items: center;
	margin-top: 8px;
	margin-bottom: 36px; /* increase room below the arc so interpretation doesn't collide */
}
.ahi-arc {
	position: relative;
	width: 320px;
	height: auto; /* allow arc container to grow when interpretation takes more lines */
	margin: 0 auto;
}
#ahiArc {
	width: 100%;
	height: 100%;
	display: block;
}
.ahi-arc__value {
	position: absolute;
	top: 54px;
	left: 0;
	width: 100%;
	text-align: center;
	font-size: 3.2rem;
	font-weight: 700;
	color: #1976d2;
	z-index: 2;
	margin-top: 25px;
}
.ahi-arc__interpretation {
	position: static; /* flow element so it pushes cards down instead of overlapping */
	display: block;
	margin-top: 8px;
	max-width: 320px;
	text-align: center;
	font-size: 0.92rem;
	font-weight: 500;
	color: #222;
	line-height: 1.25;
	word-break: break-word;
	padding: 2px 12px 8px 12px;
	box-sizing: border-box;
	/* allow up to 3 lines without truncation */
	max-height: calc(1.25em * 3);
	overflow: visible;
}

/* Cards */
.overview-cards {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
	justify-content: center;
	margin: 8px 16px 0 16px;
}
.overview-card {
	flex: 1 1 180px;
	min-width: 180px;
	max-width: 220px;
	background: #e3ecf7;
	border-radius: 22px;
	padding: 18px 18px 12px 18px;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	box-shadow: 0 2px 12px rgba(25, 118, 210, 0.07);
	position: relative;
	margin-bottom: 0;
}
.card-blue { background: #2196f3; color: #fff; }
.card-blue2 { background: #1976d2; color: #fff; }
.card-purple { background: #512da8; color: #fff; }
.card-pink { background: #ad1457; color: #fff; }
.card-icon {
	font-size: 2rem;
	margin-bottom: 4px;
}
.card-label {
	font-size: 1.05rem;
	font-weight: 500;
	margin-bottom: 2px;
	letter-spacing: 0.2px;
}
.card-value {
	font-size: 2.2rem;
	font-weight: 700;
	margin-bottom: 8px;
}
.card-more {
	display: inline-flex;
	align-items: center;
	background: #fff;
	color: #222;
	border-radius: 18px;
	padding: 4px 16px;
	font-size: 1rem;
	font-weight: 600;
	text-decoration: none;
	margin-top: 4px;
	box-shadow: 0 1px 4px rgba(25, 118, 210, 0.04);
	transition: background 0.2s;
	border: none;
	cursor: pointer;
}
.card-more span {
	font-size: 1.2em;
	margin-left: 6px;
}
.card-more:hover {
	background: #e3ecf7;
}

/* Advice Card */
.overview-advice {
	margin: 18px 16px 0 16px;
}
.advice-card {
	background: linear-gradient(90deg, #1976d2 0%, #388e3c 100%);
	color: #fff;
	border-radius: 22px;
	padding: 18px 18px 12px 18px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	box-shadow: 0 2px 12px rgba(25, 118, 210, 0.07);
	margin-bottom: 0;
}
.advice-icon {
	font-size: 2rem;
	margin-right: 12px;
}
.advice-title {
	font-size: 1.3rem;
	font-weight: 700;
	flex: 1;
}
.advice-more {
	display: inline-flex;
	align-items: center;
	background: #fff;
	color: #1976d2;
	border-radius: 18px;
	padding: 4px 16px;
	font-size: 1rem;
	font-weight: 600;
	text-decoration: none;
	margin-left: 16px;
	box-shadow: 0 1px 4px rgba(25, 118, 210, 0.04);
	transition: background 0.2s;
	border: none;
	cursor: pointer;
}
.advice-more span {
	font-size: 1.2em;
	margin-left: 6px;
}
.advice-more:hover {
	background: #e3ecf7;
}

/* Sleep Overview Card */

.overview-sleep-graph {
	margin: 18px 16px 0 16px;
	display: flex;
	flex-direction: column;
	gap: 18px;
	background: linear-gradient(120deg, #e3ecf7 0%, #dbeafe 100%);
	border-radius: 22px;
	box-shadow: 0 2px 12px rgba(25, 118, 210, 0.07);
	padding: 18px 0 18px 0;
}
.sleep-graph-title {
	font-size: 1.3rem;
	font-weight: 700;
	margin-bottom: 12px;
	color: #1976d2;
	letter-spacing: 0.5px;
}
.sleep-graph-card {
	background: #fff;
	color: #222;
	border-radius: 18px;
	padding: 14px 12px 10px 12px;
	box-shadow: 0 2px 12px rgba(25, 118, 210, 0.07);
	margin-bottom: 0;
	margin-top: 0;
	margin-right: 0;
	margin-left: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.sleep-graph-card .sleep-graph-title {
	margin-bottom: 6px;
	font-size: 1.1rem;
	color: #2196f3;
	font-weight: 600;
}
#spo2OverviewChart, #heartRateOverviewChart, #eyeblinkOverviewChart {
	width: 100% !important;
	min-height: 80px;
	max-height: 120px;
	background: #f4f8fb;
	border-radius: 10px;
	box-shadow: 0 1px 4px rgba(25, 118, 210, 0.04);
	display: block;
	margin: 0 auto;
}

/* Chart color accent for each card */
.sleep-graph-card:nth-child(2) .sleep-graph-title { color: #2196f3; }
.sleep-graph-card:nth-child(3) .sleep-graph-title { color: #ffb74d; }
.sleep-graph-card:nth-child(4) .sleep-graph-title { color: #512da8; }

@media (max-width: 600px) {
	.overview-sleep-graph {
		 margin: 12px 4vw 0 4vw;
		 gap: 10px;
	}
	.sleep-graph-card {
		 padding: 10px 4px 8px 4px;
		 border-radius: 12px;
	}
	.sleep-graph-title {
		 font-size: 1.05rem;
	}
	#spo2OverviewChart, #heartRateOverviewChart, #eyeblinkOverviewChart {
		 min-height: 60px;
		 max-height: 90px;
	}
}

@media (max-width: 600px) {
	.overview-container {
		max-width: 100vw;
		border-radius: 0;
		padding: 0 0 24px 0;
	}
	.overview-header {
		padding: 18px 8px 0 8px;
	}
	.ahi-arc {
		width: 98vw;
		max-width: 340px;
		height: 140px;
	}

	.ahi-arc__interpretation {
		/* slightly smaller text on small screens and keep clamp */
		font-size: 0.82rem;
		max-width: 84%;
		top: calc(100% - 40px);
	}
	.overview-cards {
		flex-direction: column;
		gap: 10px;
		margin: 8px 4vw 0 4vw;
	}
	.overview-card {
		min-width: 0;
		max-width: 100vw;
		padding: 14px 10px 10px 10px;
	}
	.overview-advice, .overview-sleep-graph {
		margin: 12px 4vw 0 4vw;
	}
	.advice-card, .sleep-graph-card {
		padding: 14px 10px 10px 10px;
	}
	.sleep-graph-title {
		font-size: 1.1rem;
	}
}