
.telegram-hero{
  background:radial-gradient(circle at 50% 0%,rgba(198,146,67,.18),transparent 36%);
}

/* Page */
.telegram-page-v12{
  width:min(1480px, calc(100% - 30px));
  margin:0 auto;
  padding:28px 0 58px;
}
.telegram-board{
  display:grid;
  grid-template-columns:minmax(0,1fr) 230px;
  gap:24px;
  align-items:start;
}

/* Feuille */
.telegram-paper-panel{min-width:0;}
.telegram-paper-sheet{
  position:relative;
  overflow:hidden;
  background:
    linear-gradient(180deg, rgba(234,223,190,.97) 0%, rgba(227,212,171,.97) 100%),
    radial-gradient(circle at 14% 12%, rgba(112,75,31,.10), transparent 28%),
    radial-gradient(circle at 82% 18%, rgba(91,57,24,.08), transparent 26%);
  border:1px solid rgba(85,58,28,.45);
  box-shadow:0 22px 70px rgba(0,0,0,.34);
}
.telegram-paper-sheet::before{
  content:"";
  position:absolute;
  inset:0;
  background-image:url("../img/telegramme-olt-logo.webp");
  background-repeat:no-repeat;
  background-position:center center;
  background-size:min(58%, 520px);
  opacity:.105;
  pointer-events:none;
  filter:grayscale(100%) sepia(45%) saturate(70%) brightness(.72);
}
.telegram-paper-inner{
  position:relative;
  z-index:1;
  min-height:620px;
  padding:54px 62px 30px;
}
.telegram-paper-inner::before,
.telegram-paper-inner::after{
  content:"";
  position:absolute;
  top:0;
  bottom:0;
  width:1px;
  border-left:1px dashed rgba(56,37,18,.42);
  pointer-events:none;
}
.telegram-paper-inner::before{left:130px;}
.telegram-paper-inner::after{right:30px;}

/* Ligne des champs */
.telegram-top-row{
  display:grid;
  grid-template-columns:minmax(470px,1.55fr) minmax(275px,1fr) minmax(315px,1fr);
  gap:30px;
  align-items:end;
  margin:18px 0 34px;
}
.telegram-meta-field{
  display:grid;
  align-items:end;
  gap:12px;
  min-width:0;
}
.telegram-meta-field.wide{grid-template-columns:210px minmax(0,1fr);}
.telegram-meta-field.medium{grid-template-columns:82px minmax(0,1fr);}
.telegram-meta-field.city-field{grid-template-columns:132px minmax(0,1fr);}

.telegram-meta-field label{
  display:block;
  min-width:0;
  font-family:"Courier New", Courier, monospace;
  font-weight:900;
  color:#2e1f12;
  font-size:20px;
  line-height:1.05;
  white-space:nowrap;
}
.telegram-meta-field.city-field label{
  max-width:132px;
}

.telegram-meta-field input,
.telegram-meta-field select,
.telegram-print-value{
  width:100%;
  min-width:0;
  display:block;
  background:transparent;
  border:none;
  border-bottom:1px dashed rgba(56,37,18,.50);
  padding:4px 4px 7px;
  border-radius:0;
  color:#5e5344;
  font-family:"Courier New", Courier, monospace;
  font-size:20px;
  line-height:1.2;
  outline:none;
  box-shadow:none;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.telegram-meta-field input:focus,
.telegram-meta-field select:focus{
  border-bottom-color:#2e1f12;
}
.telegram-print-value{display:none;}

/* Boutons de mise en forme */
.telegram-toolbar-v12{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin:0 0 18px 76px;
}
.telegram-toolbar-v12 button{
  background:#f4efe2;
  border:1px solid rgba(76,54,29,.5);
  color:#2d1e11;
  border-radius:5px;
  padding:10px 18px;
  font-family:Georgia,"Times New Roman",serif;
  font-size:16px;
  cursor:pointer;
}
.telegram-toolbar-v12 button:hover{background:#fff8ea;}

/* Zone d’écriture */
.telegram-editor-v12{
  min-height:360px;
  margin-left:76px;
  padding:20px 14px;
  background:transparent;
  border:none;
  color:#5d5348;
  font-family:"Courier New", Courier, monospace;
  font-size:22px;
  line-height:1.68;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
  outline:none;
}
.telegram-editor-v12:empty:before{
  content:attr(data-placeholder);
  color:rgba(63,53,42,.75);
}
.telegram-editor-v12 ul{margin:8px 0 8px 24px;}

/* Bas de feuille */
.telegram-bottom-row{
  display:flex;
  justify-content:space-between;
  gap:18px;
  margin-top:30px;
  padding-top:14px;
  border-top:1px dashed rgba(56,37,18,.34);
  color:rgba(46,31,18,.78);
  font-family:"Courier New", Courier, monospace;
  font-size:13px;
  text-transform:uppercase;
}

/* Panneau d’actions */
.telegram-actions-panel{
  position:sticky;
  top:96px;
  display:flex;
  flex-direction:column;
  gap:12px;
}
.tele-btn{
  width:100%;
  background:#f5ecda;
  color:#3c2614;
  border:1px solid rgba(255,243,214,.85);
  border-radius:5px;
  padding:13px 14px;
  font-family:Georgia,"Times New Roman",serif;
  font-size:15px;
  cursor:pointer;
  box-shadow:0 3px 12px rgba(0,0,0,.17);
}
.tele-btn:hover{transform:translateY(-1px); background:#fff5df;}
.telegram-side-note{
  margin-top:10px;
  background:rgba(12,7,4,.30);
  border:1px solid rgba(198,146,67,.34);
  border-radius:14px;
  padding:15px;
  color:var(--paper);
  line-height:1.45;
  font-size:15px;
}
.telegram-side-note strong{color:var(--gold2);}
.telegram-side-note p{margin:8px 0 0;}

/* Responsive */
@media(max-width:1100px){
  .telegram-board{grid-template-columns:1fr;}
  .telegram-actions-panel{
    position:static;
    display:grid;
    grid-template-columns:1fr 1fr 1fr;
  }
  .telegram-side-note{grid-column:1 / -1;}
}
@media(max-width:860px){
  .telegram-page-v12{width:min(100% - 16px,1480px);padding-top:20px;}
  .telegram-paper-inner{padding:22px 14px 18px;}
  .telegram-paper-inner::before,.telegram-paper-inner::after{display:none;}
  .telegram-paper-sheet::before{background-size:82%;opacity:.08;}
  .telegram-top-row{
    grid-template-columns:1fr;
    gap:15px;
    margin:10px 0 20px;
  }
  .telegram-meta-field.wide,
  .telegram-meta-field.medium,
  .telegram-meta-field.city-field{
    grid-template-columns:1fr;
    gap:5px;
  }
  .telegram-meta-field label{font-size:17px;}
  .telegram-meta-field input,
  .telegram-meta-field select{font-size:17px;}
  .telegram-toolbar-v12{margin-left:0;}
  .telegram-toolbar-v12 button{flex:1 1 calc(50% - 8px);}
  .telegram-editor-v12{
    margin-left:0;
    min-height:330px;
    padding:14px 4px;
    font-size:18px;
  }
  .telegram-bottom-row{
    display:block;
    font-size:11px;
  }
  .telegram-bottom-row span{display:block;margin-top:6px;}
  .telegram-actions-panel{grid-template-columns:1fr;}
}

/* Impression / PDF : la feuille garde la même structure que l’écran */
@page{
  size:A4 landscape;
  margin:0;
}
@media print{
  html, body{
    width:297mm;
    height:210mm;
    margin:0 !important;
    padding:0 !important;
    background:#fff !important;
    overflow:hidden !important;
  }

  .topbar,
  .page-header,
  .telegram-actions-panel,
  .footer,
  .telegram-toolbar-v12{
    display:none !important;
  }

  .telegram-page-v12{
    width:297mm !important;
    height:210mm !important;
    margin:0 !important;
    padding:0 !important;
  }
  .telegram-board{
    display:block !important;
    width:297mm !important;
    height:210mm !important;
  }
  .telegram-paper-panel{
    width:297mm !important;
    height:210mm !important;
  }
  .telegram-paper-sheet{
    width:297mm !important;
    height:210mm !important;
    border:none !important;
    box-shadow:none !important;
    overflow:hidden !important;
  }
  .telegram-paper-sheet::before{
    background-size:128mm auto !important;
    opacity:.075 !important;
  }
  .telegram-paper-inner{
    box-sizing:border-box !important;
    width:297mm !important;
    height:210mm !important;
    min-height:0 !important;
    padding:24mm 18mm 12mm 18mm !important;
  }
  .telegram-paper-inner::before{left:28mm !important;}
  .telegram-paper-inner::after{right:7mm !important;}

  .telegram-top-row{
    display:grid !important;
    grid-template-columns:126mm 66mm 63mm !important;
    gap:8mm !important;
    align-items:end !important;
    margin:6mm 0 12mm !important;
  }
  .telegram-meta-field{
    display:grid !important;
    align-items:end !important;
    gap:3mm !important;
    min-width:0 !important;
  }
  .telegram-meta-field.wide{grid-template-columns:48mm minmax(0,1fr) !important;}
  .telegram-meta-field.medium{grid-template-columns:17mm minmax(0,1fr) !important;}
  .telegram-meta-field.city-field{grid-template-columns:28mm minmax(0,1fr) !important;}

  .telegram-meta-field label{
    font-size:5mm !important;
    line-height:1.05 !important;
    min-width:0 !important;
    white-space:nowrap !important;
  }
  .telegram-meta-field input,
  .telegram-meta-field select{
    display:none !important;
  }
  .telegram-print-value{
    display:block !important;
    box-sizing:border-box !important;
    width:100% !important;
    min-width:0 !important;
    font-size:4.7mm !important;
    line-height:1.15 !important;
    padding:0 1mm 2mm 0 !important;
    border-bottom:0.25mm solid rgba(56,37,18,.28) !important;
    white-space:nowrap !important;
    overflow:hidden !important;
    text-overflow:ellipsis !important;
  }

  .telegram-editor-v12{
    box-sizing:border-box !important;
    margin-left:16mm !important;
    min-height:115mm !important;
    padding:0 0 0 0 !important;
    font-size:5mm !important;
    line-height:1.45 !important;
  }
  .telegram-bottom-row{
    position:absolute !important;
    left:18mm !important;
    right:18mm !important;
    bottom:11mm !important;
    margin:0 !important;
    padding:0 !important;
    border-top:none !important;
    font-size:3.1mm !important;
  }
}


/* =========================================================
   V18 — FIX FINAL IMPRESSION/PDF
   On n'utilise plus la grille pour les champs en impression :
   positions fixes en mm = plus de décalage navigateur.
   ========================================================= */
@media print{
  .telegram-paper-inner{
    position:relative !important;
    box-sizing:border-box !important;
    padding:0 !important;
  }

  .telegram-top-row{
    position:absolute !important;
    top:25mm !important;
    left:18mm !important;
    right:18mm !important;
    height:24mm !important;
    display:block !important;
    margin:0 !important;
    padding:0 !important;
  }

  .telegram-meta-field{
    position:absolute !important;
    display:block !important;
    margin:0 !important;
    padding:0 !important;
    height:16mm !important;
  }

  .telegram-meta-field.wide{
    left:0 !important;
    top:0 !important;
    width:112mm !important;
  }

  .telegram-meta-field.medium{
    left:126mm !important;
    top:0 !important;
    width:62mm !important;
  }

  .telegram-meta-field.city-field{
    left:202mm !important;
    top:0 !important;
    width:58mm !important;
  }

  .telegram-meta-field label{
    position:absolute !important;
    left:0 !important;
    top:0 !important;
    display:block !important;
    margin:0 !important;
    padding:0 !important;
    width:auto !important;
    max-width:none !important;
    font-size:5mm !important;
    line-height:5.5mm !important;
    white-space:nowrap !important;
    overflow:visible !important;
  }

  .telegram-meta-field.wide .telegram-print-value{
    position:absolute !important;
    left:42mm !important;
    top:-0.4mm !important;
    width:68mm !important;
  }

  .telegram-meta-field.medium .telegram-print-value{
    position:absolute !important;
    left:18mm !important;
    top:-0.4mm !important;
    width:43mm !important;
  }

  .telegram-meta-field.city-field label{
    line-height:5.2mm !important;
    width:28mm !important;
    white-space:normal !important;
  }

  .telegram-meta-field.city-field .telegram-print-value{
    position:absolute !important;
    left:32mm !important;
    top:3mm !important;
    width:25mm !important;
  }

  .telegram-print-value{
    display:block !important;
    box-sizing:border-box !important;
    min-width:0 !important;
    height:7mm !important;
    font-size:4.6mm !important;
    line-height:5.4mm !important;
    padding:0 0 1.2mm 0 !important;
    border-bottom:0.25mm solid rgba(56,37,18,.28) !important;
    white-space:nowrap !important;
    overflow:hidden !important;
    text-overflow:ellipsis !important;
  }

  .telegram-editor-v12{
    position:absolute !important;
    left:34mm !important;
    top:62mm !important;
    right:18mm !important;
    min-height:0 !important;
    height:116mm !important;
    margin:0 !important;
    padding:0 !important;
    font-size:5mm !important;
    line-height:1.45 !important;
  }

  .telegram-bottom-row{
    position:absolute !important;
    left:18mm !important;
    right:18mm !important;
    bottom:11mm !important;
  }
}
