/**
 * Stili del widget frontend.
 * Tutte le regole sono prefissate .htm- per non interferire con il tema.
 */

.htm-widget {
	--htm-border: #e0e3e7;
	--htm-text: #1f2328;
	--htm-muted: #656d76;
	--htm-alarm: #c62828;
	--htm-alarm-bg: #fdecea;
	--htm-ok: #2e7d32;
	--htm-radius: 10px;
	font-size: 15px;
	color: var(--htm-text);
	margin: 0 0 28px;
}

.htm-widget * {
	box-sizing: border-box;
}

.htm-widget__title {
	margin: 0 0 12px;
	font-size: 1.2em;
}

/* ---------- Toolbar ---------- */

.htm-toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 12px;
}

.htm-periods,
.htm-nav {
	display: flex;
	align-items: center;
	gap: 4px;
}

.htm-widget button {
	font: inherit;
	font-size: 0.86em;
	line-height: 1;
	padding: 8px 13px;
	border: 1px solid var(--htm-border);
	background: #fff;
	color: var(--htm-text);
	border-radius: 6px;
	cursor: pointer;
	transition: background .15s, border-color .15s;
}

.htm-widget button:hover:not(:disabled) {
	background: #f3f5f7;
}

.htm-widget button:disabled {
	opacity: .4;
	cursor: default;
}

.htm-period.is-active {
	background: #1f2328;
	border-color: #1f2328;
	color: #fff;
}

.htm-prev,
.htm-next {
	font-size: 1.2em;
	padding: 5px 12px;
}

.htm-label {
	min-width: 190px;
	text-align: center;
	font-weight: 600;
	font-size: .92em;
}

/* ---------- Grafico ---------- */

.htm-chart-wrap {
	position: relative;
	border: 1px solid var(--htm-border);
	border-radius: var(--htm-radius);
	padding: 8px;
	background: #fff;
}

.htm-canvas {
	width: 100%;
	height: 100%;
	display: block;
	touch-action: pan-y;
}

.htm-state {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, .82);
	color: var(--htm-muted);
	font-size: .9em;
	border-radius: var(--htm-radius);
}

.htm-state[hidden] {
	display: none;
}

.htm-tooltip {
	position: absolute;
	z-index: 5;
	pointer-events: none;
	background: rgba(28, 31, 35, .94);
	color: #fff;
	border-radius: 6px;
	padding: 8px 10px;
	font-size: .78em;
	line-height: 1.5;
	max-width: 280px;
	box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
}

.htm-tooltip[hidden] {
	display: none;
}

.htm-tooltip__time {
	font-weight: 700;
	margin-bottom: 4px;
	opacity: .9;
}

.htm-tooltip__row {
	display: flex;
	align-items: center;
	gap: 6px;
	white-space: nowrap;
}

.htm-tooltip__dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	flex: 0 0 auto;
}

.htm-tooltip__name {
	flex: 1 1 auto;
	overflow: hidden;
	text-overflow: ellipsis;
}

.htm-tooltip__value {
	font-variant-numeric: tabular-nums;
	font-weight: 600;
}

.htm-tooltip em {
	font-style: normal;
	opacity: .7;
	font-weight: 400;
}

.htm-partial {
	margin-top: 8px;
	font-size: .82em;
	color: var(--htm-muted);
	background: #fff8e1;
	border: 1px solid #ffe082;
	border-radius: 6px;
	padding: 7px 10px;
}

.htm-partial[hidden] {
	display: none;
}

/* ---------- Legenda ---------- */

.htm-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 10px 0 0;
}

.htm-legend__item {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 5px 10px !important;
	font-size: .8em !important;
}

.htm-legend__item.is-off {
	opacity: .4;
	text-decoration: line-through;
}

.htm-legend__dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	flex: 0 0 auto;
}

.htm-legend__dot--dashed {
	background: repeating-linear-gradient(90deg, #9aa0a6 0 3px, transparent 3px 6px);
	border-radius: 0;
	height: 3px;
	width: 14px;
}

.htm-legend__range {
	color: var(--htm-muted);
	font-variant-numeric: tabular-nums;
}

/* ---------- Tabella ---------- */

.htm-table-wrap {
	margin-top: 18px;
	overflow-x: auto;
	border: 1px solid var(--htm-border);
	border-radius: var(--htm-radius);
}

.htm-table {
	width: 100%;
	border-collapse: collapse;
	font-size: .86em;
	background: #fff;
	margin: 0;
}

.htm-table th,
.htm-table td {
	padding: 9px 10px;
	text-align: center;
	border-bottom: 1px solid var(--htm-border);
	font-variant-numeric: tabular-nums;
}

.htm-table thead th {
	background: #f6f8fa;
	font-weight: 600;
	font-size: .95em;
	color: var(--htm-muted);
	border-bottom: 1px solid var(--htm-border);
	white-space: nowrap;
}

.htm-table thead th.htm-sub {
	font-size: .85em;
	font-weight: 500;
	padding: 4px 10px 7px;
	text-transform: lowercase;
}

.htm-table .htm-col-name {
	text-align: left;
	min-width: 190px;
}

.htm-table tbody tr:last-child td {
	border-bottom: none;
}

.htm-table tbody tr:hover {
	background: #fafbfc;
}

.htm-row--alarm {
	background: var(--htm-alarm-bg) !important;
}

.htm-row--alarm .htm-name {
	color: var(--htm-alarm);
}

.htm-dot {
	display: inline-block;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	margin-right: 7px;
	vertical-align: middle;
}

.htm-name {
	font-weight: 600;
}

.htm-location,
.htm-limits,
.htm-time {
	display: block;
	font-size: .82em;
	color: var(--htm-muted);
	font-weight: 400;
	margin-left: 17px;
}

.htm-col-last strong {
	display: block;
	font-size: 1.05em;
}

.htm-col-last .htm-time {
	margin-left: 0;
}

.htm-badge {
	display: inline-block;
	padding: 3px 8px;
	border-radius: 999px;
	font-size: .78em;
	font-weight: 600;
	line-height: 1.5;
}

.htm-badge--ok {
	background: #e8f5e9;
	color: var(--htm-ok);
}

.htm-badge--alarm {
	background: var(--htm-alarm);
	color: #fff;
}

.htm-badge--info {
	background: #e3f2fd;
	color: #1565c0;
	margin-left: 4px;
}

.htm-empty {
	color: var(--htm-muted);
	padding: 22px 10px !important;
}

.htm-notice {
	padding: 14px;
	background: #f6f8fa;
	border-radius: 8px;
	color: #656d76;
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
	.htm-toolbar {
		justify-content: center;
	}

	.htm-label {
		min-width: 130px;
		font-size: .82em;
	}

	.htm-table {
		font-size: .78em;
	}

	.htm-table .htm-col-name {
		min-width: 150px;
	}
}
