/* =========================================================
   01 — Variables globales / thème Chand’Hôme
========================================================= */  

:root {
	--bg: #f4efe6;
	--paper: #fffaf1;
	--ink: #2f2922;
	--muted: #776b5d;
	--line: #e1d3bf;
	--wood: #c98d55;
	--wood-dark: #8a5734;
	--accent: #7f5a38;
	--green: #8aa07a;
	--blue: #7c95a8;
	--rose: #b9847c;
	--gold: #c9a15c;
	--shadow: 0 18px 45px rgba(61, 43, 26, .14);
	--app-max-width: 1180px;
}

/* ===== HEADER CHAND’HÔME / FICHES ATELIER ===== */

/* =========================================================
   02 — Header / identité Chand’Hôme
========================================================= */

.sheet-header {
  position: relative;
  display: grid;
  grid-template-columns: 1.18fr 0.82fr;
  gap: 20px;
  align-items: start;
  max-width: var(--app-max-width);
  margin: 0 auto;
  padding: 34px 22px 20px;
}

.brand {
  margin: 0 0 4px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(30px, 5vw, 52px);
  font-weight: 600;
  letter-spacing: 0.03em;
}

.eyebrow {
  font-size: 10px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--sage, #7f8f74);
  margin-bottom: 6px;
}

.tagline {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  max-width: 760px;
  line-height: 1.5;
}

.title-box {
  position: relative;
  text-align: right;
  padding-top: 8px;
}

.geo {
  position: absolute;
  right: -12px;
  top: -22px;
  width: 170px;
  height: 170px;
  opacity: 0.28;
  pointer-events: none;
}

.title-main {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
  letter-spacing: 0.18em;
  font-weight: 500;
}

.subtitle-header {
  margin-top: 6px;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8a857f;
}

/* =========================================================
   12 — Responsive mobile / tablette
========================================================= */

@media (max-width: 760px) {
  .sheet-header {
    grid-template-columns: 1fr;
  }

  .title-box {
    text-align: left;
  }

  .geo {
    right: 0;
    top: -18px;
    width: 210px;
    height: 210px;
  }
}

/* =========================================================
   03 — Base générique page / body / layout
========================================================= */

* {
	box-sizing: border-box
}

body {
	margin: 0;
	background: radial-gradient(circle at top left, #fff9ed 0, #f3ebdc 42%, #e8dcc8 100%);
	color: var(--ink);
	font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

header {
	padding: 34px 22px 12px;
	max-width: var(--app-max-width);
	margin: auto;
}

.eyebrow {
	letter-spacing: .16em;
	text-transform: uppercase;
	color: var(--accent);
	font-size: 12px;
	font-weight: 700
}

h1 {
	margin: 8px 0 10px;
	font-family: Georgia, serif;
	font-size: clamp(30px, 5vw, 58px);
	line-height: .98
}

.subtitle {
	max-width: 840px;
	color: var(--muted);
	font-size: 17px;
	line-height: 1.55
}

main {
	max-width: var(--app-max-width);
	margin: 0 auto 60px;
	padding: 10px 22px 40px
}

.panel {
	background: rgba(255, 250, 241, .84);
	backdrop-filter: blur(8px);
	border: 1px solid rgba(127, 90, 56, .18);
	border-radius: 28px;
	box-shadow: var(--shadow);
}

/* =========================================================
   04 — Contrôles / paramètres atelier
========================================================= */

.controls {
	display: grid;
	grid-template-columns: repeat(6, minmax(120px, 1fr));
	gap: 14px;
	padding: 18px;
	margin: 16px 0 24px;
}

label {
	font-size: 12px;
	color: var(--muted);
	font-weight: 700;
	letter-spacing: .06em;
	text-transform: uppercase;
	display: block;
	margin: 0 0 7px
}

select,
input {
	width: 100%;
	border: 1px solid var(--line);
	background: #fffdf8;
	border-radius: 14px;
	padding: 11px 12px;
	font-size: 15px;
	color: var(--ink);
	outline: none;
}

button {
	border: 0;
	background: #2c2c2c;
	/* couleur fixe fiable */
	color: white;
	border-radius: 8px;
	padding: 10px 14px;
	font-weight: 600;
	cursor: pointer;
	align-self: end;
}

button:hover {
	background: #444;
}

.note {
	padding: 0 18px 18px;
	color: var(--muted);
	font-size: 13px;
	line-height: 1.45;
}

/* =========================================================
   05 — Tabs / navigation globale / focus
========================================================= */

.tabs {
	display: flex;
	gap: 10px;
	margin: 20px 0 16px;
	flex-wrap: wrap
}

.tab {
	padding: 11px 15px;
	border-radius: 999px;
	border: 1px solid var(--line);
	background: #fffaf1;
	cursor: pointer;
	font-weight: 700;
	color: var(--muted);
}

.tab.active {
	background: var(--ink);
	color: #fffaf1;
	border-color: var(--ink)
}

.grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
	gap: 18px;
}

/* =========================================================
   06 — Cartes segments génériques
========================================================= */

.segment-card {
	position: relative;
	padding: 18px;
	overflow: hidden;
}

.segment-card:before {
	content: "";
	position: absolute;
	inset: auto -40px -64px auto;
	width: 180px;
	height: 180px;
	border-radius: 50%;
	background: rgba(201, 141, 85, .10);
}

.card-top {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 14px;
	margin-bottom: 14px
}

.seg-id {
	width: 52px;
	height: 52px;
	border-radius: 18px;
	display: grid;
	place-items: center;
	font-family: Georgia, serif;
	font-size: 28px;
	font-weight: 700;
	background: var(--color, #8aa07a);
	color: white;
	box-shadow: 0 10px 22px rgba(0, 0, 0, .12);
}

.meta h3 {
	margin: 0;
	font-size: 18px
}

.meta p {
	margin: 4px 0 0;
	color: var(--muted);
	font-size: 13px
}

.focus {
	display: grid;
	grid-template-columns: minmax(320px, 1.1fr) minmax(280px, .9fr);
	gap: 18px;
	margin-bottom: 22px;
}

.focus .segment-card {
	min-height: 330px
}

.detail-table {
	padding: 20px;
}

.detail-table h2 {
	font-family: Georgia, serif;
	margin: 0 0 12px;
	font-size: 28px
}

table {
	width: 100%;
	border-collapse: separate;
	border-spacing: 0 8px
}

td {
	padding: 10px 12px;
	background: #fffdf8;
	border-top: 1px solid rgba(127, 90, 56, .13);
	border-bottom: 1px solid rgba(127, 90, 56, .13)
}

td:first-child {
	border-left: 1px solid rgba(127, 90, 56, .13);
	border-radius: 12px 0 0 12px;
	color: var(--muted);
	font-weight: 700
}

td:last-child {
	border-right: 1px solid rgba(127, 90, 56, .13);
	border-radius: 0 12px 12px 0;
	text-align: right;
	font-weight: 900
}

.hidden {
	display: none
}

@media (max-width:850px) {
	.controls {
		grid-template-columns: 1fr 1fr
	}

	.focus {
		grid-template-columns: 1fr
	}
}

/* =========================================================
   13 — Impression / print layout
========================================================= */

@media print {
	body {
		background: white
	}

	header,
	.controls,
	.tabs,
	.note {
		display: none
	}

	main {
		max-width: none;
		margin: 0;
		padding: 0
	}

	.panel {
		box-shadow: none
	}

	.segment-card {
		break-inside: avoid
	}
}


/* --- Version image atelier réelle + valeurs dynamiques --- */
.grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(760px, 1fr));
	gap: 26px;
}

/* =========================================================
   07 — Mode atelier réel / image bois / pièce technique
========================================================= */

.segment-card.atelier-card {
	background: #fff;
	box-shadow: none;
	border: 0;
	border-radius: 0;
	padding: 18px 20px 30px;
	min-height: 285px;
	overflow: visible;
}

.segment-card.atelier-card:before {
	display: none
}

.atelier-row {
	position: relative;
	display: grid;
	grid-template-columns: 86px minmax(660px, 1fr);
	align-items: center;
	gap: 10px;
}

.side-label {
	font-weight: 900;
	color: var(--fam, #d00000);
	font-size: 22px;
	line-height: 1.55;
	align-self: center;
	padding-top: 12px;
}

.piece-zone {
	position: relative;
	width: 849px;
	height: 243px;
	max-width: 100%;
	transform-origin: left center;
}

.segment-bg {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: contain;
	pointer-events: none;
	user-select: none;
}

.prehole {
	position: absolute;
	top: 2px;
	right: 98px;
	color: #0070c0;
	font-weight: 800;
	font-size: 13px;
	white-space: nowrap;
	z-index: 4;
}


.cut-label {
	position: absolute;
	z-index: 5;
	left: 50%;
	top: 121px;
	transform: translate(-50%, -50%);
	color: #111;
	font-weight: 600;
	font-size: 11px;
	white-space: nowrap;
}

.angle-label {
	position: absolute;
	z-index: 5;
	color: #000;
	font-weight: 900;
	font-size: 17px;
	white-space: nowrap;
}

.total-note {
	position: absolute;
	left: 50%;
	bottom: -5px;
	transform: translateX(-50%);
	text-align: center;
	font-size: 12px;
	line-height: 1.45;
	color: #000;
	white-space: nowrap;
	z-index: 5;
}

.focus .segment-card.atelier-card {
	min-height: 330px;
	padding-top: 22px
}

.focus .piece-zone {
	transform: scale(1.08);
	transform-origin: left center;
	margin: 0 auto 14px
}

.focus .atelier-row {
	grid-template-columns: 86px minmax(660px, 1fr)
}

@media(max-width:980px) {
	.grid {
		grid-template-columns: 1fr
	}

	.atelier-row {
		grid-template-columns: 58px 1fr
	}

	.piece-zone {
		transform: scale(.82);
		width: 849px;
		max-width: none;
		margin-left: 0
	}

	.segment-card.atelier-card {
		overflow: hidden;
		min-height: 235px
	}

	.side-label {
		font-size: 18px
	}
}

@media(max-width:760px) {
	.piece-zone {
		transform: scale(.62)
	}

	.segment-card.atelier-card {
		min-height: 195px;
		padding: 12px
	}
}


/* --- Ajustement final : image intacte + valeurs dynamiques placées comme la fiche atelier --- */
.segment-card.atelier-card {
	padding: 14px 16px 26px;
}

.atelier-row {
	grid-template-columns: 86px minmax(720px, 1fr);
	gap: 8px;
}

.piece-zone {
	width: 849px;
	height: 243px;
	max-width: 100%;
	position: relative;
}

.segment-bg {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: contain;
	z-index: 1;
}

.side-label {
	color: var(--fam, #d00000);
	font-size: 22px;
	font-weight: 900;
	line-height: 1.55;
	align-self: center;
	transform: none;
}

.prehole {
	top: 6px;
	right: 86px;
	color: #006fc9;
	font-size: 13px;
	font-weight: 900;
	z-index: 10;
}


.angle-label {
	position: absolute;
	z-index: 10;
	color: #000;
	font-size: 17px;
	font-weight: 900;
	white-space: nowrap;
	transform: none !important;
	line-height: 1;
}

.angle-label.tl {
	left: 205px;
	top: 55px;
}

.angle-label.tr {
	right: 205px;
	top: 55px;
}

.angle-label.bl {
	left: 180px;
	top: 165px;
}

.angle-label.br {
	right: 180px;
	top: 165px;
}

.cut-label {
	left: 50%;
	top: 121px;
	transform: translate(-50%, -50%) !important;
	color: #111;
	font-size: 16px;
	font-weight: 900;
	z-index: 10;
	white-space: nowrap;
}

.total-note {
	left: 50%;
	bottom: 2px;
	transform: translateX(-50%) !important;
	text-align: center;
	font-size: 12px;
	line-height: 1.45;
	color: #000;
	z-index: 10;
	white-space: nowrap;
}

.focus .piece-zone {
	transform: scale(1.08);
	transform-origin: left center;
	margin: 0 auto 18px;
}

@media(max-width:980px) {
	.atelier-row {
		grid-template-columns: 58px 1fr;
	}

	.piece-zone {
		transform: scale(.82);
		transform-origin: left center;
		width: 849px;
		max-width: none;
	}

	.segment-card.atelier-card {
		overflow: hidden;
		min-height: 235px;
	}

	.focus .piece-zone {
		transform: scale(.82);
	}
}

@media(max-width:760px) {

	.piece-zone,
	.focus .piece-zone {
		transform: scale(.62);
	}

	.segment-card.atelier-card {
		min-height: 195px;
		padding: 12px;
	}
}


/* =========================================================
   08 — Système d’ancres et labels dynamiques
========================================================= */

/* --- SYSTÈME D'ANCRES EN POURCENTAGE : placements stables sur l'image intacte --- */
.piece-zone {
	--neighbor-left-x: 12.0%;
	--neighbor-left-y: 46.0%;
	--neighbor-right-x: 88.8%;
	--neighbor-right-y: 46.0%;
	--angle-tl-x: 23.5%;
	--angle-tl-y: 27.0%;
	--angle-tr-x: 76.5%;
	--angle-tr-y: 27.0%;
	--angle-bl-x: 21.5%;
	--angle-bl-y: 68.0%;
	--angle-br-x: 78.5%;
	--angle-br-y: 68.0%;
	--cut-x: 50%;
	--cut-y: 50%;
	--pre-x: 72%;
	--pre-y: 11%;
}

/* Placement final des libellés ancrés : voisins + angles.
   Les anciens placements en pixels ont été retirés. */
.anchor-label,
.neighbor,
.angle-label {
	position: absolute !important;
	z-index: 12 !important;
	line-height: 1 !important;
	transform: translate(-50%, -50%) !important;
	right: auto !important;
	bottom: auto !important;
}

.neighbor {
	color: var(--fam, #d00000) !important;
	font-size: 24px !important;
	font-weight: 900 !important;
}

.neighbor.left {
	left: var(--neighbor-left-x) !important;
	top: var(--neighbor-left-y) !important;
}

.neighbor.right {
	left: var(--neighbor-right-x) !important;
	top: var(--neighbor-right-y) !important;
}

.angle-label {
	color: #000 !important;
	font-size: 17px !important;
	font-weight: 900 !important;
	white-space: nowrap !important;
}

.angle-label.tl {
	left: var(--angle-tl-x) !important;
	top: var(--angle-tl-y) !important;
}

.angle-label.tr {
	left: var(--angle-tr-x) !important;
	top: var(--angle-tr-y) !important;
}

.angle-label.bl {
	left: var(--angle-bl-x) !important;
	top: var(--angle-bl-y) !important;
}

.angle-label.br {
	left: var(--angle-br-x) !important;
	top: var(--angle-br-y) !important;
}

.cut-label {
	left: var(--cut-x) !important;
	top: var(--cut-y) !important;
	transform: translate(-50%, -50%) !important;
}

.prehole {
	left: var(--pre-x) !important;
	top: var(--pre-y) !important;
	right: auto !important;
	transform: translate(-50%, -50%) !important;
}

/* =========================================================
   09 — Contrôles des ancres / mode réglage
========================================================= */

/* Calques de repère activables depuis le bouton “Afficher les ancres” */
.anchor-dot {
	position: absolute;
	width: 8px;
	height: 8px;
	border-radius: 999px;
	background: #e00000;
	box-shadow: 0 0 0 2px rgba(255, 255, 255, .85);
	z-index: 30;
	transform: translate(-50%, -50%);
	display: none;
	pointer-events: none;
}

body.show-anchors .anchor-dot {
	display: block;
}

/* --- Ajustements propres : panneau paramètres + mode focus --- */
.controls {
  display: grid !important;
  grid-template-columns: 1.4fr 1fr 1fr 1fr 1fr auto auto auto;
  gap: 12px !important;
  align-items: end !important;
}

/* Structure moins large */
.controls > div:nth-child(1) {
  grid-column: 1 / 2;
  min-width: 220px;
  max-width: 320px;
}

/* Inputs bien alignés */
.controls > div:nth-child(2),
.controls > div:nth-child(3),
.controls > div:nth-child(4),
.controls > div:nth-child(5) {
  min-width: 110px;
}

/* Boutons respirent enfin */
#resetBtn,
#anchorBtn,
#anchorEditBtn {
  white-space: nowrap;
  padding: 8px 12px !important;
  font-size: 13px;
}

.controls>div:nth-child(1) {
	grid-column: span 4;
}

.controls>div:nth-child(2),
.controls>div:nth-child(3),
.controls>div:nth-child(4),
.controls>div:nth-child(5) {
	grid-column: span 2;
}

#resetBtn,
#anchorBtn,
#anchorEditBtn {
	grid-column: span 2;
	min-height: 44px;
	white-space: nowrap;
}

.controls .note {
	grid-column: 1/-1 !important;
}

#freq {
	min-width: 100%;
}

.tab {
	user-select: none;
}

.segment-card.atelier-card {
	cursor: default;
}

#globalView .segment-card.atelier-card {
	cursor: pointer;
}

#globalView .segment-card.atelier-card:hover {
	outline: 2px solid rgba(127, 90, 56, .22);
	outline-offset: 4px;
}

/* =========================================================
   10 — Vue focus segment
========================================================= */

#focusView:not(.hidden) {
	display: grid !important;
}

#globalView.hidden,
#focusView.hidden {
	display: none !important;
}

@media(max-width:1000px) {
	.controls {
		grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
	}

	.controls>div:nth-child(1) {
		grid-column: span 6;
	}

	.controls>div:nth-child(2),
	.controls>div:nth-child(3),
	.controls>div:nth-child(4),
	.controls>div:nth-child(5),
	#resetBtn,
	#anchorBtn,
	#anchorEditBtn {
		grid-column: span 3;
	}
}

@media(max-width:640px) {
	.controls {
		grid-template-columns: 1fr !important;
	}

	.controls>div:nth-child(1),
	.controls>div:nth-child(2),
	.controls>div:nth-child(3),
	.controls>div:nth-child(4),
	.controls>div:nth-child(5),
	#resetBtn,
	#anchorBtn,
	#anchorEditBtn {
		grid-column: 1/-1;
	}
}



/* Correctif robuste : le bouton Afficher les ancres rend visibles des repères sur chaque image */
body.show-anchors .piece-zone {
	outline: 1px dashed rgba(224, 0, 0, .35);
}

.anchor-dot {
	position: absolute !important;
	width: 14px !important;
	height: 14px !important;
	border-radius: 999px !important;
	background: #ff1f1f !important;
	border: 2px solid #fff !important;
	box-shadow: 0 0 0 2px rgba(0, 0, 0, .22) !important;
	z-index: 999 !important;
	transform: translate(-50%, -50%) !important;
	display: none !important;
	pointer-events: none !important;
}

body.show-anchors .anchor-dot {
	display: block !important;
}

.anchor-dot.left {
	left: var(--neighbor-left-x) !important;
	top: var(--neighbor-left-y) !important;
}

.anchor-dot.right {
	left: var(--neighbor-right-x) !important;
	top: var(--neighbor-right-y) !important;
}

.anchor-dot.tl {
	left: var(--angle-tl-x) !important;
	top: var(--angle-tl-y) !important;
}

.anchor-dot.tr {
	left: var(--angle-tr-x) !important;
	top: var(--angle-tr-y) !important;
}

.anchor-dot.bl {
	left: var(--angle-bl-x) !important;
	top: var(--angle-bl-y) !important;
}

.anchor-dot.br {
	left: var(--angle-br-x) !important;
	top: var(--angle-br-y) !important;
}

.anchor-dot.ph {
	left: var(--pre-x) !important;
	top: var(--pre-y) !important;
}

.anchor-dot.cut {
	left: var(--cut-x) !important;
	top: var(--cut-y) !important;
}

body.show-anchors #anchorBtn {
	background: #d00000 !important;
	color: white !important;
	border-color: #d00000 !important;
}



/* Mode réglage des ancres : les points passent au-dessus, deviennent déplaçables et ne se comportent plus comme du texte. */
.segment-bg,
.piece-zone img {
	pointer-events: none !important;
	user-select: none !important;
	-webkit-user-select: none !important;
}

.anchor-dot {
	pointer-events: auto !important;
	cursor: grab !important;
	user-select: none !important;
	-webkit-user-select: none !important;
	touch-action: none !important;
	z-index: 5000 !important;
}

.anchor-dot:active {
	cursor: grabbing !important;
}

body.anchor-edit .anchor-dot {
	display: block !important;
}

body.anchor-edit .piece-zone {
	outline: 1px dashed rgba(224, 0, 0, .35);
}

body.anchor-edit #anchorEditBtn {
	background: #2f211b !important;
	color: #fff !important;
	border-color: #2f211b !important;
}

.anchor-tools {
	position: fixed;
	right: 18px;
	bottom: 18px;
	width: min(430px, calc(100vw - 36px));
	background: rgba(255, 255, 255, .96);
	border: 1px solid rgba(92, 70, 52, .25);
	border-radius: 18px;
	box-shadow: 0 16px 48px rgba(0, 0, 0, .16);
	padding: 14px;
	z-index: 9000;
	display: none;
	font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body.anchor-edit .anchor-tools {
	display: block;
}

.anchor-tools h3 {
	margin: 0 0 8px;
	font-size: 14px;
	color: #2f211b;
}

.anchor-tools p {
	margin: 0 0 10px;
	font-size: 12px;
	color: #6d5b4d;
	line-height: 1.35;
}

.anchor-tools textarea {
	width: 100%;
	min-height: 130px;
	resize: vertical;
	border: 1px solid rgba(92, 70, 52, .25);
	border-radius: 12px;
	padding: 10px;
	font: 12px/1.35 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
	box-sizing: border-box;
}

.anchor-tools .tool-row {
	display: flex;
	gap: 8px;
	margin-top: 10px;
	flex-wrap: wrap;
}

.anchor-tools button {
	border: 1px solid rgba(92, 70, 52, .25);
	background: #f7f0e6;
	border-radius: 999px;
	padding: 8px 12px;
	font-weight: 700;
	cursor: pointer;
}

.anchor-coord-badge {
	position: fixed;
	left: 12px;
	bottom: 12px;
	background: #2f211b;
	color: #fff;
	padding: 7px 10px;
	border-radius: 999px;
	font: 12px/1 system-ui, sans-serif;
	z-index: 9100;
	display: none;
}

body.anchor-edit .anchor-coord-badge {
	display: block;
}

/* Corrections finales — panneau réglage des ancres */
body.anchor-edit .anchor-dot {
	display: block !important;
	pointer-events: auto !important;
	cursor: grab !important;
	user-select: none !important;
	-webkit-user-select: none !important;
	touch-action: none !important;
	z-index: 5000 !important;
}

body.anchor-edit .anchor-dot:active {
	cursor: grabbing !important;
}

body.anchor-edit .piece-zone {
	outline: 1px dashed rgba(224, 0, 0, .35) !important;
}

#anchorEditBtn,
#anchorBtn {
	min-width: max-content;
}

.anchor-tools {
	color: #2f2922 !important;
}

.anchor-tools .tool-row {
	display: flex !important;
	gap: 10px !important;
	margin-top: 12px !important;
	flex-wrap: wrap !important;
}

.anchor-tools button {
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	gap: 7px !important;
	border: 0 !important;
	border-radius: 10px !important;
	padding: 10px 14px !important;
	font-weight: 800 !important;
	font-size: 13px !important;
	cursor: pointer !important;
	opacity: 1 !important;
	box-shadow: none !important;
	white-space: nowrap !important;
}

#copyAnchorsBtn {
	background: #2f2922 !important;
	color: #fffaf1 !important;
}

#copyAnchorsBtn:hover {
	background: #493b31 !important;
}

#copyAnchorsBtn.copied {
	background: #1f7a4f !important;
	color: #ffffff !important;
}

#resetAnchorsBtn {
	background: #dfd0bb !important;
	color: #2f2922 !important;
}

#resetAnchorsBtn:hover {
	background: #d0bea4 !important;
}

.anchor-tools textarea {
	color: #2f2922 !important;
	background: #fffdf8 !important;
}

#focusView:not(.hidden) {
	display: grid !important;
	grid-template-columns: minmax(0, 1fr) minmax(340px, 390px) !important;
	gap: 18px !important;
	align-items: start !important;
	overflow: visible !important;
}

#focusCard {
	min-width: 0 !important;
	overflow: hidden !important;
}

#focusCard .segment-card.atelier-card {
	width: 100% !important;
	min-width: 0 !important;
	overflow: hidden !important;
	padding: 18px 14px 26px !important;
	box-sizing: border-box !important;
}

#focusCard .atelier-row {
	display: grid !important;
	grid-template-columns: 70px minmax(0, 1fr) !important;
	gap: 10px !important;
	align-items: center !important;
	min-width: 0 !important;
}

#focusCard .piece-zone {
	width: 100% !important;
	max-width: 849px !important;
	aspect-ratio: 849/243 !important;
	height: auto !important;
	min-width: 0 !important;
	transform: none !important;
	margin: 0 !important;
	position: relative !important;
	overflow: hidden !important;
}

#focusCard .segment-bg {
	position: absolute !important;
	inset: 0 !important;
	width: 100% !important;
	height: 100% !important;
	object-fit: contain !important;
}

#focusCard .side-label {
	font-size: 20px !important;
	line-height: 1.45 !important;
	padding-top: 0 !important;
}

#focusView .detail-table {
	min-width: 0 !important;
	width: 100% !important;
	box-sizing: border-box !important;
}

@media(max-width:1150px) {
	#focusView:not(.hidden) {
		grid-template-columns: 1fr !important;
	}

	#focusCard {
		overflow: visible !important;
	}

	#focusCard .segment-card.atelier-card {
		overflow: visible !important;
	}

	#focusCard .atelier-row {
		grid-template-columns: 78px minmax(0, 1fr) !important;
	}

	#focusView .detail-table {
		max-width: 720px !important;
	}
}

@media(max-width:760px) {
	#focusCard .atelier-row {
		grid-template-columns: 1fr !important;
	}

	#focusCard .side-label {
		display: flex !important;
		gap: 8px !important;
		align-items: center !important;
	}
}

/* ===== HABILLAGE TYPE DEVIS CHAND’HÔME — FICHES ATELIER ===== */
/* Bloc volontairement placé en fin de fichier : il harmonise l’outil avec les devis/factures
   sans devoir démêler immédiatement les anciennes couches CSS du prototype. */ 

:root {
	--paper: #ffffff;
	--ink: #1f1d1a;
	--muted: #66615a;
	--line: #d9cdb8;
	--gold: #a1845b;
	--sage: #a8b694;
	--soft: #f3eee6;
	--soft-sage: #eef2e8;
	--shadow: none;
}

html,
body {
	background: #f4efe6 !important;
}

body {
	padding: 10px 0 24px !important;
	color: var(--ink) !important;
	font-family: "Helvetica Neue", Arial, sans-serif !important;
	line-height: 1.2;
}

/* =========================================================
   11 — Habillage feuille A4 / style Chand’Hôme
========================================================= */

.atelier-sheet {
	width: min(var(--app-max-width), calc(100% - 28px));
	min-height: 273mm;
	margin: 0 auto 18px;
	background: #fcfaf6;
	border: 1px solid #e8e1d4;
  box-shadow: 0 10px 30px rgba(80, 55, 30, 0.06);
	position: relative;
	padding: 12mm 14mm 14mm;
	overflow: hidden;
}

.atelier-sheet::before {
	content: "";
	position: absolute;
	left: 14mm;
	right: 14mm;
	top: 9mm;
	height: 1px;
	background: linear-gradient(90deg, transparent, var(--sage), transparent);
	z-index: 1;
}

.atelier-sheet .sheet-header {
	position: relative;
	z-index: 2;
	display: grid;
	grid-template-columns: 1.18fr 0.82fr;
	gap: 2mm;
	align-items: start;
	max-width: none;
	margin: 0 0 8mm;
	padding: 0;
}

.atelier-sheet .eyebrow {
	font-size: 9px;
	letter-spacing: 0.26em;
	text-transform: uppercase;
	color: var(--sage) !important;
	margin-bottom: 5px;
	font-weight: 700;
}

.atelier-sheet .brand {
	margin: 0 0 4px;
	font-family: Georgia, "Times New Roman", serif;
	font-size: 26px;
	font-weight: 600;
	line-height: 1.05;
	letter-spacing: 0.03em;
	color: var(--ink);
}

.atelier-sheet .tagline {
	margin: 0;
	color: var(--muted);
	font-size: 13.5px;
	max-width: 92mm;
	line-height: 1.5;
}

.atelier-sheet .title-box {
	position: relative;
	text-align: right;
	padding-top: 3mm;
}

.atelier-sheet .geo {
	position: absolute;
	right: -7mm;
	top: -6mm;
	width: 52mm;
	height: 52mm;
	opacity: 0.18;
	pointer-events: none;
}

.atelier-sheet .title-main {
	margin: 0;
	font-family: Georgia, "Times New Roman", serif;
	font-size: 21px;
	letter-spacing: 0.12em;
	font-weight: 500;
	color: var(--ink);
}

.atelier-sheet .subtitle-header {
	margin-top: 6px;
	font-size: 10px;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: #8a857f;
	line-height: 1.2;
}

.atelier-sheet main {
	position: relative;
	z-index: 2;
	max-width: none;
	margin: 0;
	padding: 0;
}

.atelier-sheet .panel {
	background: #fffdf9;
	border: 1px solid rgba(217, 205, 184, 0.9);
	border-radius: 14px;
	box-shadow: none;
	backdrop-filter: none;
}

.atelier-sheet .controls {
	padding: 7px 10px !important;
	margin: 0 0 8mm !important;
	gap: 8px 10px !important;
	align-items: end !important;
}

.atelier-sheet label {
	font-size: 9px;
	letter-spacing: 0.16em;
	color: var(--muted);
	margin-bottom: 4px;
}

.atelier-sheet select,
.atelier-sheet input {
	border: 1px solid var(--line);
	background: #fff;
	border-radius: 10px;
	padding: 8px 10px;
	font-size: 12px;
	color: var(--ink);
}

.atelier-sheet button {
	border-radius: 10px;
	padding: 8px 10px;
	font-size: 12px;
	font-weight: 700;
	background: #1f1d1a;
	color: #fff;
}

.atelier-sheet .note {
	padding: 2px 4px 3px;
	font-size: 10.5px;
	line-height: 1.35;
	color: var(--muted);
}

.atelier-sheet .tabs {
	margin: 0 0 4mm;
	gap: 8px;
}

.atelier-sheet .tab {
	padding: 8px 12px;
	border-radius: 999px;
	border: 1px solid var(--line) !important;
	background: #fff !important;
	color: var(--muted) !important;
	font-size: 11px;
	box-shadow: none !important;
}

.atelier-sheet .tab.active {
	background: var(--ink) !important;
	color: #fff !important;
	border-color: var(--ink) !important;
}

.atelier-sheet .grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 6mm;
}

.atelier-sheet .segment-card.atelier-card {
	border: 1px solid #eee5d7;
	background: #ffffff;
	margin: 0;
	padding: 6mm 7mm;
	min-height: auto;
	overflow: hidden;
}

.atelier-sheet .atelier-row {
	display: grid;
	grid-template-columns: 34px minmax(0, 1fr);
	gap: 6mm;
	align-items: center;
}

.atelier-sheet .side-label {
	font-size: 18px;
	line-height: 1.35;
	padding-top: 0;
}

.atelier-sheet .piece-zone {
	width: 100% !important;
	max-width: 849px !important;
	aspect-ratio: 849 / 243;
	height: auto !important;
	min-width: 0 !important;
	transform: none !important;
	position: relative;
}

.atelier-sheet .segment-bg {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.atelier-sheet .detail-table {
	padding: 7mm;
}

.atelier-sheet .detail-table h2 {
	font-size: 18px;
	font-weight: 500;
	margin-bottom: 4mm;
}

@media (max-width: 900px) {
	.atelier-sheet {
		width: calc(100% - 18px);
		padding: 9mm 8mm 10mm;
	}

	.atelier-sheet .sheet-header {
		grid-template-columns: 1fr;
		gap: 6mm;
	}

	.atelier-sheet .title-box {
		text-align: left;
	}

	.atelier-sheet .geo {
		right: 0;
		top: -8mm;
		width: 44mm;
		height: 44mm;
	}

	.atelier-sheet .controls {
		grid-template-columns: 1fr !important;
	}

	.atelier-sheet .controls > div,
	.atelier-sheet #resetBtn,
	.atelier-sheet #anchorBtn,
	.atelier-sheet #anchorEditBtn {
		grid-column: 1 / -1 !important;
	}

	.atelier-sheet .atelier-row {
		grid-template-columns: 1fr;
		gap: 2mm;
	}

	.atelier-sheet .side-label {
		display: flex;
		gap: 8px;
	}
}

@media print {
	body {
		padding: 0 !important;
		background: #fff !important;
	}

	.atelier-sheet {
		width: auto;
		min-height: 0;
		margin: 0;
		border: none;
		padding: 10mm 12mm;
		overflow: visible;
	}

	.atelier-sheet::before {
		left: 12mm;
		right: 12mm;
		top: 7mm;
	}

	.atelier-sheet .sheet-header,
	.atelier-sheet .controls,
	.atelier-sheet .tabs {
		display: grid;
	}

	.atelier-sheet .segment-card.atelier-card {
		break-inside: avoid;
		page-break-inside: avoid;
	}
}

/* ===== CORRECTION VUE FOCUS DANS FEUILLE A4 ===== */

#focusView:not(.hidden) {
  display: block !important;
}

#focusCard {
  width: 100% !important;
  overflow: visible !important;
  margin-bottom: 8mm !important;
}

#focusCard .segment-card.atelier-card {
  width: 100% !important;
  overflow: visible !important;
  padding: 14px 16px 26px !important;
}

#focusCard .atelier-row {
  display: grid !important;
  grid-template-columns: 76px minmax(0, 1fr) !important;
  gap: 10px !important;
  align-items: center !important;
}

#focusCard .piece-zone {
  width: 100% !important;
  max-width: 849px !important;
  aspect-ratio: 849 / 243 !important;
  height: auto !important;
  transform: none !important;
  margin: 0 auto !important;
  overflow: hidden !important;
}

#focusView .detail-table {
  width: 100% !important;
  max-width: none !important;
  margin-top: 6mm !important;
}

.controls {
  grid-template-columns: repeat(10, minmax(0, 1fr)) !important;
}

#resetBtn,
#anchorBtn,
#anchorEditBtn {
  grid-column: span 2 !important;
  min-width: 0 !important;
  font-size: 11px !important;
  padding-inline: 10px !important;
}

/* ===== BOUTONS STYLE CHAND’HÔME (léger, document) ===== */

button {
  border: 1px solid rgba(127, 90, 56, 0.25) !important;
  background: #f7f3ec !important;
  color: var(--ink) !important;
  border-radius: 999px !important;
  padding: 6px 12px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  box-shadow: none !important;
  transition: all 0.15s ease;
}

button:hover {
  background: #efe7db !important;
  border-color: rgba(127, 90, 56, 0.4) !important;
}

/* Bouton actif / important (Focus segment par exemple) */
.tab.active,
button.primary {
  background: var(--ink) !important;
  color: #fffaf1 !important;
  border-color: var(--ink) !important;
}

/* Boutons du panneau (les 3 que tu veux alléger) */
#resetBtn,
#anchorBtn,
#anchorEditBtn {
  padding: 5px 10px !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  border-radius: 999px !important;
  background: #f4efe6 !important;
}

/* Variante hover douce */
#resetBtn:hover,
#anchorBtn:hover,
#anchorEditBtn:hover {
  background: #e9dfd0 !important;
}

/* ===== TABS STYLE CHAND’HÔME ===== */

.tabs {
  display: flex;
  gap: 8px;
  margin: 14px 0 18px;
}

/* état normal */
.tab {
  border: 1px solid rgba(127, 90, 56, 0.25);
  background: #f4efe6;
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

/* hover doux */
.tab:hover {
  background: #ebe2d3;
  color: var(--ink);
}

/* état actif (plus subtil que noir plein) */
.tab.active {
  background: #2f2922;        /* garde ta teinte encre */
  color: #fffaf1;
  border-color: #2f2922;
}

/* ===== OVERRIDE FINAL — TABS DISCRETS DANS LA FEUILLE ===== */

.atelier-sheet .tabs .tab {
  border: 1px solid rgba(127, 90, 56, 0.25) !important;
  background: #f4efe6 !important;
  color: var(--muted) !important;
  border-radius: 999px !important;
  padding: 5px 12px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  box-shadow: none !important;
}

.atelier-sheet .tabs .tab:hover {
  background: #ebe2d3 !important;
  color: var(--ink) !important;
}

.atelier-sheet .tabs .tab.active {
  background: #f7f3ec !important;
  color: var(--ink) !important;
  border-color: rgba(127, 90, 56, 0.55) !important;
  font-weight: 700 !important;
}


/* ===== FIX — LONGUEUR TOTALE PILOTÉE PAR ANCRE ===== */

.atelier-sheet .piece-zone .total-note {
  position: absolute !important;
  left: var(--total-x) !important;
  top: var(--total-y) !important;
  right: auto !important;
  bottom: auto !important;
  transform: translate(-50%, -50%) !important;
  z-index: 12 !important;
}

.atelier-sheet .piece-zone .anchor-dot.total {
  left: var(--total-x) !important;
  top: var(--total-y) !important;
}
/* ===== FIX FINAL STABLE — ANCRES, PERÇAGE, FOCUS ===== */

/* Supprime définitivement le vieux décor beige hérité des cartes génériques. */
.segment-card.atelier-card::before,
.atelier-sheet .segment-card.atelier-card::before,
#focusCard .segment-card.atelier-card::before {
  content: none !important;
  display: none !important;
  background: transparent !important;
}

/* Garde le repère quantité sur une seule ligne. */
.side-label,
.atelier-sheet .side-label,
#focusCard .side-label {
  white-space: nowrap !important;
}

/* Donne assez de place à gauche en mode focus. */
#focusCard .atelier-row {
  grid-template-columns: 90px minmax(0, 1fr) !important;
}

/* Important : les textes ancrés doivent pouvoir sortir légèrement de l'image. */
.segment-card.atelier-card,
.atelier-sheet .segment-card.atelier-card,
#focusCard .segment-card.atelier-card {
  overflow: visible !important;
}

.piece-zone,
.atelier-sheet .piece-zone,
#focusCard .piece-zone {
  overflow: visible !important;
}

/* Un peu d'air sous la pièce pour que la longueur totale ne soit plus grignotée. */
#focusCard .segment-card.atelier-card {
  padding-bottom: 48px !important;
}

/* Le libellé de perçage est lié à son ancre, mais placé au-dessus du point rouge. */
.piece-zone .prehole,
.atelier-sheet .piece-zone .prehole,
#focusCard .piece-zone .prehole {
  position: absolute !important;
  left: var(--pre-x) !important;
  top: var(--pre-y) !important;
  right: auto !important;
  bottom: auto !important;
  transform: translate(-50%, -125%) !important;
  color: #006fc9 !important;
  font-weight: 900 !important;
  font-size: 13px !important;
  line-height: 1.1 !important;
  white-space: nowrap !important;
  z-index: 80 !important;
  pointer-events: none !important;
}

/* La longueur à découper reste strictement centrée sur l'ancre de coupe. */
.piece-zone .cut-label,
.atelier-sheet .piece-zone .cut-label,
#focusCard .piece-zone .cut-label {
  position: absolute !important;
  left: var(--cut-x) !important;
  top: var(--cut-y) !important;
  right: auto !important;
  bottom: auto !important;
  transform: translate(-50%, -50%) !important;
  z-index: 40 !important;
  white-space: nowrap !important;
}

/* La longueur totale reste pilotée par son ancre et visible en entier. */
.piece-zone .total-note,
.atelier-sheet .piece-zone .total-note,
#focusCard .piece-zone .total-note {
  position: absolute !important;
  left: var(--total-x) !important;
  top: var(--total-y) !important;
  right: auto !important;
  bottom: auto !important;
  transform: translate(-50%, -50%) !important;
  z-index: 40 !important;
  white-space: nowrap !important;
}

/* Les points d'ancrage restent au-dessus de tous les libellés pendant le réglage. */
.anchor-dot,
body.show-anchors .anchor-dot,
body.anchor-edit .anchor-dot {
  z-index: 120 !important;
}

.segment-warning {
  position: absolute;
  left: 6%;
  top: -6%;
  color: #a40000;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  z-index: 90;
  white-space: nowrap;
  text-align: left;
  opacity: 0.9;
	max-width: 200px;
}

.segment-warning-arrow {
  position: absolute;
  left: 38%;
  top: -4%;
  color: #a40000;
  font-size: 34px;
  line-height: 1;
  transform: rotate(25deg);
  z-index: 90;
  pointer-events: none;
  opacity: 0.85;
}

.dome-controls {
  margin-top: 20px;
  padding-top: 10px;
  border-top: 1px solid rgba(0,0,0,0.08);
}

/* =========================================================
   14 — Viewer géodôme / assembly guide
========================================================= */

/* --- Schéma pédagogique d'assemblage des segments --- */
.assembly-guide {
  margin: 28px 0 34px;
  padding: clamp(16px, 2.5vw, 26px);
  border-radius: 28px;
  overflow: hidden;
}

.assembly-guide__intro {
  max-width: 860px;
  margin-bottom: 18px;
}

.assembly-guide__intro .eyebrow {
  margin: 0 0 6px;
}

.assembly-guide__intro h2 {
  margin: 0 0 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1.05;
  color: var(--ink);
}

.assembly-guide__intro p:not(.eyebrow) {
  margin: 0;
  max-width: 760px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.assembly-guide__image-link {
  display: block;
  border-radius: 22px;
  overflow: hidden;
  background: #fffdf8;
  border: 1px solid rgba(127, 90, 56, .18);
  box-shadow: 0 14px 34px rgba(61, 43, 26, .12);
  cursor: zoom-in;
}

.assembly-guide__image {
  display: block;
  width: 100%;
  height: auto;
}

.assembly-guide__caption {
  margin: 12px 4px 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

@media print {
  .assembly-guide {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ddd;
  }

  .assembly-guide__caption {
    display: none;
  }
}

#resetBtn,
#anchorBtn,
#anchorEditBtn {
  background: #fffaf1 !important;
  color: var(--ink) !important;
  border: 1px solid var(--line) !important;
  border-radius: 999px !important;
  box-shadow: none !important;
  min-height: auto !important;
  padding: 9px 15px !important;
  font-weight: 700 !important;
}

#resetBtn:hover,
#anchorBtn:hover,
#anchorEditBtn:hover {
  background: #f4efe6 !important;
}

body.show-anchors #anchorBtn,
body.anchor-edit #anchorEditBtn {
  background: var(--ink) !important;
  color: #fffaf1 !important;
  border-color: var(--ink) !important;
}

/* --- Ajustement final panneau de contrôles --- */

.controls {
  grid-template-columns: 1.25fr 0.75fr 0.75fr 0.75fr 0.75fr auto auto auto !important;
  gap: 10px !important;
}

.controls > div:nth-child(1) {
  grid-column: auto !important;
  max-width: 270px !important;
}

.controls > div:nth-child(2),
.controls > div:nth-child(3),
.controls > div:nth-child(4),
.controls > div:nth-child(5) {
  grid-column: auto !important;
}

#resetBtn,
#anchorBtn,
#anchorEditBtn {
  grid-column: auto !important;
  min-height: 36px !important;
  padding: 7px 13px !important;
  font-size: 12px !important;
  border-radius: 999px !important;
  white-space: nowrap !important;
}

/* ===== FIX PROPRE — PANNEAU DE CONTRÔLES ÉQUILIBRÉ ===== */

.atelier-sheet .controls {
  display: grid !important;
  grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
  column-gap: 10px !important;
  row-gap: 8px !important;
  align-items: end !important;
  overflow: visible !important;
}

/* Ligne 1 : structure + dimensions */
.atelier-sheet .controls > div:nth-child(1) {
  grid-column: 1 / span 4 !important;
  min-width: 0 !important;
}

.atelier-sheet .controls > div:nth-child(2) {
  grid-column: 5 / span 2 !important;
  min-width: 0 !important;
}

.atelier-sheet .controls > div:nth-child(3) {
  grid-column: 7 / span 2 !important;
  min-width: 0 !important;
}

.atelier-sheet .controls > div:nth-child(4) {
  grid-column: 9 / span 2 !important;
  min-width: 0 !important;
}

/* Ligne 2 : focus + boutons */
.atelier-sheet .controls > div:nth-child(5) {
  grid-column: 1 / span 2 !important;
  min-width: 0 !important;
}

.atelier-sheet #resetBtn {
  grid-column: 3 / span 2 !important;
}

.atelier-sheet #anchorBtn {
  grid-column: 5 / span 3 !important;
}

.atelier-sheet #anchorEditBtn {
  grid-column: 8 / span 3 !important;
}

/* Ligne 3 : note */
.atelier-sheet .controls .note {
  grid-column: 1 / -1 !important;
  padding-top: 2px !important;
}

/* Hauteur homogène des champs */
.atelier-sheet .controls select,
.atelier-sheet .controls input,
.atelier-sheet #resetBtn,
.atelier-sheet #anchorBtn,
.atelier-sheet #anchorEditBtn {
  height: 30px !important;
  min-height: 30px !important;
  padding: 4px 9px !important;
  font-size: 11px !important;
  line-height: 1 !important;
  box-sizing: border-box !important;
}

/* Champs */
.atelier-sheet .controls select,
.atelier-sheet .controls input {
  width: 100% !important;
  min-width: 0 !important;
  border-radius: 9px !important;
}

/* Boutons */
.atelier-sheet #resetBtn,
.atelier-sheet #anchorBtn,
.atelier-sheet #anchorEditBtn {
  width: 100% !important;
  white-space: nowrap !important;
  border-radius: 999px !important;
}

/* Responsive */
@media (max-width: 900px) {
  .atelier-sheet .controls {
    grid-template-columns: 1fr !important;
  }

  .atelier-sheet .controls > div,
  .atelier-sheet #resetBtn,
  .atelier-sheet #anchorBtn,
  .atelier-sheet #anchorEditBtn,
  .atelier-sheet .controls .note {
    grid-column: 1 / -1 !important;
  }
}

#domeV4Viewer + .tabs {
  margin-top: 24px;
}

@media (max-width: 600px) {
  .controls {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px;
  }

  .controls > div {
    width: 100%;
  }

  .controls label {
    display: block;
    margin-bottom: 5px;
    letter-spacing: 0.08em;
    white-space: normal;
  }

  .controls select,
  .controls input,
  .controls button,
  .controls #resetBtn,
  .controls #anchorBtn,
  .controls #anchorEditBtn {
    width: 100%;
    max-width: none;
  }

  .controls .note {
    font-size: 0.82rem;
    line-height: 1.45;
    margin-top: 4px;
  }

  .sheet-header {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .title-box {
    text-align: left;
  }
}

@media (max-width: 600px) {
  .grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .segment-card {
    min-width: 0;
    padding: 18px 12px 22px;
    overflow: visible;
  }

  .piece-zone {
    min-height: 190px;
    transform: scale(0.82);
    transform-origin: center top;
    margin-bottom: -24px;
  }

  .segment-title,
  .segment-card h3 {
    font-size: 1.1rem;
  }

  .segment-card .cut-length,
  .segment-card .length-main {
    font-size: 1rem;
    line-height: 1.15;
    white-space: normal;
  }

  .segment-card .small,
  .segment-card .note,
  .segment-card p {
    font-size: 0.82rem;
    line-height: 1.35;
  }
}


@media (max-width: 600px) {
  .piece-zone {
    transform: scale(0.66);
    transform-origin: center top;
    margin-bottom: -46px;
  }

  .piece-zone .label,
  .piece-zone .measure,
  .piece-zone .angle,
  .piece-zone .cut-length,
  .piece-zone .length-main,
  .piece-zone .warning,
  .piece-zone .drill {
    font-size: 0.78rem !important;
    line-height: 1.05 !important;
  }

  .piece-zone .cut-length,
  .piece-zone .length-main {
    font-size: 0.9rem !important;
  }

  .segment-card {
    padding-top: 18px;
    padding-bottom: 18px;
  }
}

@media (max-width: 600px) {
  .segment-card {
    padding: 18px 10px 26px;
  }

  .piece-zone {
    position: relative;
    transform: scale(0.68);
    transform-origin: center top;
    margin-bottom: -58px;
  }

  /* On masque les textes secondaires qui saturent le visuel mobile */
  .piece-zone [class*="warning"],
  .piece-zone [class*="drill"],
  .piece-zone [class*="pre"],
  .piece-zone [class*="percage"] {
    display: none !important;
  }

  /* On réduit tous les textes posés sur le dessin */
  .piece-zone * {
    font-size: 11px !important;
    line-height: 1 !important;
  }

  /* Longueur rouge principale */
  .piece-zone [class*="longueur"],
  .piece-zone [class*="length"],
  .piece-zone [class*="cut"] {
    font-size: 13px !important;
    line-height: 1.05 !important;
  }
}

@media (max-width: 600px) {
  .atelier-sheet {
    padding: 0 18px;
  }

  .panel {
    padding: 18px;
  }
}

@media (max-width: 600px) {
  .panel.controls {
    display: grid !important;
    grid-template-columns: 1fr !important;
    padding: 18px !important;
  }

  .panel.controls > * {
    grid-column: 1 / -1 !important;
    width: 100% !important;
  }

  .panel.controls .note {
    max-width: none !important;
    width: 100% !important;
    font-size: 0.9rem !important;
    line-height: 1.5 !important;
    margin-top: 10px !important;
  }

  .panel.controls button,
  .panel.controls select,
  .panel.controls input {
    width: 100% !important;
    box-sizing: border-box !important;
  }
}

.segment-card .total-length {
  margin-top: -12px;
}

@media (max-width: 600px) {
  .piece-zone + * {
    margin-top: -34px !important;
    transform: translateY(-34px);
  }

  .segment-card {
    overflow: visible !important;
  }
}

@media (max-width: 600px) {
  .piece-zone {
    --total-y: 75% !important;
  }
}

@media (max-width: 600px) {
  .piece-zone {
    --angle-tl-y: 28% !important;
    --angle-tr-y: 28% !important;
  }
}

.panel.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.panel.controls .note {
  grid-column: 1 / -1;
  max-width: 600px;
}

/* ===== FIX MOBILE — PANNEAU PARAMÈTRES + NOTE ===== */

@media (max-width: 640px) {
  .atelier-sheet .controls {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    padding: 14px 18px 18px !important;
  }

  .atelier-sheet .controls > div:nth-child(1),
  .atelier-sheet .controls > div:nth-child(5),
  .atelier-sheet #resetBtn,
  .atelier-sheet #anchorBtn,
  .atelier-sheet #anchorEditBtn,
  .atelier-sheet .controls .note {
    grid-column: 1 / -1 !important;
    max-width: none !important;
    width: 100% !important;
  }

  .atelier-sheet .controls > div:nth-child(2),
  .atelier-sheet .controls > div:nth-child(3),
  .atelier-sheet .controls > div:nth-child(4) {
    grid-column: auto !important;
    min-width: 0 !important;
  }

  .atelier-sheet .controls .note {
    padding: 14px 4px 4px !important;
    font-size: 14px !important;
    line-height: 1.55 !important;
    text-align: left !important;
  }

  .atelier-sheet label {
    font-size: 8px !important;
    letter-spacing: 0.12em !important;
    line-height: 1.15 !important;
  }

  .atelier-sheet select,
  .atelier-sheet input {
    min-width: 0 !important;
    width: 100% !important;
    font-size: 12px !important;
    padding: 8px 9px !important;
  }
}

/* ===== FIX MOBILE — MODE FOCUS ===== */

@media (max-width: 640px) {
  #focusView:not(.hidden) {
    display: block !important;
  }

  #focusCard {
    width: 100% !important;
    margin-bottom: 24px !important;
  }

  #focusCard .segment-card.atelier-card {
    padding: 18px 14px 34px !important;
    min-height: auto !important;
    height: auto !important;
  }

  #focusCard .atelier-row {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  #focusCard .side-label {
    display: block !important;
    font-size: 20px !important;
    margin-bottom: 4px !important;
  }

  #focusCard .piece-zone {
    width: 100% !important;
    max-width: none !important;
    aspect-ratio: 849 / 243 !important;
    height: auto !important;
    margin: 0 auto !important;
    transform: none !important;
    overflow: visible !important;
  }

  #focusCard .cut-label {
    font-size: 13px !important;
  }

  #focusCard .angle-label {
    font-size: 12px !important;
  }

  #focusCard .neighbor {
    font-size: 15px !important;
  }

  #focusCard .total-note {
    font-size: 10px !important;
    line-height: 1.15 !important;
  }

  #focusView .detail-table {
    margin-top: 0 !important;
  }
}

/* ===== HARMONISATION V4 AVEC LA V3 ===== */

.dome-viewer-panel {
  margin: 28px 0 34px;
  padding: clamp(16px, 2.5vw, 26px);
  border-radius: 28px;
  overflow: hidden;
}

.dome-viewer-header {
  max-width: 860px;
  margin-bottom: 18px;
}

.dome-viewer-header h2 {
  margin: 0 0 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1.05;
  color: var(--ink);
}

.dome-viewer-note {
  margin: 0 !important;
  max-width: 760px;
  color: var(--muted) !important;
  font-size: 15px !important;
  line-height: 1.55 !important;
}

.dome-v4-iframe {
  margin-top: 18px;
  background: #fffdf8 !important;
  border: 1px solid rgba(127, 90, 56, .18) !important;
  border-radius: 22px !important;
  box-shadow: 0 14px 34px rgba(61, 43, 26, .12);
}

#freq {
  font-weight: 700 !important;
}

/* ===== SEGMENT FOCUS INTÉGRÉ AUX TABS ===== */

.tabs {
  align-items: center !important;
  gap: 8px !important;
  flex-wrap: wrap !important;
}

.seg-select-inline {
  width: auto !important;
  min-width: 140px !important;
  max-width: 180px !important;
  height: 30px !important;
  padding: 5px 28px 5px 10px !important;
  border-radius: 999px !important;
  border: 1px solid rgba(127, 90, 56, 0.28) !important;
  background: #fffaf1 !important;
  color: var(--ink) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  margin-left: 4px !important;
}

.seg-select-inline:hover {
  background: #f4efe6 !important;
}

@media (max-width: 640px) {
  .seg-select-inline {
    width: 100% !important;
    max-width: none !important;
    margin-left: 0 !important;
  }
}

/* ===== GRISAGE UNIQUEMENT DU SELECT ===== */

.view-global #segSelect,
.view-global .seg-select-inline {
  opacity: 0.45;
  filter: grayscale(100%);
  pointer-events: none;
  transition: all 0.2s ease;
}

.view-focus #segSelect,
.view-focus .seg-select-inline {
  opacity: 1;
  filter: none;
  pointer-events: auto;
}

/* ===== LAYOUT PROPRE ET ÉQUILIBRÉ ===== */

.atelier-sheet .controls {
  display: grid;
  grid-template-columns: 2.5fr 1fr 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}

/* Bouton à droite */
.atelier-sheet #resetBtn {
  grid-column: 5;
  grid-row: 1;
  justify-self: end;
  min-width: 130px;
}

.info-field {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.info-field label {
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #777;
  margin-bottom: 4px;
}

.info-field div {
  height: 32px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 8px;
  background: #f4efe6;
  font-weight: 600;
}

.stats-row {
	display: grid;
	grid-template-columns: repeat(6, minmax(0, 1fr));
	gap: 10px;
	margin-top: 10px;
	width: 100%;
}

.info-field.stat {
	min-width: 0;
}

.info-field.stat div {
	width: 100%;
	justify-content: flex-start;
	white-space: nowrap;
}

.height-info {
	display: flex;
	flex-direction: column;
	justify-content: center;
	padding-bottom: 8px;
	margin-left: 65px;
	color: #7a7168;
}

.height-label {
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	margin-bottom: 3px;
}

#domeHeight {
	font-size: 15px;
	font-weight: 600;
}

.viewer-activate-btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  margin: 18px auto 0;
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid rgba(127, 90, 56, .35);
  background: #fffdf8;
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(61, 43, 26, .12);
}

.viewer-activate-btn:hover {
  background: #f7efe3;
}

/* =========================================================
   15 — Impression condensée utilisateur
========================================================= */

/* --- Impression condensée utilisateur --- */
#printSummaryBtn {
  white-space: nowrap;
  padding: 8px 12px !important;
  font-size: 13px;
  background: #6f5138;
}

.print-summary {
  padding: 20px;
  margin: 0 0 24px;
  overflow: auto;
}

.print-summary-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.print-summary h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
  line-height: 1.15;
}

.print-summary-note,
.print-footnote {
  color: var(--muted);
  font-size: 13px;
  margin: 6px 0 0;
}

.print-summary-brand {
  text-align: right;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.print-summary-brand strong {
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
}

.print-meta-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(110px, 1fr));
  gap: 8px;
  margin: 12px 0 14px;
}

.print-meta-grid div {
  background: #fffdf8;
  border: 1px solid rgba(127, 90, 56, .16);
  border-radius: 12px;
  padding: 9px 10px;
}

.print-meta-grid span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 4px;
}

.print-meta-grid strong {
  font-size: 14px;
}

.print-cut-table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  font-size: 13px;
  background: #fff;
}

.print-cut-table th,
.print-cut-table td {
  border: 1px solid rgba(127, 90, 56, .22);
  padding: 7px 8px;
  text-align: center;
  background: #fff;
  border-radius: 0 !important;
}

.print-cut-table th {
  background: #f7efe3;
  color: #3a3028;
  font-weight: 800;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.print-cut-table td:last-child,
.print-cut-table td:first-child {
  text-align: center;
}

.print-seg {
  color: var(--fam, #6d4c33) !important;
  font-weight: 900 !important;
  font-size: 16px;
}

@media(max-width:1000px) {
  .controls {
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  }

  #printSummaryBtn,
  #anchorBtn,
  #anchorEditBtn {
    grid-column: span 3;
  }

  .print-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media(max-width:640px) {
  #printSummaryBtn,
  #anchorBtn,
  #anchorEditBtn {
    grid-column: 1/-1;
  }

  .print-summary-header {
    display: block;
  }

  .print-summary-brand {
    text-align: left;
    margin-top: 8px;
  }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 10mm;
  }

  body {
    background: white !important;
    color: #111 !important;
    font-size: 10pt;
  }

  .sheet-header,
  .controls,
  #dynamicDomeViewer,
  .tabs,
  #globalView,
  #focusView,
  .anchor-tools,
  .anchor-coord-badge {
    display: none !important;
  }

  main {
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .print-summary {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    background: white !important;
    overflow: visible !important;
  }

  .print-summary-header {
    margin-bottom: 8mm !important;
  }

  .print-summary h2 {
    font-size: 18pt !important;
  }

  .print-summary .eyebrow {
    font-size: 8pt !important;
  }

  .print-meta-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 3mm !important;
    margin: 0 0 6mm !important;
  }

  .print-meta-grid div {
    border: 1px solid #bbb !important;
    padding: 3mm !important;
    border-radius: 0 !important;
  }

  .print-cut-table {
    font-size: 8.5pt !important;
    page-break-inside: avoid;
  }

  .print-cut-table th,
  .print-cut-table td {
    border: 1px solid #999 !important;
    padding: 2.2mm 1.6mm !important;
  }

  .print-cut-table th {
    background: #eee !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .print-seg {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .print-footnote {
    margin-top: 4mm !important;
    font-size: 8pt !important;
  }
}

/* --- Snapshot visuel imprimable des segments --- */
.print-visual-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
  margin: 16px 0;
}

.print-visual-grid .segment-card {
  margin: 0;
  break-inside: avoid;
  page-break-inside: avoid;
}

.print-technical-details {
  margin-top: 14px;
}

.print-technical-details summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 10px;
}

@media print {
  .print-summary {
    color: #111 !important;
  }

  .print-visual-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 5mm !important;
    margin: 5mm 0 0 !important;
  }

  .print-visual-grid .segment-card {
    display: block !important;
    box-shadow: none !important;
    border: 1px solid #bbb !important;
    border-radius: 6px !important;
    padding: 3mm !important;
    background: #fff !important;
    overflow: hidden !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .print-visual-grid .atelier-row {
    display: grid !important;
    grid-template-columns: 18mm 1fr !important;
    gap: 2mm !important;
    align-items: center !important;
  }

  .print-visual-grid .side-label {
    font-size: 12pt !important;
    line-height: 1.15 !important;
    min-width: 0 !important;
  }

  .print-visual-grid .piece-zone {
    transform: scale(.72);
    transform-origin: left center;
    width: 138% !important;
    margin: -9mm -28mm -9mm 0 !important;
  }

  .print-visual-grid .segment-warning,
  .print-visual-grid .segment-warning-arrow {
    font-size: 7pt !important;
  }

  .print-visual-grid .anchor-label,
  .print-visual-grid .prehole,
  .print-visual-grid .cut-label,
  .print-visual-grid .total-note {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .print-technical-details {
    display: none !important;
  }

  .print-footnote {
    page-break-before: avoid;
  }
}

/* --- Correctif placement boutons du panneau paramètres --- */
.controls .stats-row {
  grid-column: 1 / 5 !important;
  display: flex !important;
  flex-wrap: wrap;
  gap: 12px !important;
  align-items: flex-end !important;
  min-width: 0 !important;
}

.controls .stats-row .info-field,
.controls .stats-row .height-info {
  min-width: 90px;
}

#printSummaryBtn {
  grid-column: 5 / 7 !important;
  justify-self: start !important;
  align-self: end !important;
  min-height: 44px;
  max-width: 220px;
}

#anchorBtn {
  grid-column: 7 / 9 !important;
  justify-self: start !important;
  align-self: end !important;
  min-height: 44px;
}

@media (max-width: 1000px) {
  .controls .stats-row,
  #printSummaryBtn,
  #anchorBtn {
    grid-column: 1 / -1 !important;
  }
}

/* --- V3 impression PDF : snapshot A4 paysage vraiment condensé --- */
@page {
  size: A4 landscape;
  margin: 6mm;
}

@media print {
  body.print-document {
    background: #fff !important;
  }

  body.print-document main {
    padding: 0 !important;
    margin: 0 !important;
    max-width: none !important;
  }

  body.print-document .print-summary {
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    background: #fff !important;
  }

  body.print-document .print-summary-header {
    display: grid !important;
    grid-template-columns: 1fr auto !important;
    gap: 4mm !important;
    align-items: start !important;
    margin: 0 0 2.5mm !important;
    padding: 0 !important;
  }

  body.print-document .print-summary .eyebrow {
    font-size: 7pt !important;
    margin: 0 0 1mm !important;
    letter-spacing: .12em !important;
  }

  body.print-document .print-summary h2 {
    font-size: 14pt !important;
    line-height: 1.05 !important;
    margin: 0 !important;
  }

  body.print-document .print-summary-note {
    display: none !important;
  }

  body.print-document .print-summary-brand {
    font-size: 8pt !important;
    line-height: 1.1 !important;
    padding-top: 0 !important;
    text-align: right !important;
  }

  body.print-document .print-summary-brand strong {
    font-size: 13pt !important;
  }

  body.print-document .print-geometry-summary {
    display: flex !important;
    align-items: center !important;
    min-height: 8mm !important;
    gap: 3mm !important;
    margin: 0 0 2.5mm !important;
    padding: 2mm 2.5mm !important;
    border: 1px solid #cfcfcf !important;
    border-radius: 4px !important;
    background: #fff !important;
  }

  body.print-document .print-geometry-summary span {
    flex: 0 0 auto !important;
    font-size: 6.5pt !important;
    line-height: 1.15 !important;
    text-transform: uppercase !important;
    letter-spacing: .08em !important;
    color: #6d6258 !important;
  }

  body.print-document .print-geometry-summary strong {
    font-size: 9.5pt !important;
    line-height: 1.2 !important;
    color: #2f2924 !important;
  }

  body.print-document .print-meta-grid {
    display: grid !important;
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
    gap: 2mm !important;
    margin: 0 0 3mm !important;
  }

  body.print-document .print-meta-grid div {
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    padding: 1.5mm 2mm !important;
    min-height: 0 !important;
  }

  body.print-document .print-meta-grid span {
    display: block !important;
    font-size: 6.5pt !important;
    line-height: 1 !important;
    margin-bottom: .8mm !important;
  }

  body.print-document .print-meta-grid strong {
    font-size: 8.5pt !important;
    line-height: 1.1 !important;
  }

  body.print-document .print-visual-grid {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 2mm !important;
    margin: 0 !important;
    align-items: stretch !important;
  }

  body.print-document .print-visual-grid .segment-card.atelier-card {
    display: block !important;
    margin: 0 !important;
    padding: 1.5mm !important;
    border: 1px solid #cfcfcf !important;
    border-radius: 4px !important;
    box-shadow: none !important;
    min-height: 0 !important;
    overflow: hidden !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
    background: #fff !important;
  }

  body.print-document .print-visual-grid .segment-card.atelier-card::before {
    display: none !important;
  }

  body.print-document .print-visual-grid .atelier-row {
    display: grid !important;
    grid-template-columns: 15mm minmax(0, 1fr) !important;
    gap: 1.5mm !important;
    align-items: center !important;
  }

  body.print-document .print-visual-grid .segment-configuration-card {
    display: none !important;
  }

  body.print-document .print-visual-grid .side-label {
    font-size: 7.5pt !important;
    line-height: 1.05 !important;
    min-width: 0 !important;
    padding: 0 !important;
  }

  body.print-document .print-visual-grid .piece-zone {
    width: 100% !important;
    max-width: none !important;
    aspect-ratio: 849 / 243 !important;
    height: auto !important;
    min-width: 0 !important;
    margin: 0 !important;
    transform: none !important;
    transform-origin: center center !important;
    position: relative !important;
    overflow: visible !important;
  }

  body.print-document .print-visual-grid .segment-bg {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
  }

  body.print-document .print-visual-grid .anchor-dot {
    display: none !important;
  }

  body.print-document .print-visual-grid .anchor-label {
    font-size: 6.5pt !important;
    line-height: 1 !important;
  }

  body.print-document .print-visual-grid .angle-label {
    font-size: 5.8pt !important;
  }

  body.print-document .print-visual-grid .prehole {
    font-size: 5.8pt !important;
    line-height: 1 !important;
  }

  body.print-document .print-visual-grid .cut-label {
    font-size: 5.8pt !important;
    line-height: 1 !important;
  }

  body.print-document .print-visual-grid .total-note {
    font-size: 5.2pt !important;
    line-height: 1.05 !important;
  }

  body.print-document .print-visual-grid .segment-warning,
  body.print-document .print-visual-grid .segment-warning-arrow {
    font-size: 5pt !important;
    line-height: 1 !important;
  }

  body.print-document .print-technical-details,
  body.print-document .print-footnote {
    display: none !important;
  }
}

/* --- V4 : panneau paramètres aligné + impression snapshot moins tassée --- */
.controls {
  grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
  align-items: end !important;
  column-gap: 12px !important;
  row-gap: 10px !important;
}

.controls > div:nth-child(1) {
  grid-column: 1 / 5 !important;
  min-width: 0 !important;
  max-width: none !important;
}

.controls > div:nth-child(2) {
  grid-column: 5 / 7 !important;
  min-width: 0 !important;
}

.controls > div:nth-child(3) {
  grid-column: 7 / 9 !important;
  min-width: 0 !important;
}

.controls > div:nth-child(4) {
  grid-column: 9 / 11 !important;
  min-width: 0 !important;
}

.controls .stats-row {
  grid-column: 1 / 8 !important;
  display: flex !important;
  flex-wrap: nowrap !important;
  gap: 10px !important;
  align-items: flex-end !important;
  min-width: 0 !important;
}

.controls .stats-row .info-field,
.controls .stats-row .height-info {
  flex: 0 0 auto !important;
  min-width: 86px !important;
}

#printSummaryBtn {
  grid-column: 8 / 11 !important;
  justify-self: stretch !important;
  align-self: end !important;
  min-height: 44px !important;
  max-width: none !important;
  white-space: nowrap !important;
}

#anchorBtn {
  grid-column: 11 / 13 !important;
  justify-self: stretch !important;
  align-self: end !important;
  min-height: 44px !important;
  white-space: nowrap !important;
}

@media (max-width: 1000px) {
  .controls {
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  }

  .controls > div:nth-child(1),
  .controls > div:nth-child(2),
  .controls > div:nth-child(3),
  .controls > div:nth-child(4),
  .controls .stats-row,
  #printSummaryBtn,
  #anchorBtn {
    grid-column: 1 / -1 !important;
  }

  .controls .stats-row {
    flex-wrap: wrap !important;
  }
}

@media print {
  body.print-document .print-summary h2 {
    font-size: 16pt !important;
  }

  body.print-document .print-meta-grid {
    gap: 2.5mm !important;
    margin-bottom: 4mm !important;
  }

  body.print-document .print-visual-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 3mm !important;
  }

  body.print-document .print-visual-grid .segment-card.atelier-card {
    padding: 2mm !important;
    border-radius: 5px !important;
  }

  body.print-document .print-visual-grid .atelier-row {
    grid-template-columns: 12mm minmax(0, 1fr) !important;
    gap: 2mm !important;
  }

  body.print-document .print-visual-grid .side-label {
    font-size: 9pt !important;
    line-height: 1.1 !important;
  }

  body.print-document .print-visual-grid .anchor-label {
    font-size: 8pt !important;
  }

  body.print-document .print-visual-grid .angle-label,
  body.print-document .print-visual-grid .prehole,
  body.print-document .print-visual-grid .cut-label {
    font-size: 7pt !important;
  }

  body.print-document .print-visual-grid .total-note {
    font-size: 6.2pt !important;
  }

  body.print-document .print-visual-grid .segment-warning,
  body.print-document .print-visual-grid .segment-warning-arrow {
    font-size: 5.8pt !important;
  }
}

/* --- V5 : correctifs impression snapshot + bouton plus large --- */
/* Défaut manquant : évite que la note "Longueur totale" sorte de son ancre. */
.piece-zone {
  --total-x: 50%;
  --total-y: 86%;
}

.controls {
  grid-template-columns: repeat(14, minmax(0, 1fr)) !important;
}

.controls > div:nth-child(1) { grid-column: 1 / 5 !important; }
.controls > div:nth-child(2) { grid-column: 5 / 7 !important; }
.controls > div:nth-child(3) { grid-column: 7 / 9 !important; }
.controls > div:nth-child(4) { grid-column: 9 / 11 !important; }

.controls .stats-row {
  grid-column: 1 / 8 !important;
  flex-wrap: nowrap !important;
}

#printSummaryBtn {
  grid-column: 8 / 12 !important;
  min-width: 210px !important;
  padding-left: 24px !important;
  padding-right: 24px !important;
  max-width: none !important;
  white-space: nowrap !important;
}

#anchorBtn {
  grid-column: 12 / 15 !important;
}

@media print {
  body.print-document .print-visual-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 3.2mm !important;
  }

  body.print-document .print-visual-grid .segment-card.atelier-card {
    padding: 2.2mm 2.2mm 2.6mm !important;
    overflow: hidden !important;
  }

  body.print-document .print-visual-grid .atelier-row {
    grid-template-columns: 13mm minmax(0, 1fr) !important;
    gap: 2mm !important;
  }

  body.print-document .print-visual-grid .piece-zone {
    --angle-tl-y: 31% !important;
    --angle-tr-y: 31% !important;
    --angle-bl-y: 68% !important;
    --angle-br-y: 68% !important;
    --cut-y: 51% !important;
    --pre-y: 12% !important;
    --total-x: 50% !important;
    --total-y: 87% !important;
    width: 100% !important;
    aspect-ratio: 849 / 260 !important;
    overflow: visible !important;
  }

  body.print-document .print-visual-grid .segment-bg {
    object-fit: contain !important;
  }

  body.print-document .print-visual-grid .angle-label {
    transform: translate(-50%, -50%) !important;
  }

  body.print-document .print-visual-grid .total-note {
    left: var(--total-x) !important;
    top: var(--total-y) !important;
    right: auto !important;
    bottom: auto !important;
    transform: translate(-50%, -50%) !important;
    white-space: nowrap !important;
    text-align: center !important;
  }

  body.print-document .print-visual-grid .prehole {
    transform: translate(-50%, -50%) !important;
  }

  body.print-document .print-visual-grid .segment-warning {
    top: -5% !important;
    left: 5% !important;
  }

  body.print-document .print-visual-grid .segment-warning-arrow {
    top: -1% !important;
    left: 35% !important;
  }
}

/* ===== CLEANUP CSS 2026-05 — OVERRIDES FINAUX STABLES =====
   Ce bloc remplace les anciens correctifs empilés en fin de fichier.
   Objectif : garder le comportement validé sans multiplier les règles contradictoires. */

/* Contrôles : stats + hauteur + bouton impression */
.atelier-sheet .controls .stats-row {
  display: flex !important;
  align-items: end !important;
  gap: 18px !important;
  flex-wrap: nowrap !important;
}

.atelier-sheet #printSummaryBtn {
  justify-self: stretch !important;
  align-self: end !important;
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
}

.atelier-sheet .controls .height-info {
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-end !important;
  min-height: 56px !important;
}

.atelier-sheet .controls .height-info .height-label {
  display: block !important;
  font-size: 9px !important;
  letter-spacing: 0.16em !important;
  text-transform: uppercase !important;
  color: var(--muted) !important;
  margin-bottom: 6px !important;
  font-weight: 700 !important;
}

.atelier-sheet .controls #domeHeight {
  display: flex !important;
  align-items: center !important;
  min-height: 34px !important;
  font-size: 18px !important;
  font-weight: 800 !important;
  color: var(--muted) !important;
}

/* Tablette / iPhone paysage : garder le bouton sur la ligne des stats. */
@media (min-width: 641px) and (max-width: 1000px) {
  .atelier-sheet .controls {
    grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
    align-items: end !important;
  }

  .atelier-sheet .controls > div:nth-child(1) {
    grid-column: 1 / 5 !important;
    max-width: none !important;
  }

  .atelier-sheet .controls > div:nth-child(2) {
    grid-column: 5 / 7 !important;
  }

  .atelier-sheet .controls > div:nth-child(3) {
    grid-column: 7 / 9 !important;
  }

  .atelier-sheet .controls > div:nth-child(4) {
    grid-column: 9 / 11 !important;
  }

  .atelier-sheet .controls .stats-row {
    grid-column: 1 / 8 !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr 1fr !important;
    gap: 16px !important;
    align-items: end !important;
  }

  .atelier-sheet #printSummaryBtn {
    grid-column: 8 / 12 !important;
  }

  .atelier-sheet #anchorBtn {
    grid-column: 12 / 13 !important;
  }
}

/* iPhone portrait : empilement lisible. */
@media (max-width: 640px) {
  .atelier-sheet .controls {
    grid-template-columns: 1fr !important;
  }

  .atelier-sheet .controls > div,
  .atelier-sheet .controls .stats-row,
  .atelier-sheet #printSummaryBtn,
  .atelier-sheet #anchorBtn {
    grid-column: 1 / -1 !important;
  }

  .atelier-sheet .controls .stats-row {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 14px !important;
  }

  .atelier-sheet .controls .height-info {
    grid-column: 1 / -1 !important;
    text-align: center !important;
    align-items: center !important;
  }

  .atelier-sheet #printSummaryBtn {
    width: 100% !important;
  }
}

/* Ancres par défaut : valables page + fenêtre d'impression. */
.piece-zone {
  --neighbor-left-x: 12.00%;
  --neighbor-left-y: 46.00%;
  --neighbor-right-x: 88.80%;
  --neighbor-right-y: 46.00%;
  --angle-tl-x: 22.17%;
  --angle-tl-y: 17.29%;
  --angle-tr-x: 78.98%;
  --angle-tr-y: 17.95%;
  --angle-bl-x: 18.52%;
  --angle-bl-y: 68.51%;
  --angle-br-x: 80.90%;
  --angle-br-y: 70.09%;
  --pre-x: 74.10%;
  --pre-y: 2.86%;
  --total-x: 50.40%;
  --total-y: 95.40%;
}

/* Impression : règles complémentaires pour la fenêtre générée par app.js.
   Les réglages visuels principaux restent injectés dans openPrintSummaryWindow(). */
body.print-document .segment-card.atelier-card {
  overflow: visible !important;
}

body.print-document .piece-zone {
  overflow: visible !important;
}


/* ===== CLEANUP CSS 2026-05 — LOT 1 =====
   Styles déplacés depuis app.js / openPrintSummaryWindow().
   Objectif : supprimer l'injection CSS inline sans modifier le rendu de la fiche condensée. */

body.print-document {
  margin: 0;
  background: #ffffff;
}

body.print-document main {
  max-width: 980px;
  margin: 0 auto;
  padding: 18px;
}

body.print-document .print-summary {
  display: block;
  margin: 0;
}

body.print-document .print-visual-grid .segment-card.atelier-card {
  min-height: 32mm !important;
  overflow: visible !important;
  padding-bottom: 7mm !important;
}

body.print-document .print-visual-grid .piece-zone {
  overflow: visible !important;
  aspect-ratio: 849 / 305 !important;
}

body.print-document .print-visual-grid .total-note {
  top: 92% !important;
  font-size: 6.2pt !important;
  line-height: 1.05 !important;
  z-index: 100 !important;
}

@media print {
  body.print-document main {
    max-width: none;
    padding: 0;
  }

  body.print-document .print-summary {
    border: 0 !important;
    box-shadow: none !important;
  }
}

/* --- FIX iOS impression : bouton manuel de secours dans la fenêtre PDF --- */
body.print-document .print-manual-button {
  position: sticky !important;
  top: 10px !important;
  z-index: 9999 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 10px 0 10px 18px !important;
  padding: 10px 16px !important;
  border-radius: 999px !important;
  border: 1px solid rgba(127, 90, 56, 0.28) !important;
  background: #2f2922 !important;
  color: #fffaf1 !important;
  font: 700 13px/1.1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
  cursor: pointer !important;
}

@media print {
  body.print-document .print-manual-button {
    display: none !important;
  }
}

/* ===== IOS PRINT HELP ===== */
.ios-print-help {
  max-width: 980px;
  margin: 8px auto 14px;
  padding: 10px 14px;
  border: 1px solid rgba(127, 90, 56, 0.18);
  border-radius: 14px;
  background: #fffaf1;
  color: #2f2922;
  font-size: 14px;
  line-height: 1.35;
}

@media print {
  .ios-print-help {
    display: none !important;
  }
}


/* ===== FIX iOS PRINT PREVIEW — LOT 2B =====
   Sur Safari iOS, l’aperçu d’impression peut capturer l’état écran plutôt que
   respecter correctement @media print. On masque donc le bouton dès le clic
   et on compacte la fiche en mode iOS pour limiter le passage sur 2 pages. */

body.print-document.is-printing .print-manual-button {
  display: none !important;
}

body.ios-print-document main {
  max-width: none !important;
  padding: 6mm 5mm !important;
  margin: 0 !important;
}

body.ios-print-document .print-summary {
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  box-shadow: none !important;
}

body.ios-print-document .print-summary-header {
  display: grid !important;
  grid-template-columns: 1fr auto !important;
  gap: 3mm !important;
  margin: 0 0 2mm !important;
}

body.ios-print-document .print-summary .eyebrow {
  font-size: 6pt !important;
  margin: 0 0 .5mm !important;
}

body.ios-print-document .print-summary h2 {
  font-size: 12pt !important;
  line-height: 1.05 !important;
  margin: 0 !important;
}

body.ios-print-document .print-summary-note {
  display: none !important;
}

body.ios-print-document .print-summary-brand {
  font-size: 7pt !important;
  line-height: 1.1 !important;
  text-align: right !important;
}

body.ios-print-document .print-meta-grid {
  display: grid !important;
  grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  gap: 1.5mm !important;
  margin: 0 0 2mm !important;
}

body.ios-print-document .print-meta-grid div {
  padding: 1mm 1.2mm !important;
  min-height: 0 !important;
}

body.ios-print-document .print-meta-grid span {
  font-size: 5.4pt !important;
  line-height: 1 !important;
  margin-bottom: .5mm !important;
}

body.ios-print-document .print-meta-grid strong {
  font-size: 6.6pt !important;
  line-height: 1.05 !important;
}

body.ios-print-document .print-visual-grid {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 2mm !important;
  margin: 0 !important;
}

body.ios-print-document .print-visual-grid .segment-card.atelier-card {
  padding: 1.2mm !important;
  min-height: 0 !important;
  break-inside: avoid !important;
  page-break-inside: avoid !important;
  overflow: hidden !important;
}

body.ios-print-document .print-visual-grid .atelier-row {
  grid-template-columns: 8mm minmax(0, 1fr) !important;
  gap: 1.2mm !important;
}

body.ios-print-document .print-visual-grid .side-label {
  font-size: 6.8pt !important;
  line-height: 1.05 !important;
  padding: 0 !important;
}

body.ios-print-document .print-visual-grid .piece-zone {
  aspect-ratio: 849 / 243 !important;
  overflow: visible !important;
}

body.ios-print-document .print-visual-grid .anchor-label,
body.ios-print-document .print-visual-grid .angle-label,
body.ios-print-document .print-visual-grid .prehole,
body.ios-print-document .print-visual-grid .cut-label {
  font-size: 5pt !important;
  line-height: 1 !important;
}

body.ios-print-document .print-visual-grid .total-note {
  font-size: 4.8pt !important;
  line-height: 1 !important;
}

body.ios-print-document .print-footnote {
  display: none !important;
}

@media print {
  body.print-document.is-printing .print-manual-button,
  body.print-document .print-manual-button,
  .ios-print-help {
    display: none !important;
  }
}

@media print {
  body.ios-print-document .print-summary {
    transform: scale(0.8);
    transform-origin: top left;
    width: 125%;
  }
}

/* ===== FIX iPHONE — afficher perçage + angles bas en mode ancres ===== */

@media (max-width: 600px) {
  body.show-anchors .piece-zone .prehole,
  body.anchor-edit .piece-zone .prehole {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  body.show-anchors .piece-zone .angle-label.bl,
  body.show-anchors .piece-zone .angle-label.br,
  body.anchor-edit .piece-zone .angle-label.bl,
  body.anchor-edit .piece-zone .angle-label.br {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
}

/* ===== FIX iPHONE LANDSCAPE — boutons admin du panneau contrôles ===== */

@media (max-width: 900px) and (orientation: landscape) {
  .atelier-sheet #anchorBtn,
  .atelier-sheet #anchorEditBtn {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    justify-self: stretch !important;
    min-width: 0 !important;
  }

  .atelier-sheet #printSummaryBtn {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    justify-self: stretch !important;
  }
}

/* ===== FIX iPHONE LANDSCAPE — panneau réglage ancres compact ===== */

@media (max-width: 900px) and (orientation: landscape) {
  .anchor-tools {
    right: 10px !important;
    bottom: 10px !important;
    width: min(360px, 46vw) !important;
    max-height: 72vh !important;
    overflow: auto !important;
    padding: 10px !important;
  }

  .anchor-tools h3 {
    font-size: 13px !important;
    margin-bottom: 5px !important;
  }

  .anchor-tools p {
    font-size: 11px !important;
    line-height: 1.25 !important;
    margin-bottom: 7px !important;
  }

  .anchor-tools textarea {
    min-height: 86px !important;
    max-height: 28vh !important;
    font-size: 10px !important;
  }

  .anchor-tools .tool-row {
    gap: 6px !important;
    margin-top: 8px !important;
  }

  .anchor-tools button {
    padding: 8px 10px !important;
    font-size: 11px !important;
  }
}

/* ===== FIX — Metrics panneau haut : hauteur + surface ===== */

.stats-row {
  grid-column: 1 / -1 !important;

  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;

  gap: 12px 14px !important;
  margin-top: 10px !important;
  width: 100% !important;
}

.info-field.stat {
  min-width: 0 !important;
}

.info-field.stat label {
  font-size: 9px !important;
  letter-spacing: 0.12em !important;
  line-height: 1.15 !important;
  white-space: nowrap !important;
}

.info-field.stat div {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 34px !important;

  display: flex !important;
  align-items: center !important;

  padding: 0 10px !important;
  font-size: 13px !important;
  font-weight: 700 !important;
}

.height-info {
  margin-left: 0 !important;
  padding-bottom: 0 !important;
}

.height-label,
.info-field label {
  white-space: nowrap !important;
}

#floorArea {
  min-width: 90px !important;
}

.atelier-sheet #printSummaryBtn {
  justify-self: stretch !important;
}

/* ===== FIX — Barre outils sous le panneau métriques ===== */

.tabs {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 6px !important;
}

.atelier-sheet .tabs #printSummaryBtn,
.atelier-sheet .tabs #anchorBtn,
.atelier-sheet .tabs #anchorEditBtn {
  width: auto !important;
  min-width: max-content !important;
  flex: 0 0 auto !important;
  grid-column: auto !important;
  justify-self: auto !important;
  white-space: nowrap !important;
  height: 30px !important;
  padding: 5px 12px !important;
  font-size: 12px !important;
  border-radius: 999px !important;
}

.atelier-sheet .tabs #printSummaryBtn {
  margin-left: auto !important;
}

@media (max-width: 760px) {
  .atelier-sheet .tabs #printSummaryBtn,
  .atelier-sheet .tabs #anchorBtn,
  .atelier-sheet .tabs #anchorEditBtn,
  .atelier-sheet .tabs .seg-select-inline {
    width: 100% !important;
    margin-left: 0 !important;
  }
}

/* ===== Séparation outils / navigation ===== */

.tabs {
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
}

.tabs-main,
.tabs-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.tabs-tools {
  justify-content: flex-start;
}

/* ===== FIX — Navigation + outils sous viewer ===== */

.atelier-sheet .tabs {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  gap: 10px !important;
  margin: 14px 0 18px !important;
}

.atelier-sheet .tabs-main,
.atelier-sheet .tabs-tools {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 10px !important;
  width: 100% !important;
}

.atelier-sheet .tabs-main .tab,
.atelier-sheet .tabs-tools .tab,
.atelier-sheet .tabs-tools #anchorEditBtn,
.atelier-sheet .tabs-main .seg-select-inline {
  width: auto !important;
  margin-left: 0 !important;
}

/* ===== FIX — Navigation + outils sous viewer ===== */

.atelier-sheet .tabs {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 6px !important;
  margin: 14px 0 18px !important;
}

.atelier-sheet .tabs-main,
.atelier-sheet .tabs-tools {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 10px !important;
  width: 100% !important;
}

.atelier-sheet .tabs-main {
  justify-content: flex-start !important;
}

.atelier-sheet .tabs-tools {
  justify-content: flex-end !important;
}

.atelier-sheet .tabs-main #printSummaryBtn {
  margin-left: auto !important;
}

.atelier-sheet .tabs-main .tab,
.atelier-sheet .tabs-tools .tab,
.atelier-sheet .tabs-tools #anchorEditBtn,
.atelier-sheet .tabs-main .seg-select-inline {
  width: auto !important;
  margin-left: 0 !important;
  flex: 0 0 auto !important;
}

@media (max-width: 760px) {
  .atelier-sheet .tabs-main,
  .atelier-sheet .tabs-tools {
    justify-content: flex-start !important;
  }

  .atelier-sheet .tabs-main #printSummaryBtn,
  .atelier-sheet .tabs-tools #anchorBtn,
  .atelier-sheet .tabs-tools #anchorEditBtn,
  .atelier-sheet .tabs-main .seg-select-inline {
    width: 100% !important;
    margin-left: 0 !important;
  }
}
#printSummaryBtn {
  font-weight: 700 !important;
  letter-spacing: 0.01em;
  box-shadow: 0 1px 2px rgba(60,40,20,.08);
}

/* ===== FINAL — Barre navigation + outils atelier ===== */

.atelier-sheet .tabs-main,
.atelier-sheet .tabs-tools {
  align-items: center !important;
}

.atelier-sheet .tabs-main .tab,
.atelier-sheet .tabs-tools .tab,
.atelier-sheet .tabs-tools #anchorEditBtn,
.atelier-sheet .tabs-main .seg-select-inline {
  height: 32px !important;
  min-height: 32px !important;
  padding: 6px 14px !important;
  border-radius: 999px !important;
  font-size: 12px !important;
  line-height: 1 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
}

/* Select segment : même hauteur et même présence que les boutons */
.atelier-sheet .tabs-main .seg-select-inline {
  min-width: 150px !important;
  padding-right: 30px !important;
  background: #fffaf1 !important;
  border: 1px solid rgba(127, 90, 56, 0.25) !important;
  font-weight: 600 !important;
}

/* Bouton principal */
.atelier-sheet #printSummaryBtn {
  height: 38px !important;
  min-height: 38px !important;
  padding: 8px 18px !important;
  font-weight: 800 !important;
  letter-spacing: 0.02em !important;
  background: #efe5d7 !important;
  border-color: rgba(127, 90, 56, 0.42) !important;
}

/* Ligne admin alignée sous le bouton impression */
.atelier-sheet .tabs-tools {
  justify-content: flex-end !important;
}

/* ===== FIX — cacher outils admin hors mode admin ===== */

body:not(.admin-mode) #anchorBtn,
body:not(.admin-mode) #anchorEditBtn {
  display: none !important;
}

/* ===== FIX — homogénéiser métriques ===== */

#domeHeight,
#floorArea {
  font-size: 16px !important;
  font-weight: 700 !important;
  line-height: 1.1 !important;
}

/* ===== FIX FINAL — même typo Hauteur / Surface ===== */

.atelier-sheet .info-field.stat #domeHeight,
.atelier-sheet .info-field.stat #floorArea {
  font-family: "Helvetica Neue", Arial, sans-serif !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  font-style: normal !important;
  line-height: 1 !important;
  color: var(--ink) !important;
  letter-spacing: 0 !important;
}

.atelier-sheet .info-field.stat > div {
  display: flex !important;
  align-items: center !important;
  min-height: 32px !important;
}

/* ===== FIX — champs numériques panneau haut ===== */

.atelier-sheet .controls input[type="number"],
.atelier-sheet .controls select {
  font-size: 15px !important;
  font-weight: 600 !important;
  color: var(--ink) !important;
}

/* ===== AJOUT — Metrics Lmax + poids triangle max ===== */
.atelier-sheet .stats-row {
  grid-column: 1 / -1 !important;

  display: grid !important;
  grid-template-columns: repeat(6, minmax(0, 1fr)) !important;

  gap: 10px !important;
  margin-top: 8px !important;
  align-items: start !important;
}

.atelier-sheet .stats-row {
  grid-column: 1 / -1 !important;

  display: grid !important;
  grid-template-columns: repeat(6, minmax(0, 1fr)) !important;

  gap: 10px !important;
  margin-top: 8px !important;
  align-items: start !important;
}

.info-field.stat {
  min-width: 0;
}

.atelier-sheet .controls .stats-row {
  flex-wrap: wrap !important;
  row-gap: 10px !important;
}

#maxSegmentLength,
#maxTriangleWeight {
  min-width: 92px !important;
}

@media (max-width: 640px) {
  .atelier-sheet .controls .stats-row {
    grid-template-columns: 1fr 1fr !important;
  }
}

/* ===== STATS PARAMÈTRES — UNE LIGNE DESKTOP ===== */

.atelier-sheet .stats-row {
  grid-column: 1 / -1 !important;
  display: grid !important;
  grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  gap: 10px !important;
  margin-top: 6px !important;
}

.atelier-sheet .info-field.stat {
  min-width: 0 !important;
}

.atelier-sheet .info-field.stat label {
  font-size: 8.5px !important;
  letter-spacing: 0.09em !important;
  white-space: nowrap !important;
}

.atelier-sheet .info-field.stat > div {
  min-height: 30px;
  display: flex;
  align-items: center;
  font-weight: 800;
  white-space: nowrap;
}

/* ===== FIX FINAL — STATS SUR UNE LIGNE ===== */

.atelier-sheet .controls .stats-row {
  grid-column: 1 / -1 !important;
  display: grid !important;
  grid-template-columns:
  0.8fr
  0.8fr
  1fr
  1.2fr
  1.2fr
  1.6fr !important;
  gap: 10px !important;
  width: 100% !important;
}

.atelier-sheet .stats-row label {
  white-space: nowrap !important;
  font-size: 8px !important;
  letter-spacing: 0.08em !important;
}

.atelier-sheet .controls .stats-row .info-field {
  min-width: 0 !important;
}

.atelier-sheet .controls .stats-row .info-field div {
  width: 100% !important;
}

/* ===== FIX FINAL — STATS LISIBLES SUR UNE LIGNE ===== */

.atelier-sheet .controls .stats-row {
  grid-column: 1 / -1 !important;
  display: grid !important;
  grid-template-columns: 0.7fr 0.7fr 0.9fr 1.25fr 1fr 1.8fr !important;
  gap: 12px !important;
  width: 100% !important;
  margin-top: 10px !important;
}

.atelier-sheet .controls .stats-row .info-field {
  min-width: 0 !important;
}

.atelier-sheet .controls .stats-row .info-field label {
  font-size: 7px !important;
  letter-spacing: 0.06em !important;
  white-space: normal !important;
  line-height: 1.05 !important;
  min-height: 14px !important;
}

.atelier-sheet .controls .stats-row .info-field div {
  width: 100% !important;
  min-width: 0 !important;
  height: 30px !important;
  padding: 0 8px !important;
  font-size: 12px !important;
  white-space: nowrap !important;
}

/* ===== PATCH ULTIME — STATS SUR TOUTE LA LARGEUR ===== */

.atelier-sheet .panel.controls > .stats-row {
  grid-column: 1 / 13 !important;
  width: 100% !important;
  max-width: none !important;

  display: grid !important;
  grid-template-columns: 0.75fr 0.75fr 0.9fr 1.25fr 1fr 1.8fr !important;
  gap: 12px !important;
  margin-top: 10px !important;
}

.atelier-sheet .panel.controls > .stats-row .info-field {
  width: 100% !important;
  min-width: 0 !important;
}

.atelier-sheet .panel.controls > .stats-row .info-field label {
  font-size: 7px !important;
  letter-spacing: 0.05em !important;
  line-height: 1.05 !important;
  white-space: normal !important;
}

.atelier-sheet .panel.controls > .stats-row .info-field div {
  width: 100% !important;
  min-width: 0 !important;
  height: 30px !important;
  font-size: 12px !important;
  padding: 0 8px !important;
}

/* ===== STATS — 2 LIGNES LISIBLES ===== */

.atelier-sheet .panel.controls > .stats-row {
  grid-column: 1 / 13 !important;
  width: 100% !important;

  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;

  gap: 12px 14px !important;
  margin-top: 12px !important;
}

.atelier-sheet .panel.controls > .stats-row .info-field label {
  font-size: 9px !important;
  letter-spacing: 0.12em !important;
  line-height: 1.15 !important;
  white-space: nowrap !important;
}

.atelier-sheet .panel.controls > .stats-row .info-field div {
  min-height: 34px !important;
  height: 34px !important;
  font-size: 13px !important;
  padding: 0 10px !important;
}

/* ===== FIX iPHONE — afficher le perçage en focus segment ===== */

@media (max-width: 640px) {
  #focusCard .piece-zone .prehole {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;

    position: absolute !important;
    left: var(--pre-x) !important;
    top: var(--pre-y) !important;
    transform: translate(-50%, -125%) !important;

    font-size: 10px !important;
    line-height: 1.05 !important;
    white-space: nowrap !important;
    color: #006fc9 !important;
    font-weight: 900 !important;
    z-index: 90 !important;
  }
}

/* ===== FIX iPHONE — champs diamètre / largeur / épaisseur lisibles ===== */

@media (max-width: 640px) {
  .atelier-sheet .panel.controls {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  /* Structure sur toute la largeur */
  .atelier-sheet .panel.controls > div:nth-child(1) {
    grid-column: 1 / -1 !important;
  }

  /* Diamètre, largeur, épaisseur en 2 colonnes respirantes */
  .atelier-sheet .panel.controls > div:nth-child(2),
  .atelier-sheet .panel.controls > div:nth-child(3),
  .atelier-sheet .panel.controls > div:nth-child(4) {
    grid-column: span 1 !important;
    min-width: 0 !important;
  }

  .atelier-sheet .panel.controls label {
    font-size: 7px !important;
    letter-spacing: 0.04em !important;
    line-height: 1.1 !important;
    white-space: normal !important;
    min-height: 16px !important;
  }

  .atelier-sheet .panel.controls input,
  .atelier-sheet .panel.controls select {
    font-size: 14px !important;
    padding: 7px 8px !important;
    min-width: 0 !important;
  }
}

/* ===== FIX iPHONE FINAL — panneau paramètres lisible ===== */

@media (max-width: 640px) {
  .atelier-sheet .panel.controls {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 14px 12px !important;
  }

  .atelier-sheet .panel.controls > div:nth-child(1),
  .atelier-sheet .panel.controls > div:nth-child(2),
  .atelier-sheet .panel.controls > .stats-row,
  .atelier-sheet .panel.controls .note,
  .atelier-sheet #resetBtn,
  .atelier-sheet #printSummaryBtn,
  .atelier-sheet #anchorBtn,
  .atelier-sheet #anchorEditBtn {
    grid-column: 1 / -1 !important;
  }

  .atelier-sheet .panel.controls > div:nth-child(3),
  .atelier-sheet .panel.controls > div:nth-child(4) {
    grid-column: span 1 !important;
  }

  .atelier-sheet .panel.controls label {
    font-size: 8px !important;
    letter-spacing: 0.06em !important;
    line-height: 1.15 !important;
    white-space: normal !important;
    min-height: 18px !important;
    overflow: visible !important;
  }

  .atelier-sheet .panel.controls input,
  .atelier-sheet .panel.controls select {
    width: 100% !important;
    min-width: 0 !important;
    height: 36px !important;
    font-size: 15px !important;
  }

  .atelier-sheet .panel.controls > .stats-row {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }

  .atelier-sheet .panel.controls > .stats-row .info-field label {
    font-size: 8px !important;
    min-height: 18px !important;
    white-space: normal !important;
  }
}

/* ===== FIX iPHONE FINAL — perçage visible en focus segment ===== */

@media (max-width: 640px) {
  #focusCard .piece-zone {
    --pre-x: 72% !important;
    --pre-y: 13% !important;
  }

  #focusCard .piece-zone .prehole {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;

    left: var(--pre-x) !important;
    top: var(--pre-y) !important;
    transform: translate(-50%, -50%) !important;

    font-size: 10px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    color: #006fc9 !important;
    font-weight: 900 !important;
    z-index: 999 !important;
  }
}

/* ===== DEBUG/FIX iPHONE — forcer affichage perçage focus ===== */

@media (max-width: 640px) {
  #focusCard .prehole,
  #focusCard .piece-zone .prehole,
  #focusCard [class*="pre"] {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;

    position: absolute !important;
    left: 72% !important;
    top: 12% !important;
    right: auto !important;
    bottom: auto !important;

    transform: translate(-50%, -50%) !important;

    color: #006fc9 !important;
    background: rgba(255,255,255,0.85) !important;
    font-size: 10px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    z-index: 9999 !important;
    pointer-events: none !important;
  }
  
  /* ===== FIX iPHONE FINAL — afficher le perçage global + focus ===== */

@media (max-width: 640px) {
  .atelier-sheet .piece-zone .prehole,
  #globalView .piece-zone .prehole,
  #focusCard .piece-zone .prehole {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;

    position: absolute !important;
    left: 72% !important;
    top: 10% !important;
    right: auto !important;
    bottom: auto !important;

    transform: translate(-50%, -50%) !important;

    color: #006fc9 !important;
    background: rgba(255, 255, 255, 0.75) !important;
    font-size: 8px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    z-index: 9999 !important;
    pointer-events: none !important;
  }
}

}

/* =========================================================
   Simulateur plancher — style Chand’Hôme
========================================================= */

.simulator-field {
  display: flex !important;
  align-items: flex-end !important;
  justify-content: flex-end !important;
}

.atelier-sheet .floor-simulator-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;

  width: auto !important;
  min-width: 180px !important;
  min-height: 32px !important;

  padding: 0 14px !important;

  border-radius: 999px !important;
  border: 1px solid rgba(127, 90, 56, 0.22) !important;

  background: linear-gradient(
    180deg,
    #f8f4ec 0%,
    #f1e8da 100%
  ) !important;

  color: #5d5247 !important;

  font-size: 12px !important;
  font-weight: 600 !important;
  text-decoration: none !important;

  transition:
    background 0.15s ease,
    transform 0.15s ease,
    border-color 0.15s ease;
}

.atelier-sheet .floor-simulator-btn::after {
  content: "";
  font-size: 11px;
  opacity: 0.7;
}

.atelier-sheet .floor-simulator-btn:hover {
  background: #ebe2d3 !important;
  border-color: rgba(127, 90, 56, 0.38) !important;
  transform: translateY(-1px);
}

/* ===== Harmonisation finale des boutons simulateurs ===== */

.stats-row .simulator-field {
  display: flex !important;
  align-items: stretch !important;
  justify-content: stretch !important;
}

.stats-row .simulator-field .floor-simulator-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;

  width: 100% !important;
  height: 34px !important;

  border: 1px solid var(--line) !important;
  border-radius: 999px !important;
  background: #fffaf1 !important;
  color: var(--ink) !important;

  font-size: 12px !important;
  font-weight: 700 !important;
  text-decoration: none !important;
  white-space: nowrap !important;
}

/* ===== Harmonisation douce des deux boutons simulateurs uniquement ===== */

.info-field.simulator-field {
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-end !important;
}

.info-field.simulator-field .floor-simulator-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;

  width: 100% !important;
  height: 34px !important;

  border: 1px solid var(--line) !important;
  border-radius: 999px !important;
  background: #fffaf1 !important;
  color: var(--ink) !important;

  font-size: 12px !important;
  font-weight: 700 !important;
  text-decoration: none !important;
  white-space: nowrap !important;
}

.simulators-row {
  grid-column: 1 / -1 !important;
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 12px !important;
  margin-top: 4px !important;
}

.simulators-row .floor-simulator-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  height: 34px !important;
  border: 1px solid var(--line) !important;
  border-radius: 999px !important;
  background: #fffaf1 !important;
  color: var(--ink) !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  text-decoration: none !important;
  white-space: nowrap !important;
}

.atelier-sheet .screws-calculator-btn {
  cursor: pointer !important;
}

.atelier-sheet .screws-calculator-btn::after {
  content: none !important;
}

@media (max-width: 720px) {
  .simulators-row {
    grid-template-columns: 1fr !important;
  }
}

.atelier-action-btn {
  background: #fff7e8;
  border-color: rgba(135, 98, 55, 0.38);
}

.simulator-link-btn {
  background: #f4f8f1;
  border-color: rgba(136,164,118,.45);
}

.simulator-link-btn:hover {
  background: #edf5e7;
}

.atelier-sheet .floor-simulator-pending,
.atelier-sheet .floor-simulator-pending:hover {
  background: #f3eee6 !important;
  border-color: rgba(127, 90, 56, 0.2) !important;
  color: #756a5e !important;
  cursor: not-allowed !important;
  opacity: 0.76;
  transform: none !important;
}

#integratedFallbackImage {
  transform: scale(0.74);
  transform-origin: center center;
}
/* Cartouche de traçabilité — fiche condensée segments */
.segment-cut-trace-badge {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  border: 1px solid rgba(184, 134, 78, 0.36);
  border-radius: 999px;
  background: #fffaf2;
  color: #5f5348;
  padding: 8px 12px;
  margin: 0 0 12px;
  font-size: 13px;
}
.segment-cut-trace-badge strong { color: #6b4423; }

@media print {
  .segment-cut-trace-badge {
    margin-bottom: 3mm;
    font-size: 9pt;
    padding: 5px 9px;
    gap: 10px;
    page-break-inside: avoid;
    break-inside: avoid;
    flex-wrap: nowrap;
    overflow: hidden;
  }
}


/* ===== LISIBILITÉ FINALE STABLE — LONGUEURS + ANGLES =====
   Objectif : une seule source de vérité pour éviter les overrides en cascade.
   - Fond blanc uniquement sur la valeur numérique de la longueur à découper.
   - Angles standard et ouvrants strictement harmonisés.
   - Règles spécifiques pour la fiche condensée écran et PDF, car elle possède
     des sélecteurs body.print-document plus forts que les cartes classiques. */

/* ---------- Longueur à découper : écran ---------- */
.segment-card .cut-label,
.atelier-sheet .cut-label,
#focusCard .cut-label,
.opening-segment-card .cut-label,
.print-summary .print-visual-grid .cut-label,
.print-summary .opening-wood-section.compact .opening-segment-card .cut-label {
  color: #111 !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  line-height: 1.05 !important;
  background: transparent !important;
  border-radius: 0 !important;
  padding: 0 !important;
  text-shadow:
    1px 1px 0 rgba(255,255,255,.85),
   -1px 1px 0 rgba(255,255,255,.85),
    1px -1px 0 rgba(255,255,255,.85),
   -1px -1px 0 rgba(255,255,255,.85) !important;
}

.segment-card .cut-label strong,
.atelier-sheet .cut-label strong,
#focusCard .cut-label strong,
.opening-segment-card .cut-label strong,
.print-summary .print-visual-grid .cut-label strong,
.print-summary .opening-wood-section.compact .opening-segment-card .cut-label strong {
  display: inline-block !important;
  color: #111 !important;
  font-size: 16px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  background: rgba(255,255,255,.86) !important;
  border-radius: 999px !important;
  padding: 2px 6px !important;
  text-shadow: none !important;
}

/* ---------- Angles : écran, même taille pour structure + ouvrants ---------- */
.segment-card .angle-label,
.atelier-sheet .angle-label,
#focusCard .angle-label,
.opening-segment-card .angle-label,
.print-summary .print-visual-grid .angle-label,
.print-summary .opening-wood-section.compact .opening-segment-card .angle-label {
  color: #111 !important;
  font-size: 22px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  text-shadow:
    1px 1px 0 rgba(255,255,255,.96),
   -1px 1px 0 rgba(255,255,255,.96),
    1px -1px 0 rgba(255,255,255,.96),
   -1px -1px 0 rgba(255,255,255,.96),
    0 1px 2px rgba(255,255,255,.9) !important;
}

.segment-card .angle-label.bl,
.segment-card .angle-label.br,
.atelier-sheet .angle-label.bl,
.atelier-sheet .angle-label.br,
#focusCard .angle-label.bl,
#focusCard .angle-label.br,
.opening-segment-card .angle-label.bl,
.opening-segment-card .angle-label.br,
.print-summary .print-visual-grid .angle-label.bl,
.print-summary .print-visual-grid .angle-label.br,
.print-summary .opening-wood-section.compact .opening-segment-card .angle-label.bl,
.print-summary .opening-wood-section.compact .opening-segment-card .angle-label.br {
  font-size: 21px !important;
}

/* ---------- Impression navigateur classique ---------- */
@media print {
  .segment-card .cut-label,
  .atelier-sheet .cut-label,
  #focusCard .cut-label,
  .opening-segment-card .cut-label {
    font-size: 10px !important;
    font-weight: 700 !important;
    background: transparent !important;
    padding: 0 !important;
  }

  .segment-card .cut-label strong,
  .atelier-sheet .cut-label strong,
  #focusCard .cut-label strong,
  .opening-segment-card .cut-label strong {
    font-size: 13px !important;
    font-weight: 900 !important;
    background: rgba(255,255,255,.78) !important;
    border-radius: 999px !important;
    padding: 1px 4px !important;
    text-shadow: none !important;
  }

  .segment-card .angle-label,
  .atelier-sheet .angle-label,
  #focusCard .angle-label,
  .opening-segment-card .angle-label {
    font-size: 16pt !important;
    font-weight: 900 !important;
    line-height: 1 !important;
  }

  .segment-card .angle-label.bl,
  .segment-card .angle-label.br,
  .atelier-sheet .angle-label.bl,
  .atelier-sheet .angle-label.br,
  #focusCard .angle-label.bl,
  #focusCard .angle-label.br,
  .opening-segment-card .angle-label.bl,
  .opening-segment-card .angle-label.br {
    font-size: 15pt !important;
  }
}

/* ---------- Fiche condensée / fenêtre PDF : sélecteurs volontairement très spécifiques ---------- */
body.print-document .print-summary .print-visual-grid .angle-label,
body.print-document .print-summary .opening-wood-section.compact .opening-segment-card .angle-label {
  color: #111 !important;
  font-size: 8.6pt !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  text-shadow:
    .45pt .45pt 0 rgba(255,255,255,.9),
   -.45pt .45pt 0 rgba(255,255,255,.9),
    .45pt -.45pt 0 rgba(255,255,255,.9),
   -.45pt -.45pt 0 rgba(255,255,255,.9) !important;
}

body.print-document .print-summary .print-visual-grid .angle-label.bl,
body.print-document .print-summary .print-visual-grid .angle-label.br,
body.print-document .print-summary .opening-wood-section.compact .opening-segment-card .angle-label.bl,
body.print-document .print-summary .opening-wood-section.compact .opening-segment-card .angle-label.br {
  font-size: 8.2pt !important;
}

body.print-document .print-summary .print-visual-grid .cut-label,
body.print-document .print-summary .opening-wood-section.compact .opening-segment-card .cut-label {
  color: #111 !important;
  font-size: 6.6pt !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  background: transparent !important;
  padding: 0 !important;
}

body.print-document .print-summary .print-visual-grid .cut-label strong,
body.print-document .print-summary .opening-wood-section.compact .opening-segment-card .cut-label strong {
  display: inline-block !important;
  font-size: 9pt !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  background: rgba(255,255,255,.82) !important;
  border-radius: 999px !important;
  padding: .5pt 2.4pt !important;
  text-shadow: none !important;
}

/* ===== WARNING ÉPAISSEUR — sans déplacer le champ ===== */
.atelier-sheet .controls > div:has(> #thick) {
  position: relative !important;
  align-self: end !important;
}

.atelier-sheet #woodThicknessWarning {
  position: absolute !important;
  top: calc(100% + 6px) !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 20 !important;
  margin: 0 !important;
  box-sizing: border-box !important;
}

/* Le warning est hors flux : on réserve sa hauteur avant les statistiques. */
.atelier-sheet .controls.has-wood-thickness-warning > .stats-row {
  margin-top: 96px !important;
}

/* Hypothèses du calcul de pré-perçage affichées sur chaque fiche segment. */
.piece-zone .prehole-profile,
.atelier-sheet .piece-zone .prehole-profile,
#focusCard .piece-zone .prehole-profile {
  position: absolute;
  left: var(--pre-x);
  top: var(--pre-y);
  transform: translate(-50%, 15%);
  color: #6d6257;
  font-size: 10px;
  font-weight: 650;
  line-height: 1.1;
  white-space: nowrap;
  z-index: 79;
  pointer-events: none;
}

@media print {
  .print-visual-grid .prehole-profile,
  body.print-document .print-visual-grid .prehole-profile {
    font-size: 8px !important;
  }
}

/* Légende de pré-perçage interactive : ouvre la documentation intégrée. */
.prehole-help-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
  cursor: help;
}

.prehole-help-link:hover,
.prehole-help-link:focus-visible {
  color: #7a4a1c;
  text-decoration-style: solid;
  outline: 2px solid rgba(122, 74, 28, 0.28);
  outline-offset: 3px;
  border-radius: 4px;
}

@media print {
  .prehole-help-link {
    color: inherit !important;
    text-decoration: none !important;
    outline: none !important;
  }
}


/* Le libellé de pré-perçage est un vrai contrôle interactif.
   Cette règle surcharge le positionnement historique qui neutralisait tous
   les événements de la légende ancrée sur le segment. */
.piece-zone .prehole.prehole-help-link,
.atelier-sheet .piece-zone .prehole.prehole-help-link,
#focusCard .piece-zone .prehole.prehole-help-link {
  pointer-events: auto !important;
  touch-action: manipulation;
}

/* Identité GeoCore™ et version de l'application. */
.build-version {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
  color: var(--muted);
}

.geocore-about-link {
  appearance: none;
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 12px;
  border: 1px solid rgba(127, 106, 81, 0.28);
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.9);
  color: var(--wood-dark);
  font: inherit;
  font-size: 13px;
  line-height: 1;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(79, 59, 41, 0.05);
}

.geocore-about-link:hover,
.geocore-about-link:focus-visible {
  border-color: rgba(127, 106, 81, 0.55);
  background: #fffaf2;
  color: var(--accent);
}

.app-version-label {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  line-height: 1;
  font-weight: 500;
  color: #746b62;
  white-space: nowrap;
}

@media print {
  .geocore-about-link {
    border: 0;
    padding: 0;
    min-height: 0;
    background: transparent;
    box-shadow: none;
    color: inherit;
    pointer-events: none;
  }
}


/* Chaque voisin reprend la couleur de sa propre famille de segment. */
.segment-card.atelier-card .neighbor.left {
  color: var(--neighbor-left-color, var(--fam, #d00000)) !important;
}
.segment-card.atelier-card .neighbor.right {
  color: var(--neighbor-right-color, var(--fam, #d00000)) !important;
}


/* =========================================================
   Aide commerciale — outils verrouillés de la page principale
========================================================= */
#printSummaryBtn {
  position: relative;
}

.workshop-help-trigger {
  position: absolute;
  top: -8px;
  right: -8px;
  z-index: 4;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid rgba(117, 83, 49, .35);
  border-radius: 999px;
  background: #fffaf2;
  color: #81572f;
  font-size: .78rem;
  font-weight: 850;
  line-height: 1;
  box-shadow: 0 3px 10px rgba(73, 48, 25, .14);
  cursor: help;
  opacity: 0;
  transform: scale(.82);
  transition: opacity 150ms ease, transform 150ms ease, background 150ms ease;
}

#printSummaryBtn[data-access-state="locked"]:hover .workshop-help-trigger,
#printSummaryBtn[data-access-state="locked"]:focus-within .workshop-help-trigger,
.workshop-help-trigger:focus-visible {
  opacity: 1;
  transform: scale(1);
}

.workshop-help-trigger:hover,
.workshop-help-trigger:focus-visible {
  background: #9a6736;
  color: #fff;
  outline: none;
}

.workshop-help-dialog {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(45, 34, 24, .48);
  backdrop-filter: blur(4px);
}

.workshop-help-card {
  position: relative;
  width: min(620px, 100%);
  max-height: min(760px, calc(100vh - 44px));
  overflow: auto;
  padding: 30px;
  border: 1px solid #e4d8c9;
  border-radius: 24px;
  background: #fffdf9;
  color: #332c26;
  box-shadow: 0 24px 70px rgba(45, 34, 24, .28);
}

.workshop-help-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: 1px solid #ded2c4;
  border-radius: 999px;
  background: #fffdf9;
  color: #332c26;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.workshop-help-kicker {
  margin: 0 42px 8px 0;
  color: #9a6736;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .12em;
}

.workshop-help-card h2 {
  margin: 0 42px 10px 0;
  font-size: clamp(1.45rem, 4vw, 2rem);
}

.workshop-help-intro {
  margin: 0 0 16px;
  color: #62584e;
  line-height: 1.55;
}

.workshop-help-card ul {
  margin: 0 0 22px;
  padding-left: 1.2rem;
  line-height: 1.55;
}

.workshop-help-example {
  padding: 18px;
  border: 1px solid #e7dccf;
  border-radius: 18px;
  background: #f8f3eb;
}

.workshop-help-example-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}

.workshop-help-example-heading h3 { margin: 0; font-size: .92rem; }

.workshop-help-zoom,
.workshop-example-print,
.workshop-example-open-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid #d7c6b4;
  border-radius: 999px;
  background: #fffdf9;
  color: #81572f;
  font-size: .78rem;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}

.workshop-help-zoom:hover,
.workshop-help-zoom:focus-visible,
.workshop-example-print:hover,
.workshop-example-print:focus-visible,
.workshop-example-open-tab:hover,
.workshop-example-open-tab:focus-visible {
  border-color: #9a6736;
  background: #9a6736;
  color: #fff;
  outline: none;
}

.workshop-help-image-button {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 12px;
  background: #fff;
  cursor: zoom-in;
}

.workshop-help-image-button img {
  display: block;
  width: 100%;
  max-height: 340px;
  object-fit: contain;
  border: 1px solid #e0d4c6;
  border-radius: 12px;
  background: #fff;
}

.workshop-help-image-hint {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 999px;
  background: rgba(73, 48, 25, .82);
  color: #fff;
  font-weight: 850;
  opacity: 0;
  transform: scale(.86);
  transition: opacity 150ms ease, transform 150ms ease;
}

.workshop-help-image-button:hover .workshop-help-image-hint,
.workshop-help-image-button:focus-visible .workshop-help-image-hint {
  opacity: 1;
  transform: scale(1);
}

.workshop-help-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
}

.workshop-help-footer p { margin: 0; color: #75695e; font-size: .86rem; }
.workshop-help-unlock { flex: 0 0 auto; background: #9a6736; color: #fff; font-weight: 750; }

.workshop-example-viewer {
  position: fixed;
  inset: 0;
  z-index: 12020;
  display: flex;
  flex-direction: column;
  background: rgba(34, 27, 21, .94);
  backdrop-filter: blur(5px);
}

.workshop-example-toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 18px;
  background: #fffdf9;
  border-bottom: 1px solid #d9cbbb;
}

.workshop-example-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.workshop-example-close { width: 38px; height: 38px; border-radius: 999px; font-size: 1.55rem; line-height: 1; }
.workshop-example-scroll { flex: 1 1 auto; overflow: auto; padding: 24px; text-align: center; }
.workshop-example-scroll img {
  display: inline-block;
  width: auto;
  max-width: none;
  height: auto;
  min-width: min(100%, 900px);
  vertical-align: top;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 20px 65px rgba(0, 0, 0, .45);
}

@media (hover: none) {
  #printSummaryBtn[data-access-state="locked"] .workshop-help-trigger,
  .workshop-help-image-hint { opacity: 1; transform: scale(1); }
}

@media (max-width: 600px) {
  .workshop-help-dialog { padding: 10px; }
  .workshop-help-card { padding: 24px 18px 20px; border-radius: 18px; }
  .workshop-help-footer, .workshop-help-example-heading { align-items: stretch; flex-direction: column; }
  .workshop-help-unlock { width: 100%; }
  .workshop-example-toolbar { align-items: flex-start; padding: 10px; }
  .workshop-example-actions { flex-wrap: wrap; justify-content: flex-end; }
  .workshop-example-scroll { padding: 10px; }
}

/* GeoCore Construction — offre commerciale dans les fiches verrouillées */
.workshop-help-offer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  margin-top: 20px;
  padding: 18px;
  border: 1px solid #dfcfbd;
  border-radius: 16px;
  background: #fbf7f0;
}
.workshop-help-offer-title { margin: 0 0 4px; color: #493019; font-weight: 850; font-size: 1.02rem; }
.workshop-help-offer-subtitle { margin: 0 0 10px; color: #75695e; font-size: .88rem; }
.workshop-help-offer-benefits { margin: 0; padding-left: 1.15rem; color: #51483f; font-size: .84rem; line-height: 1.45; }
.workshop-help-offer-actions { display: flex; min-width: 265px; flex-direction: column; gap: 9px; align-items: stretch; }
.workshop-help-buy {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 10px 15px;
  border-radius: 11px;
  background: #9a6736;
  color: #fff !important;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 5px 16px rgba(90, 58, 28, .16);
}
.workshop-help-buy:hover { filter: brightness(.96); transform: translateY(-1px); }
.workshop-help-unlock { min-height: 39px; background: #fff; color: #6d4a2c; border: 1px solid #cdb8a2; }
.workshop-help-test-note { display: block; color: #927c68; font-size: .72rem; text-align: center; }
@media (max-width: 720px) {
  .workshop-help-offer { grid-template-columns: 1fr; }
  .workshop-help-offer-actions { min-width: 0; }
}

/* GeoCore Construction — design lancement / exemple libre */
.workshop-help-demo-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-bottom: 6px;
  padding: 3px 9px;
  border: 1px solid #ccb292;
  border-radius: 999px;
  background: #fffaf3;
  color: #76512f;
  font-size: .7rem;
  font-weight: 850;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.workshop-help-demo-note {
  margin: 10px 2px 0;
  color: #66584a;
  font-size: .82rem;
  line-height: 1.45;
}
.workshop-help-offer {
  border-color: #ceb696;
  background:
    radial-gradient(circle at 100% 0, rgba(205, 169, 122, .18), transparent 34%),
    linear-gradient(145deg, #fffaf3 0%, #f5ecdf 100%);
  box-shadow: 0 10px 28px rgba(80, 53, 28, .08);
}
.workshop-help-offer-eyebrow {
  margin: 0 0 4px;
  color: #9a6736;
  font-size: .7rem;
  font-weight: 900;
  letter-spacing: .09em;
}
.workshop-help-price-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  margin: 8px 0 7px;
}
.workshop-help-price-line strong {
  color: #5e3c1f;
  font-size: 1.08rem;
}
.workshop-help-price-line span {
  color: #7c6a59;
  font-size: .8rem;
}
.workshop-help-buy {
  min-height: 46px;
  background: linear-gradient(180deg, #a9723f 0%, #8d5b2d 100%);
}
.workshop-help-test-note {
  max-width: 300px;
  line-height: 1.35;
}

/* Fiche PDF : remplacer l’ancienne capture statique par l’exemple interactif */
.workshop-help-demo-card {
  padding: 18px;
  border: 1px solid #decbb4;
  border-radius: 18px;
  background: linear-gradient(145deg, #fffaf3 0%, #f6ecdf 100%);
}
.workshop-help-demo-card h3 { margin: 8px 0 8px; color: #493019; font-size: 1rem; }
.workshop-help-demo-card p { margin: 0 0 10px; color: #62584e; font-size: .86rem; line-height: 1.5; }
.workshop-help-demo-link {
  display: inline-flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
  padding: 9px 13px;
  border: 1px solid #c7a77f;
  border-radius: 10px;
  background: #fffaf3;
  color: #704a27 !important;
  font-weight: 800;
  text-decoration: none;
  box-sizing: border-box;
}
.workshop-help-demo-link:hover, .workshop-help-demo-link:focus-visible { background:#f7ead8; outline:none; }
