/* Tableau de bord des visites — styles limités au conteneur .tbv */

.tbv {
	--tbv-surface: #ffffff;
	--tbv-plane: #f9f9f9;
	--tbv-ink: #191919;
	--tbv-ink-2: #666666;
	--tbv-grid: #e7e7e7;
	--tbv-axis: #c2c2c2;
	--tbv-border: rgba(11, 11, 11, 0.1);
	--tbv-series-1: #257de0;
	--tbv-series-1-hover: #1b64be;
	--tbv-good: #006c10;
	--tbv-bad: #b3261e;
	container-type: inline-size;
	color: var(--tbv-ink);
	font-family: inherit;
	line-height: 1.45;
	text-align: left;
}

.tbv *,
.tbv *::before,
.tbv *::after {
	box-sizing: border-box;
}

.tbv p {
	margin: 0;
}

/* En-tête et filtres */
.tbv .tbv-head {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
	align-items: flex-end;
	justify-content: space-between;
	margin-bottom: 20px;
}

.tbv .tbv-title {
	margin: 0;
	color: var(--tbv-ink);
	font-size: 1.5rem;
	font-weight: 600;
	line-height: 1.2;
}

.tbv .tbv-sub {
	margin-top: 4px;
	color: var(--tbv-ink-2);
	font-size: 0.95rem;
}

.tbv .tbv-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 12px;
	align-items: flex-end;
	margin: 0;
}

.tbv .tbv-field {
	display: flex;
	flex-direction: column;
	gap: 4px;
	margin: 0;
	color: var(--tbv-ink-2);
	font-size: 0.8rem;
}

.tbv .tbv-field select {
	min-width: 9rem;
	height: auto;
	margin: 0;
	padding: 7px 10px;
	border: 1px solid var(--tbv-axis);
	border-radius: 6px;
	background-color: var(--tbv-surface);
	color: var(--tbv-ink);
	font: inherit;
	font-size: 0.95rem;
}

.tbv .tbv-btn {
	margin: 0;
	padding: 8px 18px;
	border: 1px solid var(--tbv-series-1);
	border-radius: 6px;
	background: var(--tbv-series-1);
	color: #ffffff;
	font: inherit;
	font-size: 0.95rem;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
}

.tbv .tbv-btn:hover {
	border-color: var(--tbv-series-1-hover);
	background: var(--tbv-series-1-hover);
}

.tbv .tbv-btn:focus-visible,
.tbv .tbv-field select:focus-visible,
.tbv a:focus-visible,
.tbv summary:focus-visible {
	outline: 2px solid var(--tbv-series-1);
	outline-offset: 2px;
}

/* Indicateurs */
.tbv .tbv-kpis {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 12px;
	margin-bottom: 16px;
}

.tbv .tbv-tile,
.tbv .tbv-card {
	border: 1px solid var(--tbv-border);
	border-radius: 12px;
	background: var(--tbv-surface);
}

.tbv .tbv-tile {
	padding: 16px;
}

.tbv .tbv-tile-label {
	margin-bottom: 6px;
	color: var(--tbv-ink-2);
	font-size: 0.85rem;
}

.tbv .tbv-tile-value {
	color: var(--tbv-ink);
	font-size: 1.6rem;
	font-weight: 600;
	line-height: 1.1;
}

.tbv .tbv-tile--hero .tbv-tile-value {
	font-size: clamp(2rem, 6cqi, 3rem);
}

.tbv .tbv-tile-meta {
	margin-top: 6px;
	color: var(--tbv-ink-2);
	font-size: 0.8rem;
}

.tbv .tbv-delta {
	font-weight: 600;
}

.tbv .tbv-delta--up {
	color: var(--tbv-good);
}

.tbv .tbv-delta--down {
	color: var(--tbv-bad);
}

/* Cartes et graphiques */
.tbv .tbv-card {
	margin: 0 0 16px;
	padding: 16px 16px 12px;
}

.tbv .tbv-card-title {
	margin: 0 0 12px;
	color: var(--tbv-ink);
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.3;
}

.tbv .tbv-card-note {
	margin: -4px 0 12px;
	color: var(--tbv-ink-2);
	font-size: 0.85rem;
}

.tbv .tbv-grid2 {
	display: grid;
	grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
	gap: 16px;
	margin-bottom: 16px;
}

.tbv .tbv-grid2 > .tbv-card {
	margin-bottom: 0;
}

.tbv .tbv-chart-box {
	position: relative;
	width: 100%;
	height: 300px;
}

.tbv .tbv-empty {
	padding: 32px 16px;
	color: var(--tbv-ink-2);
	text-align: center;
}

/* Barre segmentée : un tout, découpé en parties */
.tbv .tbv-seg {
	display: flex;
	gap: 2px;
	height: 28px;
	margin: 4px 0 14px;
}

.tbv .tbv-seg-part {
	display: flex;
	flex-basis: 0;
	align-items: center;
	min-width: 2px;
	padding: 0 6px;
	border-radius: 4px;
	font-size: 0.8rem;
	font-weight: 600;
	white-space: nowrap;
}

.tbv .tbv-legend {
	display: grid;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 0.9rem;
}

.tbv .tbv-legend li {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
}

.tbv .tbv-swatch {
	flex: none;
	width: 10px;
	height: 10px;
	border-radius: 2px;
}

.tbv .tbv-legend-val {
	margin-left: auto;
	color: var(--tbv-ink-2);
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

/* Tableaux */
.tbv .tbv-table-wrap {
	overflow-x: auto;
}

.tbv .tbv-table {
	width: 100%;
	margin: 0;
	border: 0;
	border-collapse: collapse;
	font-size: 0.9rem;
}

.tbv .tbv-table th,
.tbv .tbv-table td {
	padding: 8px 10px;
	border: 0;
	border-bottom: 1px solid var(--tbv-grid);
	background: transparent;
	color: var(--tbv-ink);
	text-align: left;
	vertical-align: top;
}

.tbv .tbv-table thead th {
	color: var(--tbv-ink-2);
	font-size: 0.8rem;
	font-weight: 600;
}

.tbv .tbv-table tfoot th,
.tbv .tbv-table tfoot td {
	border-bottom: 0;
	font-weight: 600;
}

.tbv .tbv-table .tbv-num {
	font-variant-numeric: tabular-nums;
	text-align: right;
	white-space: nowrap;
}

.tbv .tbv-table a {
	color: inherit;
	text-decoration: underline;
	text-decoration-color: var(--tbv-axis);
	text-underline-offset: 2px;
}

.tbv .tbv-table a:hover {
	text-decoration-color: currentColor;
}

.tbv .tbv-details summary {
	margin-top: 8px;
	color: var(--tbv-ink-2);
	font-size: 0.85rem;
	cursor: pointer;
}

.tbv .tbv-details[open] summary {
	margin-bottom: 8px;
}

/* Messages et pied */
.tbv .tbv-notice {
	padding: 12px 16px;
	border: 1px solid var(--tbv-border);
	border-left: 4px solid var(--tbv-series-1);
	border-radius: 8px;
	background: var(--tbv-plane);
}

.tbv .tbv-foot {
	margin-top: 4px;
	color: var(--tbv-ink-2);
	font-size: 0.8rem;
}

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

/* Petits écrans (selon la largeur du conteneur Elementor) */
@container (max-width: 760px) {
	.tbv .tbv-kpis {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

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

@container (max-width: 520px) {
	.tbv .tbv-col-type {
		display: none;
	}

	.tbv .tbv-table th,
	.tbv .tbv-table td {
		padding: 8px 6px;
	}
}

@container (max-width: 420px) {
	.tbv .tbv-kpis {
		grid-template-columns: minmax(0, 1fr);
	}

	.tbv .tbv-chart-box {
		height: 240px;
	}
}

@media print {
	.tbv .tbv-filters {
		display: none;
	}
}
