:root {
	--tblr-primary: #2A3680;
	--hexa-light-bg: #F4F6FA;
	--hexa-light-sidebar: #FFFFFF;
	--hexa-light-card: #FFFFFF;
	--hexa-light-surface: #EEF1F6;
	--hexa-light-primary: #2A3680;
	--hexa-light-primary-hover: #1C2455;
	--hexa-light-accent: #006B45;
	--hexa-light-text: #111827;
	--hexa-light-muted: #667085;
	--hexa-light-border: #DDE2EE;
	--hexa-light-row-hover: #EEF0FA;
	--hexa-light-selected: #E2E6F7;
	--hexa-dark-bg: #10131A;
	--hexa-dark-sidebar: #0B0E14;
	--hexa-dark-card: #171B24;
	--hexa-dark-surface: #202633;
	--hexa-dark-primary: #8FA0FF;
	--hexa-dark-primary-hover: #AAB6FF;
	--hexa-dark-accent: #72D7B0;
	--hexa-dark-text: #F7F8FB;
	--hexa-dark-muted: #AAB1C0;
	--hexa-dark-border: #303746;
	--hexa-dark-row-hover: #252C3A;
	--hexa-dark-selected: #2A3358;
	--auth-night-bg: var(--hexa-dark-bg);
	--auth-night-panel: var(--hexa-dark-card);
	--auth-night-panel-border: var(--hexa-dark-border);
	--auth-night-input: var(--hexa-dark-sidebar);
	--auth-accent: var(--hexa-dark-primary);
	--auth-accent-strong: var(--hexa-dark-primary-hover);
	--auth-muted: var(--hexa-dark-muted);
	--auth-ink: var(--hexa-dark-bg);
	--auth-day-bg: var(--hexa-light-bg);
	--auth-day-panel: var(--hexa-light-card);
	--auth-day-panel-border: var(--hexa-light-border);
	--auth-day-input: var(--hexa-light-surface);
}

body {
	letter-spacing: 0;
}

.brand-mark {
	align-items: center;
	background: var(--tblr-primary);
	border-radius: 6px;
	color: #fff;
	display: inline-flex;
	font-weight: 700;
	height: 2rem;
	justify-content: center;
	line-height: 1;
	width: 2rem;
}

.avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: inherit;
}

.navbar-brand {
	font-weight: 700;
	letter-spacing: 0;
}

.card {
	border-radius: 8px;
}

.btn,
.form-control,
.form-select {
	border-radius: 6px;
}

.table .avatar {
	flex: 0 0 auto;
}

.page-center .card {
	box-shadow: 0 1rem 3rem rgba(0, 0, 0, .12);
}

.auth-page {
	background: var(--auth-night-bg);
	color: var(--hexa-dark-text);
	min-height: 100vh;
}

[data-bs-theme="light"] .auth-page {
	background: var(--auth-day-bg);
	color: var(--hexa-light-text);
}

.auth-shell {
	align-items: center;
	display: flex;
	justify-content: center;
	min-height: 100vh;
	padding: 4rem 1.25rem;
}

.auth-panel {
	max-width: 360px;
	min-width: 0;
	width: 100%;
}

.auth-card {
	background: var(--auth-night-panel);
	border: 1px solid var(--auth-night-panel-border);
	border-radius: 8px;
	box-shadow: 0 18px 60px rgba(0, 0, 0, .18);
	padding: 2.4rem 2.55rem;
}

[data-bs-theme="light"] .auth-card {
	background: var(--auth-day-panel);
	border-color: var(--auth-day-panel-border);
	box-shadow: 0 18px 60px rgba(35, 52, 88, .12);
}

.auth-logo {
	align-items: center;
	color: var(--auth-accent);
	display: flex;
	font-size: 1.18rem;
	font-weight: 700;
	justify-content: center;
	margin: 0 auto 1.75rem;
	text-decoration: none;
}

.auth-logo:hover {
	color: var(--auth-accent-strong);
	text-decoration: none;
}

.auth-logo img {
	height: 42px;
	margin-right: .35rem;
	object-fit: contain;
	width: 42px;
}

.auth-logo span {
	padding-top: .12rem;
}

.auth-title {
	color: var(--hexa-dark-text);
	font-size: 1.12rem;
	font-weight: 700;
	letter-spacing: 0;
	margin: 0 0 1.25rem;
	text-align: center;
}

[data-bs-theme="light"] .auth-title {
	color: var(--hexa-light-text);
}

.auth-field {
	margin-bottom: 1.05rem;
}

.auth-field .form-label {
	align-items: center;
	color: var(--auth-muted);
	display: flex;
	font-size: .73rem;
	font-weight: 700;
	justify-content: space-between;
	letter-spacing: .085em;
	line-height: 1.3;
	margin-bottom: .55rem;
	text-transform: uppercase;
}

[data-bs-theme="light"] .auth-field .form-label {
	color: var(--hexa-light-muted);
}

.auth-field .form-label-description {
	font-size: .78rem;
	font-weight: 600;
	letter-spacing: 0;
	text-transform: none;
}

.auth-field a,
.auth-card-link a {
	color: var(--auth-accent);
	text-decoration: none;
}

.auth-field a:hover,
.auth-card-link a:hover {
	color: var(--auth-accent-strong);
	text-decoration: underline;
}

.auth-card .form-control {
	background: var(--auth-night-input);
	border-color: var(--hexa-dark-border);
	color: var(--hexa-dark-text);
	min-height: 2.55rem;
}

.auth-card .form-control:focus {
	border-color: var(--auth-accent);
	box-shadow: 0 0 0 .18rem rgba(143, 160, 255, .18);
}

.auth-card .form-control::placeholder {
	color: var(--hexa-dark-muted);
}

[data-bs-theme="light"] .auth-card .form-control {
	background: var(--auth-day-input);
	border-color: var(--hexa-light-border);
	color: var(--hexa-light-text);
}

.auth-card .input-group-flat .form-control {
	border-right: 0;
}

.auth-password-toggle {
	background: var(--auth-night-input);
	border-color: var(--hexa-dark-border);
	border-left: 0;
	color: var(--auth-accent);
	min-height: 2.55rem;
}

.auth-password-toggle:hover,
.auth-password-toggle:focus {
	background: var(--auth-night-input);
	border-color: var(--auth-accent);
	color: var(--auth-accent-strong);
}

[data-bs-theme="light"] .auth-password-toggle {
	background: var(--auth-day-input);
	border-color: var(--hexa-light-border);
}

.auth-submit {
	background: var(--hexa-dark-primary);
	border-color: var(--hexa-dark-primary);
	color: var(--hexa-dark-bg);
	font-weight: 700;
	min-height: 2.5rem;
}

.auth-submit:hover,
.auth-submit:focus {
	background: var(--hexa-dark-primary-hover);
	border-color: var(--hexa-dark-primary-hover);
	color: var(--hexa-dark-bg);
}

[data-bs-theme="light"] .auth-submit {
	background: var(--hexa-light-primary);
	border-color: var(--hexa-light-primary);
	color: #FFFFFF;
}

[data-bs-theme="light"] .auth-submit:hover,
[data-bs-theme="light"] .auth-submit:focus {
	background: var(--hexa-light-primary-hover);
	border-color: var(--hexa-light-primary-hover);
	color: #FFFFFF;
}

.auth-card-link {
	margin-top: 1rem;
	text-align: center;
}

.auth-card .alert {
	border-radius: 6px;
	font-size: .86rem;
}

.theme-toggle {
	align-items: center;
	background: transparent;
	border: 0;
	color: #a8b4c6;
	display: inline-flex;
	font-size: 1.3rem;
	height: 2.25rem;
	justify-content: center;
	position: fixed;
	right: 1.2rem;
	top: 1rem;
	width: 2.25rem;
	z-index: 20;
}

.theme-toggle:hover,
.theme-toggle:focus {
	color: var(--auth-accent);
	outline: none;
}

.theme-toggle-light {
	display: none;
}

[data-bs-theme="light"] .theme-toggle-dark {
	display: none;
}

[data-bs-theme="light"] .theme-toggle-light {
	display: inline-block;
}

.profile-password {
	border: 1px solid var(--hexa-dark-border);
	border-radius: 8px;
	padding: .85rem 1rem;
}

[data-bs-theme="light"] .profile-password {
	border-color: var(--hexa-light-border);
}

.profile-password summary {
	cursor: pointer;
	font-weight: 600;
}

.twofa-qr {
	background: #fff;
	border-radius: 8px;
	padding: .5rem;
	width: 260px;
	height: 260px;
}

@media (max-width: 575.98px) {
	.page-title {
		font-size: 1.35rem;
	}

	.btn {
		white-space: normal;
	}

	.auth-shell {
		justify-content: center;
		padding: 4.5rem 1rem 2rem;
	}

	.auth-card {
		padding: 2rem 1.25rem;
	}

	.auth-field .form-label {
		align-items: flex-start;
		flex-direction: column;
		gap: .25rem;
	}
}

/* --- Releves PunchArt ---------------------------------------------------- */

.punch-vignette {
    aspect-ratio: 1 / 1;
    object-fit: cover;
    width: 100%;
}

.punch-vignette--absente {
    background-color: var(--tblr-bg-surface-secondary, #f1f3f5);
    background-image: repeating-linear-gradient(
        135deg,
        transparent 0 8px,
        rgba(128, 128, 128, 0.16) 8px 9px
    );
}

.punch-mini {
    width: 3rem;
    height: 3rem;
    object-fit: cover;
    border-radius: 3px;
}

.punch-apercu {
    width: 100%;
    height: auto;
    border-radius: 3px;
}

.punch-ocr {
    max-height: 9rem;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.8rem;
    padding: 0.6rem;
    margin: 0;
    border: 1px solid var(--tblr-border-color, #dee2e6);
    border-radius: 4px;
    background: var(--tblr-bg-surface-secondary, #f8f9fa);
}

/* --- Compteur de modération dans le menu ---------------------------------- */

/* Tabler place cette pastille en position absolue, calée sur le bord droit de
   l'entrée — une pastille de notification posée sur une icône. Dans le menu
   replié en colonne, l'entrée occupe toute la largeur : la pastille se
   retrouvait donc contre le bord de l'écran, sous la flèche du sous-menu, et
   dépassait.

   La sortir du positionnement absolu suffit : elle reprend sa place dans le
   flux, à la suite du libellé, où elle se lit comme ce qu'elle est — un compte
   attaché à l'entrée, pas une alerte flottante.

   Le sélecteur reprend celui de Tabler — .navbar .navbar-nav .nav-link .badge,
   quatre classes — et qualifie la pastille par son élément. Une spécificité
   inférieure serait ignorée en silence, ce qui est arrivé aux tentatives
   précédentes : le CSS minifié laissait croire à trois classes, et la classe
   .navbar porte sur un div interne, pas sur le <header>. */
.navbar .navbar-nav .nav-link { min-width: 0; }
.navbar .navbar-nav .nav-link > .nav-link-title { flex: 0 1 auto; min-width: 0; }
.navbar .navbar-nav .nav-link > span.badge {
    position: static;
    flex: none;
    margin-left: 0.5rem;
    margin-right: auto;
    top: auto;
    right: auto;
    transform: none;
}

/* Même chose pour les entrées du sous-menu, où la pastille était collée à
   droite par ms-auto. */
.dropdown-menu .dropdown-item > .badge {
    flex: none;
    margin-left: 0.5rem;
}
.dropdown-menu .dropdown-item {
    display: flex;
    align-items: center;
    min-width: 0;
}

/* --- Carte de placement d'une zone ---------------------------------------- */

.zone-carte {
    height: 16rem;
    border: 1px solid var(--tblr-border-color, #dee2e6);
    border-radius: 4px;
}
.zone-carte .leaflet-container { border-radius: 4px; }

#geo_resultats { max-height: 14rem; overflow-y: auto; }
#geo_resultats .list-group-item { font-size: 0.85rem; line-height: 1.35; }

/* La carte ouverte en modification se distingue des autres. */
.card-active { outline: 2px solid var(--tblr-primary, #206bc4); }

/* --- Bascule de thème : une seule à la fois -------------------------------- */

/* Le bouton flottant est fixé en haut à droite, exactement là où l'en-tête
   place l'avatar une fois connecté : les deux se superposaient sur mobile,
   où la barre est plus étroite.

   Il n'a de sens que sur la page de connexion, qui n'a pas d'en-tête. Une fois
   connecté, c'est l'entrée du menu du compte qui prend le relais — même
   déclencheur [data-theme-toggle], même comportement. */
.app-page .theme-toggle {
    display: none;
}

/* --- Légendage en série --------------------------------------------------- */

.legende-photo {
    width: 100%;
    height: auto;
    max-height: 70vh;
    object-fit: contain;
    background: #000;
}

.legende-champ {
    font-size: 1.05rem;
    line-height: 1.5;
}

/* --- Journal de la reconnaissance de texte -------------------------------- */

.ocr-journal {
    max-height: 18rem;
    overflow-y: auto;
    font-size: 0.82rem;
    border: 1px solid var(--tblr-border-color, #dee2e6);
    border-radius: 4px;
    padding: 0.5rem;
}

.ocr-journal__ligne {
    display: flex;
    gap: 0.6rem;
    padding: 0.3rem 0.2rem;
    border-bottom: 1px solid var(--tblr-border-color-light, rgba(128,128,128,0.15));
}
.ocr-journal__ligne:last-child { border-bottom: 0; }

.ocr-journal__code {
    flex: none;
    font-family: var(--tblr-font-monospace, monospace);
    opacity: 0.7;
}

.ocr-journal__texte {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ocr-journal__vide {
    flex: 1;
    opacity: 0.45;
    font-style: italic;
}
