:root {
	font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	color: #182230;
	background: #f7f8fa;
	font-synthesis: none;
}

* {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	min-height: 100%;
	max-width: 100%;
	overflow-x: hidden;
}

body {
	background: #f7f8fa;
}

a {
	color: inherit;
	text-decoration: none;
}

button,
select {
	font: inherit;
}

button,
select,
summary {
	-webkit-tap-highlight-color: transparent;
}

.app-shell {
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.top-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	min-height: 4rem;
	padding: 0 2rem;
	background: #fff;
	border-bottom: 1px solid #e6e9ee;
}

.brand {
	display: inline-flex;
	align-items: center;
	gap: 0.65rem;
	font-weight: 700;
	letter-spacing: -0.025em;
}

.brand img {
	width: 1.65rem;
	height: 1.65rem;
	object-fit: contain;
}

.product-label,
.panel-help,
.summary-hint,
.device-seen,
.device-identity span,
.muted-value {
	color: #667085;
}

.page-content {
	width: min(1320px, 100%);
	min-width: 0;
	max-width: 100%;
	margin: 0 auto;
	padding: 2rem;
	flex: 1;
}

.dashboard-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 2rem;
	margin-bottom: 1.5rem;
	min-width: 0;
}

h1,
h2,
p {
	margin-top: 0;
}

h1 {
	margin-bottom: 0.45rem;
	font-size: clamp(2rem, 4vw, 2.75rem);
	line-height: 1.05;
	letter-spacing: -0.045em;
}

h2 {
	letter-spacing: -0.025em;
}

.subtitle {
	margin-bottom: 0;
	color: #2563eb;
}

.live-state {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.45rem 0.7rem;
	border: 1px solid #b7e4c7;
	border-radius: 999px;
	background: #f0faf4;
	color: #166534;
	font-size: 0.85rem;
	font-weight: 700;
	white-space: nowrap;
}

.live-dot {
	width: 0.5rem;
	height: 0.5rem;
	border-radius: 50%;
	background: #22a559;
}

.notice {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 1rem;
	padding: 0.8rem 1rem;
	border: 1px solid #f0d58a;
	border-radius: 0.75rem;
	background: #fffbeb;
	color: #694c00;
}

.control-bar {
	display: grid;
	grid-template-columns: minmax(14rem, 1.5fr) 0.65fr 1.25fr auto;
	align-items: end;
	gap: 1.25rem;
	min-width: 0;
	padding: 1rem 1.1rem;
	border: 1px solid #e1e5ea;
	border-radius: 0.9rem;
	background: #fff;
}

.device-picker,
.control-stat {
	min-width: 0;
}

.device-picker label,
.control-stat span,
.metric span,
.location-strip span {
	display: block;
	margin-bottom: 0.35rem;
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: #7b8494;
}

.control-stat strong {
	display: block;
	overflow: hidden;
	font-size: 0.95rem;
	text-overflow: ellipsis;
	white-space: nowrap;
}

select {
	width: 100%;
	min-height: 2.55rem;
	padding: 0.55rem 2.2rem 0.55rem 0.75rem;
	border: 1px solid #cfd5de;
	border-radius: 0.65rem;
	background: #fff;
	color: #182230;
}

select:focus-visible,
button:focus-visible,
summary:focus-visible {
	outline: 3px solid rgba(37, 99, 235, 0.2);
	outline-offset: 2px;
}

.control-actions {
	display: flex;
	justify-content: flex-end;
}

.icon-button {
	width: 2.55rem;
	height: 2.55rem;
	border: 1px solid #cfd5de;
	border-radius: 0.65rem;
	background: #fff;
	color: #344054;
	font-size: 1.2rem;
	cursor: pointer;
}

.icon-button:hover {
	border-color: #2563eb;
	color: #2563eb;
}

.device-management {
	margin: 0.75rem 0 1.25rem;
	border-bottom: 1px solid #e6e9ee;
}

.device-management summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 0.75rem 0.25rem;
	font-size: 0.9rem;
	font-weight: 650;
	cursor: pointer;
	list-style: none;
}

.device-management summary::-webkit-details-marker {
	display: none;
}

.device-management summary::after {
	content: "+";
	color: #667085;
	font-size: 1.15rem;
	font-weight: 400;
}

.device-management[open] summary::after {
	content: "−";
}

.device-list {
	padding-bottom: 0.75rem;
}

.device-row {
	display: grid;
	grid-template-columns: minmax(12rem, 1fr) minmax(12rem, 1fr) auto;
	align-items: center;
	gap: 1rem;
	padding: 0.7rem 0.25rem;
	border-top: 1px solid #edf0f3;
}

.device-identity {
	display: grid;
	gap: 0.15rem;
}

.device-identity span,
.device-seen,
.confirmation span {
	font-size: 0.85rem;
}

.confirmation {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 0.6rem;
	flex-wrap: wrap;
}

.text-button,
.danger-button {
	border-radius: 0.55rem;
	font-weight: 650;
	cursor: pointer;
}

.text-button {
	border: 0;
	padding: 0.35rem 0;
	background: transparent;
	color: inherit;
}

.text-button.neutral {
	color: #475467;
}

.text-button.danger-text {
	padding: 0.2rem 0;
	color: #b42318;
	font-size: 0.85rem;
	font-weight: 500;
}

.danger-button {
	border: 1px solid #b42318;
	padding: 0.45rem 0.65rem;
	background: #b42318;
	color: #fff;
}

.summary-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 0.75rem;
	margin-bottom: 1rem;
	min-width: 0;
}

.metric {
	min-width: 0;
	padding: 1rem 1.1rem;
	border: 1px solid #e1e5ea;
	border-radius: 0.8rem;
	background: #fff;
}

.metric strong {
	display: block;
	font-size: clamp(1.4rem, 2.5vw, 1.9rem);
	letter-spacing: -0.04em;
}

.charts-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0.9rem;
	margin-bottom: 1rem;
	min-width: 0;
}

.chart-panel {
	width: 100%;
	min-width: 0;
	max-width: 100%;
	min-height: 365px;
	padding: 0.2rem;
	border: 1px solid #e1e5ea;
	border-radius: 0.8rem;
	background: #fff;
	overflow: hidden;
}

.location-strip {
	display: grid;
	grid-template-columns: 2fr repeat(3, 1fr);
	gap: 1rem;
	min-width: 0;
	padding: 1rem 1.1rem;
	border: 1px solid #e1e5ea;
	border-radius: 0.8rem;
	background: #fff;
}

.location-strip strong {
	font-size: 0.95rem;
}

.empty-state {
	padding: 4rem 1.5rem;
	border: 1px dashed #cfd5de;
	border-radius: 0.9rem;
	background: #fff;
	text-align: center;
	color: #667085;
}

.empty-state h2 {
	margin-bottom: 0.5rem;
	color: #182230;
}

.empty-state p {
	margin-bottom: 0;
}

.empty-state.compact {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.75rem;
	padding: 2rem;
}

.loading-ring {
	width: 1.1rem;
	height: 1.1rem;
	border: 2px solid #d0d5dd;
	border-top-color: #2563eb;
	border-radius: 50%;
	animation: spin 0.8s linear infinite;
}

@keyframes spin {
	to { transform: rotate(360deg); }
}

.footer {
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	padding: 1rem 2rem;
	border-top: 1px solid #e6e9ee;
	background: #fff;
	color: #7b8494;
	font-size: 0.8rem;
}

@media (max-width: 920px) {
	.control-bar {
		grid-template-columns: 1.4fr 0.6fr 1fr auto;
	}

	.summary-grid,
	.charts-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.location-strip {
		grid-template-columns: 1fr 1fr;
	}
}

@media (max-width: 700px) {
	.product-label,
	.summary-hint {
		display: none;
	}

	.top-bar {
		display: flex;
		min-height: 3.5rem;
		padding: 0 1rem;
	}

	.page-content {
		display: block;
		width: 100%;
		padding: 1.25rem 1rem;
	}

	.dashboard-header {
		align-items: center;
		gap: 1rem;
	}

	.control-bar {
		grid-template-columns: 1fr 1fr auto;
		gap: 1rem;
	}

	.device-picker {
		grid-column: 1 / -1;
	}

	.device-row {
		grid-template-columns: minmax(0, 1fr) auto;
	}

	.device-seen {
		grid-column: 1 / -1;
		grid-row: 2;
	}

	.confirmation {
		grid-column: 1 / -1;
		justify-content: flex-start;
	}
}

@media (max-width: 520px) {
	.dashboard-header,
	.footer {
		flex-direction: column;
		align-items: flex-start;
	}

	.summary-grid,
	.charts-grid,
	.location-strip {
		grid-template-columns: 1fr;
	}

	.control-bar {
		grid-template-columns: 1fr auto;
	}

	.control-stat:nth-of-type(3) {
		grid-column: 1 / -1;
	}

	.chart-panel {
		min-height: 330px;
	}
}

@media (max-width: 380px) {
	.top-bar {
		padding: 0 0.75rem;
	}

	.brand {
		min-width: 0;
		font-size: 0.95rem;
	}

	.page-content {
		display: block;
		width: 100%;
		padding: 1rem 0.75rem;
	}

	h1 {
		font-size: 1.8rem;
	}

	.control-bar {
		grid-template-columns: minmax(0, 1fr) auto;
		gap: 0.75rem;
		padding: 0.85rem;
	}

	.control-stat {
		min-width: 0;
	}

	.control-stat strong {
		font-size: 0.88rem;
	}

	.device-row {
		grid-template-columns: minmax(0, 1fr);
	}

	.device-row > .text-button.danger-text {
		justify-self: start;
	}

	.chart-panel {
		min-height: 300px;
	}
}
