/* ---------------------------------------------------------------------------
   Feuille de style unique de l'application d'étiquetage.
   Écrite pour cette app : ni Bootstrap, ni thème externe, aucune requête réseau.
   --------------------------------------------------------------------------- */

:root {
	--fond:            #f4f6f8;
	--surface:         #ffffff;
	--bordure:         #e2e6ea;
	--bordure-forte:   #cbd2d9;

	--texte:           #1f2933;
	--texte-doux:      #6b7784;
	--texte-inverse:   #ffffff;

	--menu-fond:       #1f2933;
	--menu-fond-actif: #2c3a47;
	--menu-texte:      #cbd2d9;

	--accent:          #b3261e;
	--accent-sombre:   #8c1d17;
	--accent-doux:     #fdeceb;

	--succes:          #1b7f4b;
	--alerte:          #a8620a;

	--rayon:           8px;
	--rayon-petit:     5px;
	--ombre:           0 1px 2px rgba(31, 41, 51, .06), 0 2px 8px rgba(31, 41, 51, .05);

	--menu-largeur:    236px;
}

* { box-sizing: border-box; }

html, body {
	margin: 0;
	padding: 0;
}

body {
	background: var(--fond);
	color: var(--texte);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}

a {
	color: var(--accent);
	text-decoration: none;
}
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
	margin: 0 0 .6em;
	font-weight: 600;
	line-height: 1.25;
}
h1 { font-size: 22px; }
h2 { font-size: 19px; }
h3 { font-size: 17px; }
h4 { font-size: 15px; }

/* --- Ossature ----------------------------------------------------------- */

.menu {
	background: var(--menu-fond);
	color: var(--menu-texte);
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 0 20px;
	position: sticky;
	top: 0;
	z-index: 30;
}

.menu-titre {
	padding: 14px 20px 14px 0;
	margin-right: 8px;
	font-size: 15px;
	font-weight: 600;
	letter-spacing: .04em;
	text-transform: uppercase;
	color: var(--texte-inverse);
	white-space: nowrap;
}

.menu-liens {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex: 1;
	flex-wrap: wrap;
	gap: 2px;
}

.menu-liens a {
	display: block;
	padding: 15px 14px;
	color: var(--menu-texte);
	font-size: 14px;
	border-bottom: 3px solid transparent;
	white-space: nowrap;
}
.menu-liens a:hover {
	background: var(--menu-fond-actif);
	color: var(--texte-inverse);
	text-decoration: none;
}
.menu-liens a.actif {
	background: var(--menu-fond-actif);
	color: var(--texte-inverse);
	border-bottom-color: var(--accent);
	font-weight: 600;
}

.menu-pied {
	margin-left: auto;
	padding-left: 16px;
}
.menu-pied a {
	color: var(--menu-texte);
	font-size: 14px;
	white-space: nowrap;
}
.menu-pied a:hover { color: var(--texte-inverse); }

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

.entete {
	background: var(--surface);
	border-bottom: 1px solid var(--bordure);
	padding: 18px 28px;
}
.entete h1 { margin: 0; }

.fil {
	margin-top: 4px;
	font-size: 13px;
	color: var(--texte-doux);
}
.fil a { color: var(--texte-doux); }
.fil a:hover { color: var(--accent); }
.fil span + span::before {
	content: "›";
	margin: 0 7px;
	color: var(--bordure-forte);
}

.contenu {
	flex: 1;
	padding: 24px 28px 48px;
}

.bascule-menu {
	display: none;
	margin-left: auto;
	width: 40px;
	height: 40px;
	border: 1px solid rgba(255, 255, 255, .22);
	border-radius: var(--rayon-petit);
	background: transparent;
	color: var(--texte-inverse);
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
}

/* --- Barre d'actions ----------------------------------------------------- */

.barre {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 20px;
}
.barre-groupe {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
}

/* --- Boutons ------------------------------------------------------------- */

.btn {
	display: inline-block;
	padding: 8px 16px;
	border: 1px solid var(--bordure-forte);
	border-radius: var(--rayon-petit);
	background: var(--surface);
	color: var(--texte);
	font-size: 14px;
	font-family: inherit;
	line-height: 1.4;
	cursor: pointer;
	text-align: center;
}
.btn:hover {
	background: #f0f2f4;
	text-decoration: none;
	color: var(--texte);
}

.btn-principal {
	background: var(--accent);
	border-color: var(--accent);
	color: var(--texte-inverse);
	font-weight: 600;
}
.btn-principal:hover {
	background: var(--accent-sombre);
	border-color: var(--accent-sombre);
	color: var(--texte-inverse);
}

.btn-petit {
	padding: 5px 10px;
	font-size: 13px;
}

.btn-icone {
	padding: 5px 9px;
	font-size: 14px;
	line-height: 1;
}

.btn-danger:hover {
	background: var(--accent-doux);
	border-color: var(--accent);
	color: var(--accent);
}

/* --- Cartes -------------------------------------------------------------- */

.carte {
	background: var(--surface);
	border: 1px solid var(--bordure);
	border-radius: var(--rayon);
	box-shadow: var(--ombre);
	padding: 20px;
	margin-bottom: 20px;
}
.carte-titre {
	margin: -20px -20px 18px;
	padding: 14px 20px;
	border-bottom: 1px solid var(--bordure);
	font-size: 15px;
	font-weight: 600;
}

/* --- Grille -------------------------------------------------------------- */

.grille {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
	gap: 18px;
	align-items: start;
}

/* Formulaires techniques (modification, suppression) posés au milieu de la
   grille : sans cette règle ils occuperaient une cellule et troueraient la
   mise en page. display:none n'empêche pas leur envoi par script. */
.forme-cachee {
	display: none;
}

/* --- Vignette produit / famille ------------------------------------------ */

.vignette {
	background: var(--surface);
	border: 1px solid var(--bordure);
	border-radius: var(--rayon);
	box-shadow: var(--ombre);
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.vignette-image {
	display: block;
	width: 100%;
	height: 150px;
	object-fit: cover;
	background: #eceff1;
	border-bottom: 1px solid var(--bordure);
}

.vignette-nom {
	padding: 12px 14px 10px;
	font-size: 15px;
	font-weight: 600;
	color: var(--texte);
	word-break: break-word;
}

.vignette-corps {
	padding: 0 14px 14px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-top: auto;
}

.vignette-actions {
	display: flex;
	gap: 6px;
	align-items: center;
	padding-top: 4px;
	border-top: 1px solid var(--bordure);
	margin-top: 4px;
}

/* Bandeau de titre pour les familles / sous-familles. */
.vignette-bandeau {
	display: block;
	padding: 11px 14px;
	background: var(--menu-fond);
	color: var(--texte-inverse);
	font-weight: 600;
	font-size: 15px;
	text-align: center;
}
.vignette-bandeau:hover {
	background: var(--menu-fond-actif);
	color: var(--texte-inverse);
	text-decoration: none;
}

/* --- Formulaires --------------------------------------------------------- */

.champ {
	margin-bottom: 16px;
}
.champ > label {
	display: block;
	margin-bottom: 5px;
	font-size: 14px;
	font-weight: 600;
}
.champ .aide {
	margin: 4px 0 0;
	font-size: 13px;
	color: var(--texte-doux);
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="password"],
input[type="file"],
select,
textarea {
	width: 100%;
	max-width: 420px;
	padding: 8px 10px;
	border: 1px solid var(--bordure-forte);
	border-radius: var(--rayon-petit);
	background: var(--surface);
	color: var(--texte);
	font-size: 14px;
	font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
	outline: 2px solid var(--accent);
	outline-offset: -1px;
	border-color: var(--accent);
}

.champ-etroit input,
.champ-etroit select { max-width: 180px; }

.ligne-champs {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
}
.ligne-champs input { width: auto; }

.unite {
	color: var(--texte-doux);
	font-size: 14px;
}

/* --- Tableaux ------------------------------------------------------------ */

.tableau {
	width: 100%;
	border-collapse: collapse;
	background: var(--surface);
}
.tableau th,
.tableau td {
	padding: 9px 12px;
	border-bottom: 1px solid var(--bordure);
	text-align: left;
	vertical-align: middle;
}
.tableau th {
	font-size: 13px;
	font-weight: 600;
	color: var(--texte-doux);
	text-transform: uppercase;
	letter-spacing: .03em;
	background: #f7f9fa;
	border-bottom: 1px solid var(--bordure-forte);
}
.tableau tbody tr:last-child td { border-bottom: 0; }
.tableau input { max-width: 100%; }
.tableau-compact td,
.tableau-compact th { padding: 6px 8px; }

.tableau-encadre {
	border: 1px solid var(--bordure);
	border-radius: var(--rayon);
	overflow: hidden;
}

.zone-defilante { overflow-x: auto; }

/* --- Messages ------------------------------------------------------------ */

.message {
	padding: 12px 16px;
	border-radius: var(--rayon-petit);
	border: 1px solid var(--bordure-forte);
	background: var(--surface);
	margin-bottom: 18px;
	font-size: 14px;
}
.message-info {
	border-color: #b9d6ea;
	background: #eef6fc;
}
.message-vide {
	color: var(--texte-doux);
	text-align: center;
	padding: 32px;
}

/* --- Page de connexion --------------------------------------------------- */

.page-connexion {
	min-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: var(--menu-fond);
}
.bloc-connexion {
	width: 100%;
	max-width: 360px;
	background: var(--surface);
	border-radius: var(--rayon);
	box-shadow: 0 10px 40px rgba(0, 0, 0, .28);
	padding: 32px 28px;
}
.bloc-connexion h1 {
	text-align: center;
	font-size: 19px;
	margin-bottom: 24px;
}
.bloc-connexion input { max-width: none; }
.bloc-connexion .btn { width: 100%; }

/* --- Utilitaires --------------------------------------------------------- */

.doux  { color: var(--texte-doux); }
.centre { text-align: center; }
.mb0 { margin-bottom: 0; }

/* --- Petits écrans ------------------------------------------------------- */

@media (max-width: 900px) {
	.bascule-menu { display: block; }

	.menu {
		flex-wrap: wrap;
		padding: 0 16px;
	}
	.menu-titre { padding-right: 0; }

	/* Les liens passent sous la barre et se déplient au clic. */
	.menu-liens {
		display: none;
		flex: 0 0 100%;
		flex-direction: column;
		gap: 0;
		padding-bottom: 8px;
	}
	body.menu-ouvert .menu-liens { display: flex; }

	.menu-liens a {
		padding: 11px 8px;
		border-bottom: 0;
		border-left: 3px solid transparent;
	}
	.menu-liens a.actif {
		border-bottom-color: transparent;
		border-left-color: var(--accent);
	}

	.menu-pied {
		margin-left: 0;
		padding: 0 0 12px;
		flex: 0 0 100%;
		display: none;
	}
	body.menu-ouvert .menu-pied { display: block; }

	.entete { padding: 16px 20px; }
	.contenu { padding: 20px; }
}
