:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #1a1d21;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --focus: #1a1d21;
  --metal: #c9ced3;
  --metal-bright: #e9ecef;
  --metal-dark: #9aa1a8;
  --plaque-bg: #5e2129;
  --plaque-text: #A5A5A5;
  --font-plaque: Oswald, "Arial Narrow", sans-serif;
  --font-ui: "Instrument Sans", system-ui, sans-serif;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-ui);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.page {
  width: min(1100px, calc(100% - 3rem));
  margin: 0 auto;
  padding: 2.5rem 0 4rem;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.brand-logo {
  display: block;
  height: 40px;
  width: auto;
}

.header-titles {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  min-width: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: flex-end;
}

.lang-switch {
  display: flex;
  align-items: center;
}

.lang-switch select {
  appearance: none;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  min-height: 32px;
  padding: 0.25rem 1.75rem 0.25rem 0.7rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7280' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.55rem center;
  cursor: pointer;
}

.lang-switch select:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.auth-who {
  font-size: 0.8125rem;
  color: var(--muted);
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-logout {
  margin: 0;
}

.auth-page {
  max-width: 420px;
  margin: 0 auto;
}

.auth-page > p {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer {
  margin-top: 3.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.5;
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: inherit;
}

.header h1 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.header h1 a {
  color: inherit;
  text-decoration: none;
}

.header h1 a:hover,
.header h1 a:focus-visible {
  text-decoration: underline;
}

.meta {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.85fr);
  gap: 3.5rem;
  align-items: start;
}

.preview-slot {
  min-width: 0;
  align-self: start;
}

.preview {
  position: relative;
  height: auto;
  min-height: 520px;
  display: grid;
  /* Rangées : scène, boutons, bloc debug (commune incluse). */
  grid-template-rows: minmax(280px, 1fr) auto auto;
  align-items: stretch;
  justify-items: stretch;
  gap: 1rem;
  padding: 1.5rem 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 2px;
  overflow-x: hidden;
  overflow-y: auto;
}

/* Fixé à l'écran (desktop) : ne se décroche plus en bas du formulaire. */
@media (min-width: 861px) {
  .preview.is-pinned {
    position: fixed;
    top: 1rem;
    z-index: 5;
    max-height: calc(100vh - 2rem);
  }
}

.preview.is-showing-measures {
  padding: 1.5rem 1rem 1.25rem;
}

.preview-stage {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: 100%;
  padding: 1.5rem 1.75rem;
  box-sizing: border-box;
  overflow: hidden;
}

/* Cotes affichées : marge réservée autour de la plaque pour que les mesures
   (barres + étiquettes) de gauche, de droite et du haut restent dans le cadre.
   L'échelle de l'aperçu est recalculée au basculement (setMeasuresVisible). */
.preview.is-showing-measures .preview-stage {
  padding: 4.5rem 7rem;
}

.preview-stage .plaque {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.preview-actions {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.plaque-measures {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  overflow: visible;
  pointer-events: none;
  z-index: 8;
}

.plaque-measures[hidden] {
  display: none !important;
}

.plaque-measures .dim-ext,
.plaque-measures .dim-bar,
.plaque-measures .dim-tick {
  position: absolute;
  background: #111827;
  box-shadow: 0 0 0 1.5px #fff;
}

.plaque-measures .dim-ext {
  height: 2px;
  transform-origin: 0 50%;
}

.plaque-measures .dim-item {
  position: absolute;
}

.plaque-measures .dim-item.is-h {
  height: 0;
}

.plaque-measures .dim-item.is-v {
  width: 0;
}

.plaque-measures .dim-item.is-h .dim-bar {
  left: 0;
  right: 0;
  top: -1px;
  height: 2px;
}

.plaque-measures .dim-item.is-v .dim-bar {
  top: 0;
  bottom: 0;
  left: -1px;
  width: 2px;
}

.plaque-measures .dim-item.is-h .dim-tick {
  width: 2px;
  height: 12px;
  top: -6px;
}

.plaque-measures .dim-item.is-h .dim-tick-start {
  left: 0;
}

.plaque-measures .dim-item.is-h .dim-tick-end {
  right: 0;
}

.plaque-measures .dim-item.is-v .dim-tick {
  width: 12px;
  height: 2px;
  left: -6px;
}

.plaque-measures .dim-item.is-v .dim-tick-start {
  top: 0;
}

.plaque-measures .dim-item.is-v .dim-tick-end {
  bottom: 0;
}

.plaque-measures .dim-label {
  position: absolute;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
  color: #111827;
  background: #fff;
  border: 1px solid #111827;
  border-radius: 2px;
  padding: 0.14rem 0.4rem;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.12);
}

.plaque-measures .dim-item.is-h .dim-label {
  left: 50%;
  top: -8px;
  transform: translate(-50%, -100%);
}

.plaque-measures .dim-item.is-h.dim-holes .dim-label {
  top: 8px;
  transform: translate(-50%, 0);
}

.plaque-measures .dim-item.is-v.dim-height .dim-label {
  top: 50%;
  right: 8px;
  left: auto;
  transform: translate(0, -50%);
}

.plaque-measures .dim-item.is-v.dim-cap .dim-label {
  top: 50%;
  left: 8px;
  transform: translate(0, -50%);
}

.plaque {
  --w: 280px;
  --h: 222px;
  position: relative;
  width: var(--w);
  height: var(--h);
  box-sizing: border-box;
  overflow: hidden;
  transition: none;
}

.plaque-face {
  position: absolute;
  inset: 0;
  background: var(--plaque-bg);
}

.plaque-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  overflow: visible;
}

.plaque-frame:empty {
  display: none;
}

.shape-rustica .plaque-face {
  background: var(--plaque-bg);
}

.shape-rustica .plaque-inner {
  background: transparent;
}

.plaque-inner {
  position: absolute;
  inset: var(--plaque-inset, 9px);
  background: transparent;
  overflow: hidden;
}

.plaque-text-layer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  pointer-events: none;
  box-sizing: border-box;
  padding-left: var(--margin-h-px, 0px);
  padding-right: var(--margin-h-px, 0px);
}

.plaque-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2em;
  padding: 0;
  text-align: center;
  max-width: 100%;
  pointer-events: none;
}

.plaque-icon {
  position: absolute;
  left: var(--icon-x, 18%);
  top: var(--icon-y, 50%);
  z-index: 2;
  width: 22%;
  max-width: 3.2rem;
  aspect-ratio: 1;
  max-height: 62%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--plaque-text);
  overflow: visible;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.plaque-icon.is-hidden {
  display: none;
}

.plaque-icon.is-dragging {
  cursor: grabbing;
}

.plaque-icon > svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
  pointer-events: none;
}

.plaque-icon svg [fill]:not([fill="none"]) {
  fill: currentColor !important;
}

.plaque-icon svg [stroke]:not([stroke="none"]) {
  stroke: currentColor;
}

.line {
  color: var(--plaque-text);
  font-family: var(--font-plaque);
  line-height: 1.05;
  letter-spacing: 0;
  font-weight: 400;
  font-synthesis: none;
  text-transform: none;
  transition: color 0.25s ease, text-shadow 0.25s ease;
  display: block;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: keep-all;
  max-width: 100%;
}

.line-primary {
  font-size: var(--line1-size, 3rem);
  font-weight: 400;
}

.line-secondary {
  font-size: clamp(0.75rem, 2vw, 1rem);
  letter-spacing: inherit;
  font-weight: 400;
  text-transform: none;
}

.line.is-empty {
  display: none;
}

.plaque-content.is-single-line {
  width: auto;
  max-width: 100%;
  height: auto;
  padding-top: 0;
  padding-bottom: 0;
  gap: 0;
  justify-content: center;
}

.plaque-content.is-single-line .line-primary {
  line-height: 1;
  white-space: nowrap;
}

.plaque.layout-rules .plaque-text-layer {
  display: flex;
  align-items: center;
  justify-content: center;
  inset: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.plaque.layout-rules .plaque-content {
  gap: var(--line-gap-px, 0px);
  padding: 0;
  height: auto;
  width: auto;
  max-width: 100%;
  justify-content: center;
}

.plaque.layout-rules .line {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  line-height: var(--cap-px, 1);
  height: var(--cap-px, auto);
  max-width: none;
  overflow: visible;
  letter-spacing: inherit;
  text-transform: none;
}

/* Encre du texte : conteneur transformé pour caler la géométrie réelle des
   glyphes (boîte d'encre) sur celle du DXF. La sonde donne la ligne de base. */
.plaque.layout-rules .line-ink {
  display: inline-block;
  will-change: transform;
}
.line-text {
  white-space: pre;
  letter-spacing: inherit;
}
.line-probe {
  display: inline-block;
  width: 0;
  height: 0;
}

.plaque.layout-rules .line.is-empty,
.plaque.layout-rules .line[hidden] {
  display: none !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

.plaque.layout-rules .line-secondary {
  font-size: var(--line1-size, 3rem);
  letter-spacing: inherit;
  white-space: nowrap;
}

.plaque.layout-rules.font-scs .line-secondary,
.plaque.layout-rules.font-snv .line-secondary {
  letter-spacing: inherit;
  text-transform: none;
}

.plaque-content.align-left .line {
  justify-content: flex-start;
}
.plaque-content.align-right .line {
  justify-content: flex-end;
}
.plaque-content.align-left {
  align-items: flex-start;
  text-align: left;
  width: 100%;
  padding-left: 9%;
  padding-right: 9%;
}

.plaque-content.align-right {
  align-items: flex-end;
  text-align: right;
  width: 100%;
  padding-left: 9%;
  padding-right: 9%;
}

.plaque.shape-sentier .plaque-content.align-left,
.plaque.shape-sentier .plaque-content.align-right {
  padding-left: 0;
  padding-right: 0;
}

.plaque-content.align-center {
  align-items: center;
  text-align: center;
}

.plaque-content.is-single-line.align-left,
.plaque-content.is-single-line.align-right {
  justify-content: center;
}

/* Shapes */
.shape-echancree .plaque-face,
.shape-echancree .plaque-inner,
.shape-rustica .plaque-face,
.shape-rustica .plaque-inner {
  clip-path: none;
}

.shape-classique .plaque-face,
.shape-classique .plaque-inner {
  border-radius: 0;
}

.shape-classique .plaque-inner {
  inset: var(--plaque-inset, 8px);
  border-radius: 0;
}

.shape-rustica .plaque-face,
.shape-rustica .plaque-inner {
  border-radius: 0;
}

.shape-rustica .plaque-inner {
  inset: var(--plaque-inset, 10px);
}

.shape-moderne .plaque-face,
.shape-moderne .plaque-inner {
  border-radius: 0;
}

.shape-moderne .plaque-inner {
  inset: var(--plaque-inset, 7px);
}

.shape-antica .plaque-face,
.shape-antica .plaque-inner {
  border-radius: 0;
}

.shape-antica .plaque-inner {
  inset: var(--plaque-inset, 12px);
  border-radius: 0;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.28), inset 0 0 0 5px rgba(0, 0, 0, 0.18);
}

.shape-rond .plaque-face,
.shape-rond .plaque-inner {
  border-radius: 0;
}

.shape-rond .plaque-inner {
  inset: var(--plaque-inset, 7px);
}

/* Aspect */
.aspect-relief .plaque-inner {
  box-shadow: none;
}

.aspect-relief .line {
  text-shadow: none;
}

.aspect-plat .line {
  text-shadow: none;
}

/* Polices de production (Documentation). */
@font-face {
  font-family: "SCS Regular";
  src: url("assets/font/scs_regular.otf") format("opentype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Gothic";
  src: url("assets/font/gothic.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "SnvDOT";
  src: url("assets/font/snv.woff2") format("woff2"), url("assets/font/snv.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

/* Fonts */
.font-gothic { --font-plaque: "Gothic", "Arial Narrow", sans-serif; }
.font-gothic .line { font-weight: 400; letter-spacing: inherit; text-transform: none; }

.font-scs { --font-plaque: "SCS Regular", Helvetica, sans-serif; }
.font-scs .line { font-weight: 400; letter-spacing: inherit; }
.font-scs .line-secondary { letter-spacing: inherit; }

.font-snv { --font-plaque: "SnvDOT", sans-serif; }
.font-romaine { --font-plaque: "Libre Baskerville", Georgia, serif; }
.font-snv .line,
.font-romaine .line { letter-spacing: inherit; }
.font-snv .line-secondary,
.font-romaine .line-secondary { letter-spacing: inherit; text-transform: none; }

.font-regular { --font-plaque: Inter, Helvetica, sans-serif; }
.font-regular .line { font-weight: 400; letter-spacing: inherit; }

.font-bodoni { --font-plaque: "Bodoni Moda", "Times New Roman", serif; }
.font-bodoni .line { letter-spacing: inherit; }

.font-frutiger { --font-plaque: "Source Sans 3", Helvetica, sans-serif; }
.font-frutiger .line { font-weight: 600; letter-spacing: 0.01em; }

.plaque.text-dark { --plaque-text: #1a1d21; }
.plaque.text-dark.aspect-relief .line {
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Holes : diamètre en mm (--hole-mm), calé via --px-per-mm. */
.hole {
  position: absolute;
  width: calc(var(--px-per-mm, 1) * var(--hole-mm, 7) * 1px);
  height: calc(var(--px-per-mm, 1) * var(--hole-mm, 7) * 1px);
  border-radius: 50%;
  background: #fff;
  box-shadow: none;
  opacity: 0;
  z-index: 2;
  transition: opacity 0.2s ease;
  margin: 0;
  transform: translate(-50%, -50%);
}

.plaque[data-holes="2"] .hole-tl,
.plaque[data-holes="2"] .hole-tr,
.plaque[data-holes="left"] .hole-tl,
.plaque[data-holes="left"] .hole-tr,
.plaque[data-holes="right"] .hole-tl,
.plaque[data-holes="right"] .hole-tr,
.plaque[data-holes="4"] .hole,
.plaque[data-holes="mr190"] .hole,
.plaque[data-holes="mas"] .hole {
  opacity: 1;
}

.hole-tl { top: 10px; left: 10px; }
.hole-tr { top: 10px; right: 10px; }
.hole-bl { bottom: 10px; left: 10px; }
.hole-br { bottom: 10px; right: 10px; }

.shape-rond .hole-tl { top: 26px; left: 50%; transform: translateX(-50%); }
.shape-rond .hole-tr,
.shape-rond .hole-br { display: none; }
.shape-rond .hole-bl { bottom: 26px; left: 50%; transform: translateX(-50%); }
.shape-rond[data-holes="2"] .hole-bl { opacity: 0; }
.shape-rond[data-holes="4"] .hole-tl,
.shape-rond[data-holes="4"] .hole-bl { opacity: 1; }
.plaque[data-holes="mas"] .hole {
  display: block;
  opacity: 1;
  transform: translate(-50%, -50%);
}

/* Sidebar */
.sidebar {
  padding-top: 0.25rem;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.group {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.group[hidden],
.field-hint[hidden] {
  display: none;
}

.label {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

input[type="text"] {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  border-radius: 0;
  padding: 0.55rem 0;
  font: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease;
}

input[type="text"]::placeholder {
  color: #9ca3af;
}

input[type="text"]:focus {
  border-bottom-color: var(--focus);
}

.field-select {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  border-radius: 0;
  padding: 0.55rem 0;
  font: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease;
  cursor: pointer;
}

.field-select:focus {
  border-bottom-color: var(--focus);
}

input[type="file"] {
  width: 100%;
  font: inherit;
  font-size: 0.875rem;
  color: var(--text);
}

.field-hint {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.45;
}

.label-inline {
  margin-top: 0.35rem;
}

.icon-pos-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.icon-pos-wrap.is-hidden {
  display: none;
}

.btn-sm {
  min-height: 36px;
  padding: 0.35rem 0.75rem;
  font-size: 0.8125rem;
  align-self: flex-start;
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.pill {
  cursor: pointer;
}

.pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.pill span {
  display: block;
  padding: 0.4rem 0.7rem;
  font-size: 0.8125rem;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 999px;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.pills-shape .pill span,
.pills-outlined .pill span {
  border-color: var(--line-strong);
}

.pill:hover span {
  color: var(--text);
}

.pill:has(input:checked) span {
  color: var(--text);
  background: var(--surface);
  border-color: var(--line-strong);
}

.pills-visual {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 0.5rem;
}

.pill-visual > .pill-figure,
.swatch-figure > .pill-figure {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  height: 100%;
  padding: 0.35rem;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #eef0f2;
  color: var(--muted);
}

.pill-figure img {
  display: block;
  width: 100%;
  height: 64px;
  object-fit: contain;
  background: #e4e6e8;
  border-radius: 4px;
}

.pill-figure em {
  font-style: normal;
  font-size: 0.72rem;
  line-height: 1.25;
  text-align: center;
}

.pill-visual:hover > .pill-figure,
.swatch-figure:hover > span.pill-figure {
  color: var(--text);
  transform: none;
}

.pill-visual:has(input:checked) > .pill-figure,
.swatch-figure:has(input:checked) > span.pill-figure {
  color: var(--text);
  background: var(--surface);
  border-color: var(--text);
  box-shadow: none;
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.swatches-figures {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
}

.swatch-figure {
  width: auto;
  height: auto;
}

.swatch-figure:hover > .pill-figure {
  transform: none;
}

.swatch {
  position: relative;
  cursor: pointer;
  width: 28px;
  height: 28px;
}

.swatch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.swatch span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--c);
  border: 1px solid rgba(0, 0, 0, 0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.swatch:hover span {
  transform: scale(1.08);
}

.swatch:has(input:checked) span {
  box-shadow: 0 0 0 1.5px var(--bg), 0 0 0 3px var(--text);
}

/* Bootstrap 5 tooltip (JS only, sans bootstrap.min.css pour ne pas restyler le site) */
.tooltip {
  position: absolute;
  z-index: 1080;
  display: block;
  margin: 0;
  font-family: inherit;
  font-size: 0.75rem;
  line-height: 1.2;
  word-wrap: break-word;
  opacity: 0;
  pointer-events: none;
}
.tooltip.fade {
  transition: opacity 0.15s linear;
}
.tooltip.show {
  opacity: 1;
}
.tooltip-arrow {
  display: none;
}
.tooltip-inner {
  max-width: 200px;
  padding: 0.35rem 0.55rem;
  color: #fff;
  text-align: center;
  background-color: #212529;
  border-radius: 0.25rem;
}

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

.nav-link,
.cart-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0 0.25rem;
  color: var(--text);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
}

.nav-link:hover,
.nav-link:focus-visible,
.cart-link:hover,
.cart-link:focus-visible {
  text-decoration: underline;
}

.nav-link.is-active,
.cart-link.is-active {
  text-decoration: underline;
}

.cart-badge {
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.4rem;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--text);
  color: #fff;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.flash {
  margin: -1rem 0 1.5rem;
  padding: 0.75rem 1rem;
  border-radius: 2px;
  font-size: 0.875rem;
}

.flash-ok {
  background: #ecfdf3;
  color: #14532d;
}

.flash-error {
  background: #fef2f2;
  color: #7f1d1d;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.55rem 1rem;
  border-radius: 2px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  background: none;
  color: var(--text);
}

.btn-primary {
  background: var(--text);
  color: #fff;
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background: #000;
}

.btn-ghost {
  border-color: var(--line-strong);
  background: var(--surface);
}

.btn-ghost:hover,
.btn-ghost:focus-visible {
  border-color: var(--text);
}

.btn-ghost[aria-pressed="true"] {
  border-color: var(--text);
  background: var(--text);
  color: #fff;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-block {
  width: 100%;
}

.actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.actions input[type="number"],
.qty-form input[type="number"] {
  width: 4.5rem;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  padding: 0 0.55rem;
  border-radius: 2px;
}

.price-hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.cart-layout {
  display: grid;
  grid-template-columns: 1.4fr 0.85fr;
  gap: 2.5rem;
  align-items: start;
}

.cart-item {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 1.25rem;
  align-items: start;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--line);
}

.cart-item h2 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 600;
}

.cart-item p {
  margin: 0 0 0.35rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

.cart-price {
  color: var(--text) !important;
}

.cart-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.6rem;
}

.cart-line-total {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}

.cart-thumb {
  width: 120px;
  min-height: 96px;
  padding: 0.35rem;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
}

.plaque.mini {
  width: var(--w, 88px);
  height: var(--h, 70px);
  filter: drop-shadow(0 4px 8px rgba(26, 29, 33, 0.1));
}

.plaque.mini .plaque-inner {
  inset: 5px;
}

.plaque.mini .line-primary {
  font-size: 1.1rem;
  white-space: nowrap;
}

.plaque.mini .line-secondary {
  font-size: 0.45rem;
  white-space: nowrap;
}

.cart-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 0 0;
}

.empty-state {
  padding: 3rem 0;
  text-align: center;
}

.empty-state p {
  margin: 0 0 1rem;
  color: var(--muted);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 1.25rem 1.35rem 1.5rem;
  margin-bottom: 1rem;
}

.card h2 {
  margin: 0 0 1rem;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.quote-ref {
  background: #ecfdf3;
  border-color: #86efac;
}

.quote-ref-number {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #14532d;
  font-variant-numeric: tabular-nums;
}

.quote-ref .price-hint {
  margin: 0.5rem 0 0.85rem;
}

.quote-ref-list {
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
  color: #166534;
  font-size: 0.875rem;
}

.quote-ref-list li + li {
  margin-top: 0.25rem;
}

.client-form,
.client-form label {
  display: block;
}

.client-form label {
  margin: 0.7rem 0 0.25rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.client-form input,
.client-form textarea {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  padding: 0.45rem 0;
  outline: none;
  resize: vertical;
}

.client-form input:focus,
.client-form textarea:focus {
  border-bottom-color: var(--focus);
}

.client-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 0.75rem;
}

.client-form .btn {
  margin-top: 1rem;
}

.totals dl {
  margin: 0 0 1.25rem;
}

.totals dl > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.35rem 0;
  font-size: 0.9rem;
}

.totals .grand {
  margin-top: 0.4rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--line);
  font-weight: 600;
}

.totals dt,
.totals dd {
  margin: 0;
}

.totals .order-form {
  margin: 0 0 0.6rem;
}

.totals .btn-block + .btn-block {
  margin-top: 0.6rem;
}

.totals .price-hint {
  margin-top: 0.75rem;
}

.order-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.order-item h2,
.order-ref {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.order-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.45rem;
}

.order-state {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--line-strong);
}

.order-state.state-sent,
.order-state.state-sale {
  background: #ecfdf3;
  border-color: #86efac;
  color: #14532d;
}

.order-state.state-cancel {
  color: var(--muted);
}

.order-item-meta,
.order-item-summary {
  margin: 0 0 0.65rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.order-item-summary {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text);
}

.order-kicker,
.order-detail h3 {
  margin: 0 0 0.4rem;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.order-detail h3 {
  margin: 1.25rem 0 0.6rem;
}

.order-meta {
  margin: 1rem 0 0;
}

.order-meta > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.35rem 0;
  font-size: 0.9rem;
}

.order-meta dt,
.order-meta dd {
  margin: 0;
}

.order-lines {
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
}

.order-lines li {
  padding: 0.85rem 0;
  border-top: 1px solid var(--line);
}

.order-lines pre {
  margin: 0 0 0.4rem;
  white-space: pre-wrap;
  font: inherit;
  font-size: 0.9rem;
}

.order-lines p {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.article-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin: -0.5rem 0 1.5rem;
  padding: 0.9rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
}

.article-bar-label {
  margin: 0;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.article-bar-name {
  margin: 0.15rem 0 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.article-switch select,
.article-model-form .field-select {
  min-height: 40px;
  font: inherit;
}

.article-model-form {
  margin-bottom: 0.25rem;
}

.article-model-form .group {
  margin-bottom: 1rem;
}

.custom-ral {
  display: none;
}

.swatch-multicolor {
  display: block;
  width: 100%;
  height: 64px;
  border: 0 !important;
  border-radius: 4px;
  box-shadow: none;
  background: conic-gradient(
    from 180deg,
    #c41e3a,
    #f5c400,
    #57a639,
    #0e518d,
    #6b3fa0,
    #c41e3a
  ) !important;
}

.ral-dialog {
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 1.1rem 1.2rem;
  width: min(320px, calc(100vw - 2rem));
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
}

.ral-dialog::backdrop {
  background: rgba(15, 23, 42, 0.35);
}

.ral-dialog label {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 0.45rem;
}

.ral-dialog input {
  width: 100%;
  box-sizing: border-box;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  font: inherit;
  padding: 0.35rem 0;
}

.ral-dialog input:focus {
  outline: none;
  border-bottom-color: var(--focus);
}

.ral-dialog .field-hint {
  margin-top: 0.45rem;
}

.ral-dialog-error {
  margin: 0.55rem 0 0;
  color: #7f1d1d;
  font-size: 0.82rem;
}

.ral-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
  margin-top: 1rem;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}

@media (max-width: 860px) {
  .page {
    width: min(100% - 1.5rem, 1100px);
    padding-top: 1.5rem;
  }

  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 2rem;
  }

  .preview-slot {
    min-height: 0;
  }

  .preview,
  .preview.is-pinned {
    position: relative;
    top: auto;
    left: auto;
    width: auto;
    height: auto;
    min-height: 380px;
    max-height: none;
    grid-template-rows: minmax(280px, 1fr) auto auto auto;
    overflow: hidden;
    z-index: auto;
  }

  .preview-stage {
    padding: 1.25rem 1.1rem;
  }

  .preview.is-showing-measures .preview-stage {
    padding: 1.25rem 1.1rem;
  }

  .plaque-measures .dim-label {
    font-size: 11px;
  }

  .header {
    margin-bottom: 1.5rem;
  }

  .cart-layout {
    grid-template-columns: 1fr;
  }

  .cart-item {
    grid-template-columns: 88px 1fr;
  }

  .cart-line-total {
    grid-column: 2;
    text-align: left;
  }
}

.pill.is-active span {
  color: var(--text);
  background: var(--surface);
  border-color: var(--line-strong);
}

a.pill {
  text-decoration: none;
  color: inherit;
}

.icon-library {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.35rem 0 0.6rem;
}

.icon-lib-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  width: 4.75rem;
  min-height: 4.75rem;
  padding: 0.4rem 0.3rem;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.7rem;
  line-height: 1.2;
  cursor: pointer;
}

.icon-lib-btn:hover,
.icon-lib-btn:focus-visible {
  border-color: var(--line-strong);
}

.icon-lib-btn.is-selected {
  border-color: var(--text);
}

.icon-lib-preview {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  color: var(--text);
}

.icon-lib-preview svg {
  width: 100%;
  height: 100%;
  display: block;
}

.icon-lib-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-align: center;
  word-break: break-word;
}

.icon-library-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

.icon-library-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
}

.icon-library-preview {
  width: 2.4rem;
  height: 2.4rem;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  color: var(--text);
}

.icon-library-preview svg {
  width: 100%;
  height: 100%;
  display: block;
}

.icon-library-meta {
  min-width: 0;
  flex: 1;
}

.icon-library-meta strong {
  display: block;
}

.empty-state-compact {
  padding: 1rem 0 1.25rem;
}

.icon-upload-form {
  margin-top: 0.75rem;
}


label.pill[hidden],
#font-group[hidden] {
  display: none !important;
}

.backend-shape-fonts {
  display: grid;
  gap: 0.85rem;
}

/* ---------------------------------------------------------------------------
   Section Texte : une carte légère par ligne, avec le réglage « Hauteur des
   lettres » en rangée secondaire sous le champ de saisie.
--------------------------------------------------------------------------- */
.line-fields {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.line-field {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.7rem 0.85rem 0.6rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.line-field[hidden] {
  display: none;
}

.line-field:focus-within {
  border-color: var(--line-strong);
  box-shadow: 0 1px 4px rgba(26, 29, 33, 0.06);
}

.line-field-label {
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Rangée unique : champ de texte à gauche, réglage de hauteur à droite.
   Sur écran étroit, le réglage passe proprement sous le champ. */
.suggest {
  position: relative;
}

.suggest-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  z-index: 20;
  margin: 0;
  padding: 0.25rem 0;
  list-style: none;
  max-height: 14rem;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(26, 29, 33, 0.1);
}

.suggest-list[hidden] {
  display: none;
}

.suggest-list li {
  margin: 0;
  padding: 0.45rem 0.75rem;
  font-size: 0.92rem;
  cursor: pointer;
}

.suggest-list li[aria-selected="true"],
.suggest-list li:hover {
  background: #f3f4f6;
}

.suggest-list .suggest-meta {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.line-field-row {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 1rem;
}

.line-street-suggest {
  position: relative;
  flex: 1 1 8.5rem;
  min-width: 8rem;
}

.line-street-suggest input[type="text"] {
  width: 100%;
}

.suggest-list-streets {
  top: calc(100% + 4px);
  bottom: auto;
}

.line-field input[type="text"] {
  flex: 1 1 8.5rem;
  min-width: 8rem;
  width: auto;
  border-bottom-color: transparent;
  padding: 0.35rem 0 0.3rem;
  font-size: 1.05rem;
}

.line-field input[type="text"]:focus {
  border-bottom-color: var(--focus);
}

.line-field.is-empty input[type="text"] {
  border-bottom-color: transparent;
}

/* Taille de police par ligne (hauteur des lettres en mm, vide = auto). */
.line-size-row {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.45rem;
}

.line-size-row[hidden] {
  display: none;
}

.line-size-row .line-size-label {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
}

.line-size-input {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
  border-bottom: 1px solid var(--line-strong);
  transition: border-color 0.2s ease;
}

.line-size-input:focus-within {
  border-bottom-color: var(--focus);
}

.line-size-input input[type="number"] {
  width: calc(3.4rem - 25px);
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  padding: 0.15rem 0;
  text-align: right;
  outline: none;
  appearance: textfield;
  -moz-appearance: textfield;
}

.line-size-input input[type="number"]::-webkit-outer-spin-button,
.line-size-input input[type="number"]::-webkit-inner-spin-button {
  appearance: none;
  margin: 0;
}

.line-size-input .line-size-unit {
  font-size: 0.72rem;
  color: var(--muted);
}

.line-size-row .line-size-auto {
  min-height: 28px;
  padding: 0.2rem 0.65rem;
  font-size: 0.75rem;
  border-radius: 999px;
}

@media (max-width: 540px) {
  .line-field {
    padding: 0.6rem 0.7rem 0.55rem;
  }
  /* Empilement : champ texte au-dessus, réglage de hauteur en dessous. */
  .line-field-row input[type="text"] {
    flex-basis: 100%;
  }
}

.size-debug {
  margin-top: 0.75rem;
  padding: 0.7rem 0.8rem;
  border: 1px dashed #c45c26;
  background: #fff6ee;
  border-radius: 8px;
}
/* Bloc debug sous l'aperçu : pleine largeur, liste sur plusieurs colonnes. */
.preview .size-debug {
  position: relative;
  z-index: 2;
  margin-top: 0;
}
.preview .size-debug-list {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  column-gap: 1.2rem;
}
.preview .size-debug-list > div {
  grid-template-columns: 8.5rem 1fr;
}
.preview .size-debug-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.preview #commune-group {
  position: relative;
  z-index: 3;
  width: 100%;
  max-width: 28rem;
  margin-top: 0.65rem;
}
.preview #commune-list {
  top: auto;
  bottom: calc(100% + 2px);
}
.size-debug-title {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #c45c26;
}
.size-debug-list {
  margin: 0;
  display: grid;
  gap: 0.2rem;
}
.size-debug-list > div {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 0.4rem;
  font-size: 0.78rem;
  line-height: 1.35;
}
.size-debug-list dt {
  margin: 0;
  color: var(--muted);
  font-weight: 500;
}
.size-debug-list dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.family-bar {
  margin: 0 0 1.75rem;
}

.family-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.family-option {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0;
  padding: 0.95rem 1rem;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
}

.family-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.family-option.is-selected {
  border-color: #1a1d21;
  box-shadow: inset 0 0 0 1px #1a1d21;
}

.family-label {
  font-weight: 650;
}

.family-hint {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.plaque[data-holes="hike"] .hole-tl,
.plaque[data-holes="hike"] .hole-tr {
  opacity: 1;
}

.plaque-arrow,
.plaque-hike-icon {
  position: absolute;
  z-index: 3;
  pointer-events: none;
}

.plaque.shape-sentier.has-hike-icon.point-left .plaque-text-layer {
  padding-left: calc(var(--px-per-mm) * 80px);
}

.plaque.shape-sentier.has-hike-icon.point-right .plaque-text-layer {
  padding-right: calc(var(--px-per-mm) * 80px);
}

.plaque-arrow {
  filter: grayscale(1) brightness(0.7);
}

.plaque.layout-rules.shape-sentier .line {
  position: relative;
}

.plaque-hike-sep {
  position: absolute;
  z-index: 2;
  background: #0a0a0a;
  pointer-events: none;
}

@media (max-width: 800px) {
  .family-options {
    grid-template-columns: 1fr;
  }
}
