/* ========= Base ========= */
:root{
  font-size: 10px;
}

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

.container{
  max-width: clamp(1100px, 98vw, 1680px);
  margin: 0 auto;
  padding: 1rem;
}

.topbar.purchases-topbar{
  display:flex; justify-content:center; align-items:center;
  padding:2.4rem 1.2rem 1rem;
}
.topbar.purchases-topbar h1{ margin:0; }

/* ========= Toolbar ========= */
.toolbar{ display:flex; gap:1rem; flex-wrap:wrap; align-items:center; margin:.75rem 0; }
.toolbar .search{ flex:1; min-width:260px; }
.toolbar input[type="search"],
.toolbar select{
  width:100%; padding:.65rem .8rem; border-radius:14px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.06); color:#fff;
}
.toolbar .filters{ display:flex; gap:.6rem; align-items:center; }

/* ============ TABLE ============ */

/* Zone scrollable (pour garder les titres visibles) */
.table-wrap{
  position: relative;
  max-height: calc(100vh - 260px);  /* ajuste selon ta page */
  overflow: auto;
}

/* Table pleine largeur, sans décalage */
.table{
  width: 100%;
  min-width: 1000px;            /* garde une largeur mini si nécessaire */
  border-collapse: collapse;
  font-size:1.40rem;
}

.table th, .table td{
  padding:.45rem;
  vertical-align:middle;
  text-align:center;
}

/* En-tête sticky */
.table thead th{
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(14,18,28);
}
.table thead th::after{
  content:"";
  position:absolute; left:0; right:0; bottom:-1px; height:0px;
  background: rgba(255,255,255);
}

.table td.num, .table th.num{
  text-align:center;
  white-space:nowrap;
}

/* Largeurs utiles */
.table th:nth-child(8),  .table td:nth-child(8){  min-width:11.5rem; } /* Prix   */
.table th:nth-child(10), .table td:nth-child(10){ min-width:10.5rem; } /* Frais  */
.table th:nth-child(11), .table td:nth-child(11){ min-width:11rem;  }  /* Net    */

/* Colonne Actions : grille compacte */
.table th.actions,
.table td.actions{
  width:160px; min-width:160px; max-width:160px;
  white-space:normal; text-align:center; box-sizing:border-box;
}
.table td.actions{
  display:grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 1fr; gap:.35rem; padding:.35rem;
}
.table td .btn.tiny{ padding:.12rem .42rem; font-size:1.2rem; }

/* Colonne Fournisseur : texte + bouton, avec coupure possible même sur les longs codes */
.table tbody td:nth-child(2){
  position: relative;
  padding-right: .5rem;
  white-space: normal;          /* autorise la multilignes */
  word-break: break-all;        /* casse les très longs mots/codes */
  overflow-wrap: anywhere;      /* version plus douce pour le reste */
}

.table tbody td:nth-child(2) .show-contact{
  position: static;
  display: inline-block;
  margin-left: .6rem;
  vertical-align: middle;
}

/* Ligne détails contact */
.table tr.row-contact[hidden]{ display:none; }
.table tr.row-contact td{
  background:linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.035));
  border-top:1px dashed rgba(255,255,255,.15);
  border-bottom:1px dashed rgba(255,255,255,.12);
  border-left:3px solid rgba(255, 255, 255, 0.45);
  padding:.55rem .9rem; font-size:1.45rem; text-align:left;
}

/* ========= Palette douce par colonne (lignes uniquement) ========= */
.table tbody td:nth-child(1){  background-color: rgba(99,102,241,.10); }
.table tbody td:nth-child(2){  background-color: rgba(56,189,248,.10); }
.table tbody td:nth-child(3){  background-color: rgba(139,92,246,.10); }
.table tbody td:nth-child(4){  background-color: rgba(20,184,166,.10); }
.table tbody td:nth-child(5){  background-color: rgba(249,115,22,.10); }
.table tbody td:nth-child(6){  background-color: rgba(244,114,182,.10); }
.table tbody td:nth-child(7){  background-color: rgba(148,163,184,.10); }
.table tbody td:nth-child(8){  background-color: rgba(59,130,246,.10); }
.table tbody td:nth-child(9){  background-color: rgba(236,72,153,.10); }
.table tbody td:nth-child(10){ background-color: rgba(234,179,8,.12); }
.table tbody td:nth-child(11){ background-color: rgba(34,197,94,.12); font-weight:600; }

/* ========= Dialog ========= */
dialog{
  padding:0; border:1px solid rgba(255,255,255,.12);
  border-radius:22px;
  background:linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.04));
  color:#fff;
  box-shadow:0 30px 90px rgba(0,0,0,.55);
  min-width: min(920px, 95vw);
}
dialog::backdrop{ background:rgba(7,10,20,.65); backdrop-filter:blur(4px); }
dialog .panel{ background:transparent; padding:2rem 2.2rem; }
dialog h3{ margin:0 0 1.5rem; font-size:2rem; }
dialog .grid{ display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:1.2rem; margin:.8rem 0 1.5rem; }
dialog label{ display:flex; flex-direction:column; gap:.5rem; font-size:1.3rem; line-height:1.4; }
dialog input, dialog select{
  background:rgba(255,255,255,.06); color:#fff;
  border:1px solid rgba(255,255,255,.12);
  border-radius:14px; padding:.7rem .85rem; font-size:1.3rem;
  transition: all 0.2s ease;
}
dialog input:focus, dialog select:focus{
  background:rgba(255,255,255,.1);
  border-color:rgba(99,179,237,.5);
  box-shadow: 0 0 0 3px rgba(99,179,237,.1);
}
dialog input::placeholder{ color:rgba(255,255,255,.6); }
dialog .row{ display:flex; gap:.8rem; justify-content:flex-end; margin-top:2rem; }

/* ========= Appel d'offre Toggle Switch ========= */
.quote-request-toggle {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  grid-column: 1 / -1;
  margin-bottom: 1.5rem;
  padding: 1.4rem 1.8rem;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(99,179,237,.12), rgba(99,179,237,.06));
  border: 1.5px solid rgba(99,179,237,.25);
  cursor: pointer;
  transition: all 0.3s ease;
}

.quote-request-toggle:hover {
  background: linear-gradient(135deg, rgba(99,179,237,.18), rgba(99,179,237,.12));
  border-color: rgba(99,179,237,.4);
}

.quote-request-toggle input {
  display: none;
}

.quote-request-toggle .toggle-switch {
  position: relative;
  width: 56px;
  height: 34px;
  background: rgba(255,255,255,.1);
  border-radius: 999px;
  border: 1.5px solid rgba(255,255,255,.2);
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.quote-request-toggle .toggle-ball {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  background: #fff;
  border-radius: 50%;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 3px 10px rgba(0,0,0,.3);
}

.quote-request-toggle input:checked ~ .toggle-switch {
  background: linear-gradient(135deg, #63b3ed, #4a9fd8);
  border-color: rgba(99,179,237,.6);
  box-shadow: 0 0 16px rgba(99,179,237,.35);
}

.quote-request-toggle input:checked ~ .toggle-switch .toggle-ball {
  left: 27px;
}

.quote-request-toggle span {
  font-size: 1.5rem;
  font-weight: 600;
  color: #fff;
  user-select: none;
}

/* ========= Boutons du formulaire article ========= */
#dlg-item .row .btn {
  padding: 0.9rem 2.2rem;
  font-size: 1.4rem;
  border-radius: 16px;
  transition: all 0.2s ease;
}

#dlg-item .row .btn:hover {
  transform: translateY(-2px);
}

#dlg-item .row #submit-item {
  padding: 1rem 2.8rem;
}

/* ========= Tags refacturation ========= */
.rebill-tags{
  display:flex; flex-wrap:wrap; gap:.5rem; padding:.4rem;
  border-radius:14px; border:1px solid rgba(255,255,255,.12);
  background:linear-gradient(180deg, rgba(255,255,255,.03), rgba(0,0,0,.06));
}
.rebill-tags .tag{ position:relative; display:inline-flex; align-items:center; cursor:pointer; }
.rebill-tags .tag input{ position:absolute; opacity:0; pointer-events:none; }
.rebill-tags .tag span{
  padding:.45rem .7rem; border-radius:999px; font-size:1.25rem;
  color:#dbe6ff; border:1px solid rgba(255,255,255,.14);
  background:rgba(255,255,255,.04); transition:all .18s ease;
}
.rebill-tags .tag:hover span{ transform:translateY(-1px); border-color:rgba(255,255,255,.22); }
.rebill-tags .tag input:checked + span{
  background:#2f6fff; color:#fff; border-color:transparent;
  box-shadow:0 6px 16px rgba(47,111,255,.35), inset 0 0 0 1px rgba(255,255,255,.1);
}

/* ===== UI Frais de livraison ===== */
.fee-control{ display:flex; flex-direction:column; gap:.8rem; margin-top:.4rem; }
.segmented{
  display:inline-flex; gap:.5rem; padding:.35rem; border-radius:14px;
  border:1px solid rgba(255,255,255,.12);
  background:linear-gradient(180deg, rgba(255,255,255,.03), rgba(0,0,0,.06));
}
.segmented .seg{
  position:relative; display:flex; flex-direction:column; align-items:center;
  gap:.2rem; padding:.5rem .9rem; border-radius:999px; cursor:pointer;
  color:#dbe6ff; border:1px solid rgba(255,255,255,.14);
  background:rgba(255,255,255,.04); transition:all .18s ease;
  font-size:1.35rem;
}
.segmented .seg:hover{ transform:translateY(-1px); border-color:rgba(255,255,255,.22); }
.segmented .seg input{ position:absolute; opacity:0; pointer-events:none; }
.segmented .seg small{ opacity:.75; font-size:1.1rem; line-height:1; }
.segmented .seg input:checked + span,
.segmented .seg input:checked ~ small{ color:#fff; }
.segmented .seg input:checked ~ *{
  background:#2f6fff; color:#fff; border-color:transparent;
  box-shadow:0 6px 16px rgba(47,111,255,.35), inset 0 0 0 1px rgba(255,255,255,.1);
}

/* Champ % avec suffixe */
.fee-control label.inline{ display:flex; flex-direction:column; gap:.35rem; }
.input-suffix{ position:relative; display:flex; align-items:center; }
.input-suffix input{ width:220px; padding-right:2.2rem; }
.input-suffix .suffix{ position:absolute; right:.6rem; pointer-events:none; opacity:.8; }

.hint{ opacity:.8; font-size:1.2rem; }
.badge{ display:inline-block; padding:.25rem .6rem; border-radius:999px; font-size:1.2rem;
  background:rgba(255,255,255,.08); color:#fff; border:1px solid rgba(255,255,255,.12); }
.badge.warn{ background:rgba(234,179,8,.15); border-color:rgba(234,179,8,.35); color:#ffecb3; }

/* ===== Autocomplete ===== */
.ac-menu{
  position:absolute; z-index:9999;
  margin:0; padding:.25rem;
  background:rgba(18,22,32,.98);
  border:1px solid rgba(255,255,255,.08);
  border-radius:12px; box-shadow:0 10px 28px rgba(0,0,0,.45);
  max-height:260px; overflow:auto; backdrop-filter: blur(4px);
}
.ac-item{
  display:grid; grid-template-columns: 1fr auto; gap:.6rem; align-items:center;
  padding:.55rem .7rem; border-radius:10px; cursor:pointer;
}
.ac-item:hover, .ac-item.is-active{
  background:linear-gradient(180deg, rgba(99,179,237,.15), rgba(99,179,237,.10));
  box-shadow: inset 0 0 0 1px rgba(99,179,237,.25);
}
.ac-left{ min-width:0; }
.ac-label{ font-size:1.35rem; color:#fff; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ac-sub{ font-size:1.15rem; opacity:.75; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ac-right{ display:flex; gap:.35rem; align-items:center; }
.chip{
  display:inline-block; padding:.2rem .55rem; border-radius:999px;
  font-size:1.1rem; line-height:1; white-space:nowrap;
  background:rgba(255,255,255,.08); color:#dfe7ff;
  border:1px solid rgba(255,255,255,.12);
}
.chip.muted{ opacity:.8; }
.chip.num{ font-variant-numeric: tabular-nums; }
.ac-menu mark{ background:transparent; color:#9cd1ff; text-decoration:underline dotted; }

/* ========= Responsive ========= */
@media (max-width:1024px){
  .container{ padding:.75rem; }
  .table th.actions, .table td.actions{ width:150px; min-width:150px; max-width:150px; }
}

@media (max-width:768px){
  .toolbar{ flex-direction:column; align-items:stretch; gap:.6rem; }
  .toolbar .filters{ width:100%; }
  /* masquer quelques colonnes pour lisibilité */
  .table th:nth-child(3), .table td:nth-child(3){ display:none; } /* Réf */
  .table th:nth-child(6), .table td:nth-child(6){ display:none; } /* Affectation */
  .table th:nth-child(7), .table td:nth-child(7){ display:none; } /* Refacturation */
  .table th:nth-child(9), .table td:nth-child(9){ display:none; } /* Remise */
  .table th:nth-child(10), .table td:nth-child(10){ display:none; } /* Frais liv. */
}

/* ==== Pleine largeur (viewport) pour la page achats ==== */
main.container{
  max-width: 100vw;      /* plus de clamp 1680px */
  padding-left: 0;
  padding-right: 0;
}

/* le panneau et le wrapper prennent toute la largeur */
.panel{ border-radius: 18px; margin: 0 1rem; } /* garde juste un petit air sur les bords */
.table-wrap{
  width: 100%;
  overflow: auto;        /* scroll vertical interne si besoin */
}

/* la table occupe 100% (plus de min-width qui rétrécit) */
.table{
  width: 100%;
  min-width: 0;
  table-layout: fixed;   /* force l'étirement des colonnes */
}

/* quelques colonnes gardent une largeur mini pour rester lisibles */
.table th:nth-child(8),  .table td:nth-child(8){  min-width: 11rem; } /* Prix   */
.table th:nth-child(10), .table td:nth-child(10){ min-width: 10rem; } /* Frais  */
.table th:nth-child(11), .table td:nth-child(11){ min-width: 11rem; } /* Net    */
.table th.actions, .table td.actions{ width: 16rem; min-width: 16rem; }

/* l'en-tête sticky reste en place */
.table thead th{
  position: sticky; top: 0; z-index: 5;
  background: rgba(14,18,28);
}

/* ==== Pleine largeur sans marges (full-bleed) ==== */
html, body { margin: 0; }

/* la page "achats" prend toute la largeur */
main.container,
.container {
  max-width: 100vw;
  padding-left: 0;
  padding-right: 0;
}

/* le panneau ne rajoute plus d'air sur les côtés */
.panel {
  margin: 0;         /* enlève le 0 1rem précédent */
  border-radius: 0;  /* optionnel : bord à bord */
}

/* le wrapper et la table s’étirent à 100% */
.table-wrap {
  width: 100vw;
  max-width: 100vw;
  padding: 0;
  margin: 0;
  overflow: auto;                 /* conserve ton scroll vertical interne */
}

.table {
  width: 100%;
  min-width: 0;                   /* plus de largeur mini qui squeeze */
  table-layout: fixed;            /* répartit mieux les colonnes */
}

/* garde l’entête collant */
.table thead th {
  position: sticky; top: 0; z-index: 5;
  background: rgba(14,18,28);
}

/* ==== Étendre le tableau bord à bord et l'aligner à GAUCHE ==== */
main.container,
.container{
  max-width: 100vw;
  padding-left: 0;
  padding-right: 0;
}

.panel{ margin: 0; }

/* Technique full-bleed : on sort le wrapper du centrage du container
   et on l’aligne sur le bord GAUCHE du viewport */
.table-wrap{
  width: 100vw;                       /* prend toute la largeur écran */
  margin-left: calc(50% - 50vw);      /* décale vers la GAUCHE */
  margin-right: calc(50% - 50vw);     /* (optionnel) équilibre à droite */
  padding: 0;
  overflow: auto;                      /* conserve le scroll interne */
}

/* La table, elle, fait 100% du wrapper (donc 100vw) */
.table{
  width: 100%;
  min-width: 0;                        /* pas de largeur mini qui squeeze */
  table-layout: fixed;
}

/* L'entête reste collante */
.table thead th{
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(14,18,28);
}

/* ===== MODALE FOURNISSEUR — forcer une taille plus grande ===== */
dialog#dlg-supplier .panel.form{
  /* largeur cible bien visible */
  width: min(720px, 95vw) !important;
  min-width: min(720px, 95vw) !important;
  padding: 1.6rem 1.8rem !important;
}

dialog#dlg-supplier h3{
  font-size: 2rem !important;
  margin-bottom: 1rem !important;
}

/* champs */
dialog#dlg-supplier input,
dialog#dlg-supplier select{
  font-size: 1.6rem !important;
  padding: .9rem 1.1rem !important;
  border-radius: 14px !important;
}

/* segment Port fixe / Port mobile */
dialog#dlg-supplier .segmented{
  gap: .7rem !important;
  padding: .5rem !important;
  border-radius: 16px !important;
}
dialog#dlg-supplier .segmented .seg{
  padding: .75rem 1.2rem !important;
  font-size: 1.55rem !important;
}
dialog#dlg-supplier .segmented .seg small{
  font-size: 1.3rem !important;
}

/* champ pourcentage avec suffixe % */
dialog#dlg-supplier .input-suffix input{
  width: 300px !important;
  padding-right: 2.6rem !important;
  font-size: 1.6rem !important;
}
dialog#dlg-supplier .input-suffix .suffix{
  right: .8rem !important;
  font-size: 1.45rem !important;
}

/* boutons */
dialog#dlg-supplier .row{
  gap: .9rem !important;
}
dialog#dlg-supplier .row .btn{
  font-size: 1.55rem !important;
  padding: .7rem 1.2rem !important;
  border-radius: 12px !important;
}

/* mobile */
@media (max-width: 520px){
  dialog#dlg-supplier .panel.form{ width: 95vw !important; min-width: 95vw !important; }
  dialog#dlg-supplier .input-suffix input{ width: 100% !important; }
}

.thead {
  font-size: 4rem !important;
}

.icon-btn{
  display:inline-flex; align-items:center; justify-content:center;
  width:36px; height:36px; border-radius:999px;
  color:#eaf0ff;                         /* la couleur de l’icône */
  background: rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.18);
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
  text-decoration:none;
  transition: transform .12s ease, background .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.icon-btn .iconify{ font-size:40px; line-height:1; }  /* taille nette et centrée */
.icon-btn:hover{
  transform: translateY(-1px);
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.26);
  box-shadow: 0 6px 16px rgba(0,0,0,.28);
}
.icon-btn:active{ transform:none; background: rgba(255,255,255,.09); }
.icon-btn:focus-visible{
  outline: 2px solid rgba(156,209,255,.85);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(156,209,255,.25);
}
.filters .icon-btn{ margin-left:.25rem; } /* optionnel */


/* Tooltip flottant global (jamais coupé) */
.tip-pop {
  position: fixed;
  max-width: 320px;
  padding: .45rem .6rem;
  border-radius: .5rem;
  background: rgba(0,0,0,.88);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1.2;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
  z-index: 99999;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .12s ease, transform .12s ease;
}
.tip-pop.show {
  opacity: 1;
  transform: translateY(-10px);
}

/* ======= Mode mobile: le tableau devient des cartes empilées ======= */
@media (max-width: 640px){

  /* on cache l'entête */
  .table thead { display: none; }

  /* le tbody prend toute la largeur, les lignes sont des cartes */
  .table tbody { display: grid; gap: .8rem; padding: .4rem; }

  .table tbody tr {
    display: grid;
    grid-template-columns: 1fr;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 14px;
    overflow: hidden;
  }

  /* chaque cellule = ligne 'étiquette : valeur' */
  .table tbody td {
    display: grid;
    grid-template-columns: 42% 58%;
    gap: .6rem;
    align-items: center;
    text-align: left;            /* plus lisible sur mobile */
    padding: .8rem .9rem;
    background: transparent !important; /* supprime la couleur par colonne */
    border-bottom: 1px solid rgba(255,255,255,.06);
  }
  .table tbody td:last-child { border-bottom: 0; }

  /* étiquette (vient de data-label, posée par stampLabelsForMobile()) */
  .table tbody td::before {
    content: attr(data-label);
    opacity: .8;
    font-size: 1.35rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* valeurs numériques / prix : alignées à droite */
  .table tbody td.num { text-align: right; }

  /* colonne Actions : 2 colonnes de boutons */
  .table td.actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .5rem;
    padding: .8rem;
  }
  .table td .btn.tiny { font-size: 1.25rem; padding: .5rem .6rem; }
  .table td.actions .btn { width: 100%; }

  /* row-contact (détails fournisseur) prend toute la carte */
  .table tr.row-contact td {
    display: block;
    grid-template-columns: none;
    border: 0;
    padding: .8rem .9rem;
  }

  /* zone scroll si contenu déborde horizontalement */
  .table-wrap { overflow-x: hidden; }
}

/* ====== Anciennes dates (mode "tous les achats par article") ====== */
.table td.old-date {
  color: #ff5f5f !important;
  font-weight: 600;
}

/* Toute la ligne en rouge quand ce n'est pas le dernier achat */
.table tbody tr.not-latest {
  color: #ef4444;                    /* texte rouge */
}
.table tbody tr.not-latest a {
  color: #ef4444;                    /* liens rouges */
}
.table tbody tr.not-latest .btn {
  filter: saturate(0.2);             /* boutons moins saturés */
}

/* Variante plus douce : fond rouge pâle
.table tbody tr.not-latest { background-color: rgba(239,68,68,.12); color: inherit; }
*/

/* Styles pour les appels d'offre */
.table tbody tr.is-quote-request {
  background: linear-gradient(90deg, 
    rgba(249,115,22,.45) 0%, 
    rgba(249,115,22,.25) 100%);
  border-left: 5px solid #ff6b1a;
  position: relative;
  box-shadow: inset 0 0 12px rgba(249,115,22,.3);
}

.table tbody tr.is-quote-request td:first-child {
  border-left: 5px solid #ff6b1a;
}

.table tbody tr.is-quote-request a {
  color: #ffb347;
  text-decoration: none;
}

.table tbody tr.is-quote-request a:hover {
  text-decoration: underline;
  opacity: 0.9;
}

.table mark.hit{
    background: transparent;
    color: #36d27a;         /* vert lisible sur ton thème */
    font-weight: 700;
  }

.table a.phone {
  color: #fff !important;
  text-decoration: none;
}
  .table a.phone:hover {
    text-decoration: underline;
    opacity: .9;
  }
  .table a.phone:visited {
    color: #fff;
  }

/* ===== Correctifs mobile ===== */
@media (max-width: 640px){

  /* 1) Masquer les actions sur téléphone */
  .table th.actions,
  .table td.actions{
    display: none !important;
  }

  /* 2) Cartes : étiquette à gauche, valeur qui colle à droite */
  .table tbody td{
    grid-template-columns: auto 1fr;   /* laisse s'étirer la 2e colonne */
  }

  /* aligne à droite la colonne valeur pour les champs prix */
  .table tbody td[data-label="Prix"],
  .table tbody td[data-label="Prix net"],
  .table tbody td[data-label="Évolution"]{
    text-align: right;
  }
  /* …mais l’étiquette reste à gauche */
  .table tbody td[data-label="Prix"]::before,
  .table tbody td[data-label="Prix net"]::before,
  .table tbody td[data-label="Évolution"]::before{
    text-align: left;
  }
}

#btn-filter-recent.active {
  background: var(--accent);
  color: white;
}

#btn-toggle-latest.active {
  background: var(--accent);
  color: #fff;
}

/* ===== Fix: grouped rows on mobile shouldn't fill between cells ===== */
@media (max-width: 640px){

  /* If you currently color the whole <tr>, neutralize it on mobile */
  .table tbody tr.is-grouped { 
    background: transparent !important;
    position: relative;
  }

  /* Draw a blue border/ring around the card instead of a full bg */
  .table tbody tr.is-grouped::before{
    content:"";
    position:absolute;
    inset:0;                       /* covers the whole card */
    border:2px solid #2f6fff;      /* your blue */
    border-radius:14px;            /* same radius as the card */
    pointer-events:none;
  }

  /* Keep cells opaque so the row bg can't "shine" between them */
  .table tbody tr.is-grouped td{
    background: rgba(255,255,255,.04) !important;  /* same as your card bg */
    border-bottom: 1px solid rgba(255,255,255,.06);
  }
  .table tbody tr.is-grouped td:last-child{
    border-bottom: 0;
  }
}

/* ==== Fix mobile: éviter les traits bleus entre cellules ==== */
@media (max-width: 640px){

  /* on annule les bordures/fonds injectés inline sur les <td> */
  .table tbody tr.is-grouped td{
    background: transparent !important;
    border: 0 !important;                 /* neutralise border-top/bottom inline */
  }

  /* on dessine un contour bleu AUTOUR de la carte */
  .table tbody tr.is-grouped{
    position: relative;
    border-radius: 14px;                  /* même rayon que ta carte */
    overflow: hidden;                     /* pour arrondis propres */
  }
  .table tbody tr.is-grouped::before{
    content: "";
    position: absolute;
    inset: 0;
    border: 2px solid #2f6fff;            /* ton bleu de groupe */
    border-radius: 14px;
    pointer-events: none;
  }

  /* garde le look “carte” des cellules */
  .table tbody tr.is-grouped td{
    /* c’est ta couleur de carte par défaut */
    background: rgba(255,255,255,.04) !important;
    border-bottom: 1px solid rgba(255,255,255,.06) !important;
  }
  .table tbody tr.is-grouped td:last-child{
    border-bottom: 0 !important;
  }

  /* ligne contact: pas de double bordure, mais même contour */
  .table tbody tr.row-contact.is-grouped td{
    background: rgba(255,255,255,.04) !important;
    border: 0 !important;
  }
}

/* === Duplication modal — taille & confort === */
#dlg-dup {
  /* largeur plus généreuse mais responsive */
  width: clamp(380px, 44vw, 560px);
  max-width: 92vw;

  /* confort visuel */
  padding: 18px 20px;
  border-radius: 14px;
  font-size: 16px;             /* texte plus grand */
  line-height: 1.35;
}

#dlg-dup h3 {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 600;
}

/* lignes du formulaire */
#dlg-dup .form-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
}

#dlg-dup label {
  opacity: .9;
  font-size: 14px;
}

/* champs */
#dlg-dup input[type="date"],
#dlg-dup input[type="number"],
#dlg-dup input[type="text"] {
  width: 100%;
  height: 44px;               /* champs plus hauts */
  padding: 8px 12px;
  font-size: 16px;
  border-radius: 10px;
}

/* champs désactivés */
#dlg-dup input[type="date"]:disabled,
#dlg-dup input[type="number"]:disabled,
#dlg-dup input[type="text"]:disabled,
#dlg-dup select:disabled {
  opacity: 0.6;
  background-color: rgba(255, 255, 255, 0.03);
  cursor: not-allowed;
  color: rgba(255, 255, 255, 0.7);
}

/* boutons */
#dlg-dup .modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

#dlg-dup .modal-actions .btn {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 15px;
}

/* mobile : prendre toute la largeur */
@media (max-width: 520px) {
  #dlg-dup {
    width: calc(100vw - 2rem);
  }
  #dlg-dup .form-row {
    grid-template-columns: 1fr;
  }
}

/* Liens contact dans la ligne "Contact" */
.row-contact a.email,
.row-contact a.phone {
  color: #f3f4f6;          /* gris très clair */
  text-decoration: underline;
  font-weight: 500;
}

/* Survol : un peu d'accent mais toujours lisible */
.row-contact a.email:hover,
.row-contact a.phone:hover {
  color: #fde68a;          /* jaune pâle */
}

/* Optionnel : on neutralise le violet "déjà visité" des navigateurs */
.row-contact a.email:visited,
.row-contact a.phone:visited {
  color: #e5e7eb;
}

/* Colonne Référence : autoriser les retours à la ligne même sur les très longues refs */
.table th:nth-child(3),
.table td:nth-child(3){
  white-space: normal;        /* autorise la multiligne */
  word-break: break-all;      /* coupe même au milieu d'un long code */
  /* ou, si tu préfères un peu plus doux : overflow-wrap:anywhere; */
}