/* DHD Livraison — local agent form */

:root {
  --orange: #f58220;
  --orange-dark: #d96e12;
  --ink: #1a1a1a;
  --muted: #5c5c5c;
  --line: #e4e4e4;
  --bg: #f3f4f6;
  --card: #ffffff;
  --danger: #c0392b;
  --radius: 10px;
  --font: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-ar: "Segoe UI", Tahoma, "Arial Unicode MS", sans-serif;
}

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

html {
  font-size: 16px;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(ellipse 80% 50% at 100% 0%, rgba(245, 130, 32, 0.12), transparent 55%),
    radial-gradient(ellipse 60% 40% at 0% 100%, rgba(245, 130, 32, 0.08), transparent 50%),
    var(--bg);
  min-height: 100vh;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--orange-dark);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ——— Screen chrome ——— */

.app {
  max-width: 980px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

/* L'historique a 8 colonnes : il respire mieux sur toute la largeur. */
.app-wide {
  max-width: 1220px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 0.85rem 1.1rem;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.topbar-logo {
  width: 90px;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
}

.brand-link {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.nav-link {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--ink);
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  text-decoration: none;
}

.nav-link:hover {
  border-color: var(--orange);
  color: var(--orange-dark);
  text-decoration: none;
}

/* Page ouverte : l'agent voit d'un coup d'œil où il se trouve. */
.nav-link.is-current,
.nav-link.is-current:hover {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
  cursor: default;
}

.topbar h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.topbar-sub {
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.topbar-phone {
  font-weight: 700;
  font-size: 1rem;
  color: var(--orange);
  white-space: nowrap;
  padding: 0.45rem 0.85rem;
  border: 2px solid var(--orange);
  border-radius: 999px;
}

.topbar-phone:hover {
  background: var(--orange);
  color: #fff;
  text-decoration: none;
}

.container {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem 1.35rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.panel-head {
  margin-bottom: 1rem;
  padding-bottom: 0.65rem;
  border-bottom: 2px solid var(--orange);
}

.panel-head.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.panel-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.panel-head small {
  font-weight: 500;
  color: var(--muted);
  margin-inline-start: 0.35rem;
  font-family: var(--font-ar);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.6rem;
  height: 1.6rem;
  padding: 0 0.45rem;
  border-radius: 999px;
  background: var(--orange);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem 1rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.9rem 1rem;
}

.parties {
  align-items: start;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}

.field:last-child {
  margin-bottom: 0;
}

.field span,
.field-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.field-label {
  cursor: pointer;
}

/* ——— Champ avec bouton « copier » ——— */

/* flex (et non block) : évite l'espace de ligne sous le champ,
   qui décalait les lignes face au panneau Expéditeur. */
.input-with-copy {
  position: relative;
  display: flex;
}

.input-with-copy > input {
  padding-right: 2.6rem;
}

.copy-btn {
  position: absolute;
  top: 50%;
  right: 0.35rem;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #8a8a8a;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.copy-btn .icon {
  width: 0.95rem;
  height: 0.95rem;
  stroke-width: 1.8;
}

.copy-btn:hover {
  background: #fff4e8;
  border-color: #f4d3ad;
  color: var(--orange-dark);
}

.copy-btn:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 1px;
}

.copy-btn.is-copied,
.copy-btn.is-copied:hover {
  background: #e9f7ed;
  border-color: #a8ddb8;
  color: #1c7a3e;
}

.copy-btn.is-failed,
.copy-btn.is-failed:hover {
  background: #fdeeec;
  border-color: #ecc0ba;
  color: var(--danger);
}

.field input,
.field select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid #d0d0d0;
  border-radius: 8px;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(245, 130, 32, 0.2);
}

.field input[readonly] {
  background: #f5f5f5;
  color: var(--ink);
  cursor: default;
}

/* Le chevron natif du select tomberait sous le bouton « copier » :
   on le redessine à gauche de celui-ci. (Règle placée après
   « .field select » pour que le fond raccourci ne l'efface pas.) */
.input-with-copy > select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 4.1rem;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235c5c5c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 2.55rem center;
  background-size: 0.9rem 0.9rem;
}

.field-static {
  display: inline-block;
  padding: 0.6rem 0.75rem;
  border: 1px solid #d0d0d0;
  border-radius: 8px;
  font-size: 0.95rem !important;
  font-weight: 600 !important;
  color: var(--ink) !important;
  background: #f5f5f5;
  text-transform: none !important;
  letter-spacing: normal !important;
  width: 100%;
}

.field-note {
  margin: -0.25rem 0 0.85rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.payment {
  margin: 0.5rem 0 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
}

.payment legend {
  padding: 0 0.35rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.payment label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 500;
  cursor: pointer;
}

.payment input {
  accent-color: var(--orange);
  width: 1.05rem;
  height: 1.05rem;
}

.payment label small {
  color: var(--muted);
  font-family: var(--font-ar);
  font-size: 0.85rem;
}

.delivery {
  margin-bottom: 0.9rem;
}

/* ——— Tarif automatique ——— */

.tarif-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin: -0.35rem 0 0.6rem;
  flex-wrap: wrap;
}

.tarif-hint {
  margin: 0;
  flex: 1 1 16rem;
}

.tarif-hint.warn {
  color: var(--danger);
  font-weight: 600;
}

.btn-recalc {
  flex: 0 0 auto;
  background: #fff7ef;
  color: var(--orange-dark);
  border: 1px solid #f0c9a0;
  border-radius: 6px;
  padding: 0.3rem 0.65rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-recalc:hover {
  background: #ffe8d1;
}

[hidden] {
  display: none !important;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0 0.5rem;
}

.btn {
  appearance: none;
  border: none;
  border-radius: 8px;
  padding: 0.7rem 1.25rem;
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.btn:active {
  transform: translateY(1px);
}

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

.btn-primary:hover {
  background: var(--orange-dark);
}

/* Bouton d'action réduit à son icône : même hauteur que ses voisins,
   l'intitulé complet reste dans title et aria-label. */
.btn-square {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  padding: 0.7rem 0;
}

.btn-square .icon {
  width: 1.15rem;
  height: 1.15rem;
}

.btn-secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid #cfcfcf;
}

.btn-secondary:hover {
  background: #f7f7f7;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  background: transparent;
  color: var(--muted);
  border: 1px dashed #cfcfcf;
  text-decoration: none;
}

.btn-ghost:hover {
  color: var(--orange-dark);
  border-color: var(--orange);
  text-decoration: none;
}

/* ——— Icônes SVG embarquées ——— */

.icon-sprite {
  display: none;
}

.icon {
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}

/* ——— Actions de ligne : boutons icônes compacts ——— */

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.3rem;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid #e2e2e2;
  border-radius: 7px;
  background: #fbfbfb;
  color: #5f5f5f;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.icon-btn .icon {
  width: 1.05rem;
  height: 1.05rem;
  stroke-width: 1.8;
}

.icon-btn:hover {
  text-decoration: none;
}

.icon-btn.is-edit:hover {
  background: #fff4e8;
  border-color: #f4d3ad;
  color: var(--orange-dark);
}

.icon-btn.is-copy:hover {
  background: #eef4fc;
  border-color: #c3d8ef;
  color: #1f5c9e;
}

.icon-btn.is-client-new:hover {
  background: #eaf7ee;
  border-color: #b3ddc0;
  color: #1c7a3e;
}

/* Expéditeur déjà inscrit : l'état est visible sans survol, pour que
   l'agent ne recrée pas une fiche qui existe. */
.icon-btn.is-client-known {
  background: #eaf7ee;
  border-color: #b3ddc0;
  color: #1c7a3e;
}

.icon-btn.is-client-known:hover {
  background: #d7f0e0;
  border-color: #8ccba2;
}

.icon-btn.is-delete:hover {
  background: #fdeeec;
  border-color: #ecc0ba;
  color: var(--danger);
}

.icon-btn:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 1px;
}

/* ——— Recherche dans l'historique ——— */

.history-tools {
  display: flex;
  align-items: center;
  gap: 0.6rem 1rem;
  flex-wrap: wrap;
  margin: -0.35rem 0 1rem;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 22rem;
  max-width: 30rem;
  padding: 0.15rem 0.6rem;
  border: 1px solid #d0d0d0;
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-field:focus-within {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(245, 130, 32, 0.2);
  color: var(--orange-dark);
}

.search-field .icon {
  font-size: 1.05rem;
}

.search-field input {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  padding: 0.45rem 0;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
}

.search-field input::-webkit-search-cancel-button {
  display: none;
}

.search-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
}

.search-clear:hover {
  background: #f0f0f0;
  color: var(--ink);
}

.search-summary {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ——— Avis de duplication ——— */

.dup-notice {
  margin: 0 0 1.1rem;
  padding: 0.7rem 0.95rem;
  border: 1px solid #bcd4ee;
  border-left: 4px solid #1f5c9e;
  border-radius: 8px;
  background: #f1f6fd;
  color: #1a3f68;
  font-size: 0.88rem;
  font-weight: 600;
}

/* Même bandeau, ton d'alerte : un client portant déjà ce numéro existe. */
.dup-notice.warn-notice {
  border-color: #f0cba0;
  border-left-color: var(--orange-dark);
  background: #fff7ef;
  color: #7a4210;
}

.dup-notice a {
  color: inherit;
  text-decoration: underline;
}

.hint {
  margin: 0;
  flex: 1 1 100%;
  font-size: 0.85rem;
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  min-width: 52rem;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.9rem;
}

/* Colonnes à largeur fixe ; le reste se partage l'espace disponible. */
.col-date { width: 6.2rem; }
.col-tel { width: 8.5rem; }
.col-total { width: 7rem; }
.col-pay { width: 6.5rem; }
/* 4 boutons de 2rem + 3 espaces de 0,3rem. */
.col-actions { width: 9.4rem; }
.col-cid { width: 6.4rem; }
.col-commune { width: 9rem; }
.col-wilaya { width: 10rem; }
/* Deux actions seulement (modifier / supprimer) : colonne plus étroite. */
.col-actions-2 { width: 5rem; }

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.7rem 0.55rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  /* Une ligne = une hauteur : le texte trop long est coupé, pas replié. */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table th {
  padding-top: 0.35rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #8a8a8a;
  font-weight: 700;
  border-bottom-color: #d8d8d8;
}

.data-table th.num,
.data-table .cell-total {
  text-align: right;
}

/* Respiration entre le montant et le mode de paiement. */
#history-table th:nth-child(7),
#history-table td:nth-child(7) {
  padding-left: 1.1rem;
}

.data-table tbody tr:hover {
  background: #fafafa;
}

.cell-date,
.cell-tel {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.cell-cid {
  font-weight: 700;
  color: var(--orange-dark);
  font-variant-numeric: tabular-nums;
}

.cell-name {
  font-weight: 600;
}

.cell-total {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.pay-tag {
  display: inline-block;
  max-width: 100%;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: #f2f2f3;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-table .actions-cell {
  padding-right: 0;
  overflow: visible;
}

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

.empty {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.empty.hidden,
.data-table.hidden {
  display: none;
}

.site-footer {
  margin-top: 2rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}

.site-footer .dot {
  margin: 0 0.35rem;
}

/* Print sheet hidden on screen */
.print-sheet {
  display: none;
}

/* ——— Responsive ——— */

@media (max-width: 720px) {
  .grid-2,
  .grid-3,
  .parties {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-logo {
    width: 96px;
  }

  .topbar-nav {
    width: 100%;
  }

  .search-field {
    max-width: none;
  }
}

/* ——— Print: landscape A4, fill left 50% fully ——— */

@media print {
  /* Marge nulle : prive Chrome de la place où il imprime le chemin du
     fichier et la date. Le retrait de 6 mm est repris par .print-sheet. */
  @page {
    size: A4 landscape;
    margin: 0;
  }

  html,
  body {
    background: #fff !important;
    color: #000;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
  }

  .no-print,
  .app {
    display: none !important;
  }

  .print-sheet {
    display: flex !important;
    flex-direction: row;
    align-items: stretch;
    width: 100%;
    height: 100%;
    padding: 6mm;
  }

  /* Two identical copies side by side (50% + 50%) */
  .sheet {
    width: 50%;
    max-width: 50%;
    flex: 0 0 50%;
    height: 198mm;
    min-height: 198mm;
    max-height: 198mm;
    box-sizing: border-box;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.35rem;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 10pt;
    color: #000;
    line-height: 1.35;
    padding: 0 4mm;
  }

  .sheet-original {
    border-right: 1px dashed #999;
    padding-left: 0;
  }

  .sheet-copy {
    border-right: none;
    padding-right: 0;
  }

  .sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-shrink: 0;
  }

  .sheet-brand {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
  }

  .sheet-mark {
    width: 58px;
    height: auto;
    background: transparent !important;
  }

  .sheet-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1;
  }

  .sheet-brand-dhd {
    font-size: 20pt;
    font-weight: 800;
    color: #f5821f;
    letter-spacing: 0.02em;
    font-style: italic;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .sheet-brand-liv {
    font-size: 8pt;
    font-weight: 600;
    color: #444;
    letter-spacing: 0.12em;
    margin-top: 2px;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .sheet-title-block {
    text-align: right;
    flex: 1;
  }

  .sheet-title-block h1 {
    margin: 0;
    font-size: 14pt;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
    letter-spacing: 0.02em;
  }

  .sheet-date {
    margin: 0.25rem 0 0;
    font-size: 10pt;
  }

  /* Nom de l'agent : réservé à l'exemplaire unique A5, que
     bordereau-simple.css affiche. */
  .sheet-agent {
    display: none;
    margin: 0.25rem 0 0;
    font-size: 10pt;
  }

  .sheet-bureau {
    margin: 0.35rem 0 0;
    font-size: 11pt;
    font-weight: 700;
  }

  .sheet-article {
    margin: 0;
    font-weight: 700;
    font-size: 10pt;
    border-bottom: 1px solid #000;
    padding-bottom: 0.3rem;
    flex-shrink: 0;
  }

  .sheet-parties {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 0.75rem;
    flex: 1 1 auto;
    align-content: start;
  }

  .sheet-col h2 {
    margin: 0 0 0.35rem;
    font-size: 11pt;
    font-weight: 700;
    border-bottom: 1px solid #333;
    padding-bottom: 0.15rem;
  }

  .sheet-col h2 .ar {
    font-weight: 600;
    font-size: 10pt;
    margin-inline-start: 0.25rem;
  }

  .sheet-col p {
    margin: 0.28rem 0;
    min-height: 1.15em;
    font-size: 9.5pt;
  }

  .sheet-parcel {
    border-top: 1px solid #000;
    padding-top: 0.4rem;
    flex-shrink: 0;
  }

  .sheet-parcel > p {
    margin: 0 0 0.3rem;
    font-size: 10pt;
  }

  .sheet-parcel-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1.2fr;
    gap: 0.3rem 0.5rem;
  }

  .sheet-parcel-row p {
    margin: 0.15rem 0;
    font-size: 9.5pt;
  }

  .sheet-sign-money {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 0.75rem;
    align-items: end;
    flex-shrink: 0;
  }

  .sheet-sign p {
    margin: 0 0 0.25rem;
    font-size: 9pt;
  }

  .sheet-sign .ar {
    font-weight: 600;
  }

  .sign-box {
    width: 100%;
    min-height: 58px;
    height: 58px;
    border: 1px solid #000;
    background: transparent;
  }

  .sheet-money {
    text-align: right;
  }

  .sheet-money p {
    margin: 0.3rem 0;
    font-size: 10.5pt;
  }

  .livraison-tag {
    font-size: 8.5pt;
    white-space: nowrap;
  }

  .sheet-payment {
    margin: 0;
    padding: 0.35rem 0;
    border-top: 1px solid #000;
    border-bottom: 1px solid #000;
    font-size: 10pt;
    flex-shrink: 0;
  }

  .pay-opt {
    margin-inline-start: 0.75rem;
  }

  .sheet-payment .box {
    font-size: 11pt;
    margin-inline-start: 0.15rem;
  }

  /* Les conditions commencent juste sous la ligne de paiement et occupent
     le bas de la feuille : le blanc qui restait entre les deux sert à
     agrandir le texte, plus lisible pour le client. */
  .sheet-terms {
    margin-top: 0;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-top: 0.1rem;
  }

  .sheet-terms h3 {
    margin: 0 0 0.25rem;
    font-size: 11pt;
    text-align: center;
    text-decoration: underline;
    text-underline-offset: 1px;
  }

  .terms-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem 0.6rem;
    font-size: 9pt;
    line-height: 1.2;
  }

  .terms-fr {
    margin: 0;
    padding-inline-start: 0.95rem;
  }

  .terms-fr li {
    margin-bottom: 0.18rem;
  }

  .terms-ar {
    font-family: var(--font-ar);
    text-align: right;
  }

  .terms-ar p {
    margin: 0 0 0.18rem;
  }

  .terms-important,
  .terms-note {
    font-weight: 700 !important;
  }

  .notice-label {
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 1px;
  }

  .terms-note {
    margin-top: 0.3rem !important;
  }

  /* ——— Fiche de renseignements client ———
     Même feuille A4 paysage que le bordereau : deux exemplaires
     identiques côte à côte, un pour DHD et un pour le client. */

  .fiche {
    justify-content: flex-start;
    gap: 0;
    font-size: 9pt;
    line-height: 1.3;
  }

  .fiche-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.4rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid #000;
    flex-shrink: 0;
  }

  .fiche .sheet-mark {
    width: 44px;
  }

  .fiche .sheet-brand-dhd {
    font-size: 15pt;
  }

  .fiche .sheet-brand-liv {
    font-size: 6.5pt;
  }

  .fiche-contact {
    flex: 1 1 auto;
    max-width: 63%;
    padding: 0.22rem 0.35rem;
    border: 1px solid #666;
    border-radius: 5px;
    font-size: 6pt;
    line-height: 1.2;
  }

  .fiche-contact p {
    margin: 0;
  }

  .fiche-contact-name {
    margin-bottom: 1px !important;
    font-size: 7pt;
    font-weight: 700;
    text-align: center;
  }

  .fiche-site {
    margin: 0.1rem 0 0;
    text-align: center;
    font-size: 7pt;
    color: #333;
  }

  .fiche-title {
    margin: 0.35rem 0 0;
    padding: 0.22rem;
    background: #e9e9e9;
    border-radius: 5px;
    text-align: center;
    font-size: 10.5pt;
    font-weight: 700;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .fiche-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.4rem;
    font-size: 9.5pt;
  }

  .fiche-meta p {
    margin: 0;
  }

  .fiche-id-box {
    display: inline-block;
    min-width: 26mm;
    margin-inline-start: 4px;
    padding: 2px 5px;
    border: 1px solid #000;
    border-radius: 3px;
    text-align: center;
    font-weight: 700;
  }

  .fiche-section {
    margin: 0.45rem 0 0.3rem;
    padding: 0.16rem 0.45rem;
    background: #e9e9e9;
    border-radius: 4px;
    font-size: 9pt;
    font-weight: 700;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .fiche-lines p {
    display: flex;
    align-items: baseline;
    gap: 0.3rem;
    margin: 0 0 0.2rem;
    font-size: 8.5pt;
  }

  .fiche-lines .lbl {
    flex: 0 0 auto;
    font-weight: 600;
  }

  /* Ligne pointillée : la valeur imprimée s'y pose, et la fiche reste
     remplissable à la main quand un champ facultatif est vide.
     Le texte passe à la ligne plutôt que d'être coupé : une adresse
     tronquée sur un document signé ne serait pas acceptable. */
  .fiche-lines .val {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 1em;
    padding-left: 2px;
    border-bottom: 1px dotted #555;
    overflow-wrap: anywhere;
  }

  .fiche-signs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
    margin-top: 0.45rem;
  }

  .fiche-sign {
    text-align: center;
  }

  .fiche-sign-head {
    margin: 0 0 2px;
    padding: 0.12rem 0.3rem;
    background: #e9e9e9;
    border-radius: 4px;
    font-size: 8.5pt;
    font-weight: 700;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .fiche-sign-sub {
    margin: 0 0 2px;
    font-size: 7pt;
    text-decoration: underline;
    text-underline-offset: 1px;
  }

  .fiche-sign .sign-box {
    height: 12mm;
    min-height: 12mm;
    border-radius: 4px;
  }

  .fiche-terms {
    margin-top: 0.4rem;
    padding: 0.3rem 0.35rem;
    border: 1px solid #999;
    border-radius: 5px;
    font-size: 5.8pt;
    line-height: 1.25;
    text-align: justify;
  }

  .fiche-terms p {
    margin: 0;
  }

  .fiche-terms-ar {
    margin-top: 0.22rem !important;
    padding-top: 0.22rem;
    border-top: 1px solid #ccc;
    font-family: var(--font-ar);
    font-size: 6.2pt;
    text-align: right;
  }

  /* Avis de garde : encadré plus marqué que l'engagement, pour qu'il
     se remarque sur une demi-page A5. */
  .fiche-notice {
    margin-top: 0.3rem;
    padding: 0.28rem 0.35rem;
    border: 1.2px solid #000;
    border-radius: 5px;
    font-size: 5.8pt;
    line-height: 1.25;
    text-align: justify;
  }

  .fiche-notice p {
    margin: 0;
  }

  .fiche-notice-head {
    margin-bottom: 0.18rem !important;
    padding-bottom: 0.14rem;
    border-bottom: 1px solid #000;
    font-size: 6.8pt;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.02em;
  }

  .fiche-notice-ar {
    margin-top: 0.22rem !important;
    padding-top: 0.22rem;
    border-top: 1px solid #ccc;
    font-family: var(--font-ar);
    font-size: 6.2pt;
    text-align: right;
  }
}
