/* ============================================================================
   Vérification par exception après un scan de carte grise
   (_etape_verification_scan.xhtml, _verification_scan_groupe.xhtml).
   Colonne de lecture, lignes compactes à statut, feuille d'édition :
   volet à droite sur grand écran, panneau qui monte du bas sur téléphone.
   ========================================================================== */

.vx,
.vx-sheet {
	--vx-fg: #1a2226;
	--vx-muted: #5f6b70;
	--vx-faint: #9aa3a8;
	--vx-line: #e2e8ec;
	--vx-surface: #ffffff;
	--vx-sunk: #f7f8f9;
	--vx-accent: #8b1538;
	--vx-accent-dark: #6f1029;
	--vx-accent-soft: #f7e8ed;
	--vx-ok: #2e7d52;
	--vx-ok-soft: #e8f5ee;
	--vx-warn: #a14a07;
	--vx-warn-soft: #fef3c7;
	--vx-bad: #c62828;
	--vx-bad-soft: #fcebeb;
	--vx-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	color: var(--vx-fg);
}

.vx {
	max-width: 640px;
	margin: 8px auto 0;
	display: flex;
	flex-direction: column;
	gap: 14px;
}

/* ---------- Carte d'identité du véhicule ---------- */

.vx-id {
	display: flex;
	align-items: center;
	gap: 12px;
	background: var(--vx-surface);
	border: 1px solid var(--vx-line);
	border-radius: 14px;
	padding: 10px 12px;
}

.vx-id__thumb {
	position: relative;
	flex: none;
	width: 76px;
	aspect-ratio: 1.55;
	padding: 0;
	border: 1px solid var(--vx-line);
	border-radius: 8px;
	overflow: hidden;
	background: var(--vx-sunk);
	cursor: zoom-in;
}

.vx-id__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.vx-id__thumb i {
	position: absolute;
	right: 4px;
	bottom: 4px;
	font-size: 10px;
	color: #fff;
	background: rgba(0, 0, 0, 0.55);
	border-radius: 4px;
	padding: 2px 3px;
}

.vx-id__txt {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.vx-id__txt b {
	font-size: 15px;
	font-weight: 700;
	line-height: 1.25;
	overflow-wrap: anywhere;
}

.vx-id__txt span {
	font-size: 12.5px;
	color: var(--vx-muted);
}

.vx-plate {
	flex: none;
	font-family: var(--vx-mono);
	font-weight: 700;
	font-size: 12px;
	border: 1.5px solid var(--vx-fg);
	border-radius: 5px;
	padding: 2px 6px;
	white-space: nowrap;
	background: var(--vx-surface);
}

/* ---------- Compteurs ---------- */

.vx-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.vx-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	font-weight: 700;
	padding: 5px 10px;
	border-radius: 99px;
}

.vx-chip i {
	font-size: 10px;
}

.vx-chip--ok { background: var(--vx-ok-soft); color: var(--vx-ok); }
.vx-chip--warn { background: var(--vx-warn-soft); color: var(--vx-warn); }
.vx-chip--bad { background: var(--vx-bad-soft); color: var(--vx-bad); }

/* ---------- Groupes et lignes ---------- */

.vx-group {
	background: var(--vx-surface);
	border: 1px solid var(--vx-line);
	border-radius: 14px;
	overflow: hidden;
}

.vx-group__h {
	font-size: 11px;
	font-weight: 800;
	letter-spacing: 0.09em;
	text-transform: uppercase;
	color: var(--vx-muted);
	padding: 11px 14px 5px;
}

a.vx-row {
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: 52px;
	padding: 10px 14px;
	border-top: 1px solid var(--vx-line);
	color: var(--vx-fg);
	text-decoration: none;
	transition: background-color 0.15s ease;
}

.vx-group__h + a.vx-row {
	border-top: 0;
}

a.vx-row:hover {
	background: var(--vx-sunk);
	color: var(--vx-fg);
	text-decoration: none;
}

a.vx-row:focus-visible {
	outline: 2px solid var(--vx-accent);
	outline-offset: -2px;
}

.vx-row__st {
	flex: none;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	display: grid;
	place-items: center;
	font-size: 10px;
}

.vx-row__lb {
	flex: 1;
	min-width: 0;
	font-size: 13.5px;
	color: var(--vx-muted);
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.vx-row__motif {
	font-size: 12px;
	line-height: 1.35;
	font-weight: 600;
}

.vx-row__vl {
	max-width: 50%;
	font-size: 14px;
	font-weight: 700;
	text-align: right;
	overflow-wrap: anywhere;
}

.vx-row__chev {
	flex: none;
	color: var(--vx-faint);
	font-size: 12px;
}

.vx-row__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
}

.vx-row--ok .vx-row__st { background: var(--vx-ok-soft); color: var(--vx-ok); }

a.vx-row--warn { background: var(--vx-warn-soft); }
a.vx-row--warn:hover { background: #fdeab0; }
.vx-row--warn .vx-row__st { background: var(--vx-warn); color: #fff; }
.vx-row--warn .vx-row__motif { color: var(--vx-warn); }

/* Avertissement : signalé, mais ne retient pas l'utilisateur (pas de fond). */
.vx-row--avert .vx-row__st { border: 1.5px solid var(--vx-warn); color: var(--vx-warn); }
.vx-row--avert .vx-row__motif { color: var(--vx-warn); font-weight: 500; }

a.vx-row--bad { background: var(--vx-bad-soft); }
a.vx-row--bad:hover { background: #f8dcdc; }
.vx-row--bad .vx-row__st { background: var(--vx-bad); color: #fff; }
.vx-row--bad .vx-row__motif,
.vx-row--bad .vx-row__vl { color: var(--vx-bad); }

.vx-row--vide .vx-row__st { border: 1.5px dashed var(--vx-faint); color: var(--vx-faint); }
.vx-row--vide .vx-row__vl { color: var(--vx-accent); font-weight: 600; }

/* ---------- Bouton principal ---------- */

.vx-cta {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding-top: 4px;
}

.vx-cta small {
	text-align: center;
	color: var(--vx-muted);
	font-size: 12px;
}

.vx .vx-btn,
.vx-sheet .vx-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	min-height: 48px;
	padding: 0 16px;
	border-radius: 12px;
	border: 1.5px solid var(--vx-accent);
	background: var(--vx-accent);
	color: #fff;
	font-family: inherit;
	font-size: 15px;
	font-weight: 700;
	cursor: pointer;
	box-shadow: none;
	transition: background-color 0.15s ease;
}

.vx .vx-btn:hover,
.vx-sheet .vx-btn:hover {
	background: var(--vx-accent-dark);
	border-color: var(--vx-accent-dark);
	color: #fff;
}

.vx .vx-btn:focus-visible,
.vx-sheet .vx-btn:focus-visible {
	outline: 2px solid var(--vx-accent);
	outline-offset: 2px;
}

.vx-btn.ui-button .ui-button-text {
	padding: 0;
	font-weight: 700;
}

.vx-btn.ui-button .ui-button-icon-right {
	position: static;
	margin: 0;
}

.vx-sheet .vx-btn--ghost {
	background: transparent;
	color: var(--vx-accent);
}

.vx-sheet .vx-btn--ghost:hover {
	background: var(--vx-accent-soft);
	color: var(--vx-accent);
	border-color: var(--vx-accent);
}

/* Le bouton principal guide (revue puis « continuer ») : les boutons du wizard
   feraient doublon. Masqués seulement quand l'écran par exception est affiché
   (le wizard ne rend que l'étape courante). Navigateur sans :has() : ils
   restent visibles, le parcours fonctionne. */
.ui-wizard:has(.vx) .ui-wizard-navbar {
	display: none;
}

.vx-retour {
	align-self: center;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 44px;
	padding: 0 12px;
	border: 0;
	background: none;
	color: var(--vx-muted);
	font-family: inherit;
	font-size: 13.5px;
	font-weight: 600;
	cursor: pointer;
}

.vx-retour:hover {
	color: var(--vx-accent);
}

.vx-retour:focus-visible {
	outline: 2px solid var(--vx-accent);
	outline-offset: 2px;
	border-radius: 8px;
}

/* ---------- Feuille d'édition ---------- */

.vx-sheet.ui-sidebar {
	width: 440px;
	max-width: 100vw;
	padding: 0;
	background: var(--vx-surface);
	overflow-y: auto;
}

.vx-sheet .ui-sidebar-close {
	position: absolute;
	top: 16px;
	right: 16px;
	z-index: 2;
}

.vx-sheet__body {
	display: flex;
	flex-direction: column;
	gap: 14px;
	padding: 20px 20px 24px;
}

.vx-grab {
	display: none;
	width: 38px;
	height: 4px;
	border-radius: 4px;
	background: var(--vx-line);
	margin: -8px auto 0;
}

.vx-sheet__top {
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding-right: 36px;
}

.vx-sheet__top h2 {
	margin: 0;
	font-size: 18px;
	font-weight: 700;
	line-height: 1.25;
}

.vx-sheet__prog {
	font-size: 12px;
	font-weight: 700;
	color: var(--vx-muted);
}

/* Ce qui a été lu, sur fond « papier » pour rappeler la carte grise. */
.vx-lu {
	background: linear-gradient(160deg, #f1ecdf, #e6dec8);
	border-radius: 12px;
	padding: 10px 12px;
	display: flex;
	flex-direction: column;
	gap: 2px;
	color: #3c321e;
}

.vx-lu small {
	font-size: 10.5px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	opacity: 0.75;
}

.vx-lu__val {
	font-family: var(--vx-mono);
	font-size: 14px;
	font-weight: 700;
	overflow-wrap: anywhere;
}

.vx-motif {
	font-size: 13px;
	font-weight: 600;
	color: var(--vx-warn);
}

/* Contrôles : pleine largeur, 16 px pour éviter le zoom automatique d'iOS. */
.vx-ctrl .ui-inputfield,
.vx-ctrl input.vx-input,
.vx-ctrl .vx-input input,
.vx-ctrl .ui-datepicker input,
.vx-ctrl .ui-calendar input {
	width: 100%;
	min-height: 48px;
	font-size: 16px;
	border-radius: 10px;
}

.vx-ctrl .ui-selectonemenu.vx-input,
.vx-ctrl .ui-inputnumber.vx-input,
.vx-ctrl .ui-calendar,
.vx-ctrl .ui-datepicker {
	width: 100%;
}

.vx-ctrl .ui-selectonemenu.vx-input {
	min-height: 48px;
	display: flex;
	align-items: center;
	border-radius: 10px;
}

.vx-ctrl .ui-selectonemenu.vx-input .ui-selectonemenu-label {
	font-size: 16px;
}

.vx-ctrl input.vx-input--plaque {
	font-family: var(--vx-mono);
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

/* Pastilles de choix (genre, usage, énergie) */
.vx-choix {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.vx-choix--grille {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

.vx-opt {
	flex: 1 1 120px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-height: 64px;
	padding: 10px 6px;
	border: 1.5px solid var(--vx-line);
	border-radius: 12px;
	background: var(--vx-surface);
	color: var(--vx-fg);
	font-family: inherit;
	font-size: 12.5px;
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	cursor: pointer;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.vx-opt i {
	font-size: 18px;
	color: var(--vx-muted);
}

.vx-opt:hover {
	border-color: var(--vx-accent);
}

.vx-opt:focus-visible,
.vx-choix .color-card:focus-visible {
	outline: 2px solid var(--vx-accent);
	outline-offset: 2px;
}

.vx-opt--on {
	border-color: var(--vx-accent);
	background: var(--vx-accent-soft);
	color: var(--vx-accent);
}

.vx-opt--on i {
	color: var(--vx-accent);
}

/* Cartes de couleur existantes (auto-cotation.css), ici en <button>. */
.vx-choix button.color-card {
	font-family: inherit;
	display: flex;
	flex-direction: column;
	align-items: stretch;
}

/* Compteurs +/− */
.vx-ctrl .vx-spinner {
	width: 100%;
	display: flex;
	align-items: stretch;
}

.vx-ctrl .vx-spinner .ui-spinner-input {
	flex: 1;
	min-width: 0;
	min-height: 52px;
	text-align: center;
	font-size: 20px;
	font-weight: 700;
}

.vx-ctrl .vx-spinner .ui-spinner-button {
	width: 52px;
	min-height: 52px;
}

.vx-alerte {
	display: flex;
	gap: 8px;
	align-items: flex-start;
	background: var(--vx-warn-soft);
	color: var(--vx-warn);
	border-radius: 10px;
	padding: 10px 12px;
	font-size: 13px;
	font-weight: 600;
}

.vx-alerte i {
	margin-top: 2px;
}

.vx-acts {
	display: grid;
	grid-template-columns: 1fr 1.4fr;
	gap: 8px;
	margin-top: 4px;
}

.vx-acts--seul {
	grid-template-columns: 1fr;
}

/* ---------- Téléphone ---------- */

@media (max-width: 768px) {
	/* En-tête collé en haut au défilement : la photo et la plaque restent visibles. */
	.vx-id {
		position: sticky;
		top: 0;
		z-index: 5;
		box-shadow: 0 6px 16px -10px rgba(0, 0, 0, 0.35);
	}

	/* Le volet de droite devient un panneau qui monte du bas. */
	.vx-sheet.ui-sidebar-right {
		top: auto;
		bottom: 0;
		left: 0;
		right: 0;
		width: 100%;
		height: auto;
		max-height: 88vh;
		border-radius: 20px 20px 0 0;
		transform: translateY(100%);
		padding-bottom: env(safe-area-inset-bottom, 0px);
	}

	.vx-sheet.ui-sidebar-right.ui-sidebar-active {
		transform: translateY(0);
	}

	.vx-grab {
		display: block;
	}
}

@media (max-width: 380px) {
	.vx-choix--grille {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.vx-row__vl {
		max-width: 45%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.vx-sheet.ui-sidebar,
	a.vx-row,
	.vx-opt {
		transition: none;
	}
}
