/* ==================== ETAT FACTURE CLIENT ==================== */
/* Charte des autres pages (prospection, fournisseur) : padding 10px 16px, h1 16pt couleur principale */
.page_etat_facture {
  padding: 10px 16px;
  font-size: 10pt;
  color: #22272e;
}

/* ---- Header ---- */
.header-etat-facture {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.header-etat-facture h1 {
  font-size: 16pt;
  color: var(--main-bg-color);
  margin: 0;
}

.tf-warn {
  background: #fff4e5;
  border: 1px solid #f5c98a;
  color: #8a5a00;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 9pt;
  margin-bottom: 12px;
}
.tf-warn .fa { margin-right: 6px; }

/* ---- Boutons ---- */
.tf-btn {
  padding: 5px 14px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #f5f5f5;
  color: #333;
  cursor: pointer;
  font-size: 9pt;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tf-btn:hover { background: #ececec; }
.tf-btn:disabled { opacity: .6; cursor: not-allowed; }
.tf-btn-primary { background: var(--main-bg-color); border-color: var(--main-bg-color); color: #fff; }
.tf-btn-primary:hover { filter: brightness(1.1); }
.tf-btn-xs { padding: 3px 8px; font-size: 8pt; gap: 4px; }
.tf-act-validate { background: #e8f5ee; border-color: #9fd3b4; color: #1e6b3f; }
.tf-act-settodraft { background: #f1f1f1; border-color: #c9c9c9; color: #444; }
.tf-act-settopaid { background: #e6f0fb; border-color: #9dbfeb; color: #1b4f8a; }
.tf-act-setunpaid { background: #fdeeee; border-color: #f0a8a8; color: #9b2c2c; }

/* ---- Toolbar ---- */
.tf-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  background: #fff;
  border: 1px solid #e3e6ea;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 12px;
}
.tf-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f5f6f8;
  border: 1px solid #dde1e7;
  border-radius: 8px;
  padding: 4px 10px;
  flex: 1;
  min-width: 260px;
}
.tf-search .fa { color: #888; }
.tf-search input { border: none; background: transparent; flex: 1; font-size: 9.5pt; outline: none; padding: 4px 0; }
.tf-clear { border: none; background: transparent; color: #999; cursor: pointer; }
.tf-clear:hover { color: #c0392b; }
.tf-field { display: flex; flex-direction: column; gap: 2px; font-size: 8pt; color: #666; }
.tf-field select, .tf-field input {
  border: 1px solid #dde1e7;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 9pt;
  background: #fff;
  color: #222;
}
.tf-count { margin-left: auto; font-size: 9pt; color: #666; }

/* ---- Tableau ---- */
.tf-table-wrap {
  background: #fff;
  border: 1px solid #e3e6ea;
  border-radius: 10px;
  overflow: auto;
}
.tf-table { width: 100%; border-collapse: collapse; font-size: 9pt; }
/* main.css impose thead th / a en couleur principale : on surcharge */
.tf-table thead th,
.tf-table thead th a {
  background: #f8f9fa;
  color: #444;
}
.tf-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: left;
  padding: 9px 10px;
  border-bottom: 2px solid #e3e6ea;
  font-weight: 600;
  white-space: nowrap;
}
.tf-table tbody td {
  text-align: left;
  padding: 7px 10px;
  border-bottom: 1px solid #eef0f3;
  vertical-align: middle;
}
.tf-table tbody tr:hover td { background: #fafbfd; }
.tf-table .tf-num { text-align: right; white-space: nowrap; }
.tf-strong { font-weight: 600; }
.tf-empty { text-align: center !important; color: #888; padding: 24px !important; }
.tf-link { color: var(--main-bg-color); text-decoration: none; font-weight: 600; }
.tf-link:hover { text-decoration: underline; }
.tf-id { color: #aaa; font-size: 7.5pt; margin-left: 3px; }
.tf-row-busy td { opacity: .6; }
.tf-row-flash td { background: #eaf7ee !important; transition: background .3s; }

.tf-type { font-size: 7.5pt; color: #666; border: 1px solid #ddd; border-radius: 4px; padding: 1px 6px; white-space: nowrap; }
.tf-type-2 { color: #9b2c2c; border-color: #f0a8a8; }
.tf-type-3 { color: #1b4f8a; border-color: #9dbfeb; }

.tf-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 12px;
  font-size: 8pt;
  font-weight: 600;
  white-space: nowrap;
  background: #eee;
  color: #444;
}
.tf-badge-0 { background: #ececec; color: #555; }
.tf-badge-1 { background: #fff1d6; color: #8a5a00; }
.tf-badge-2 { background: #e2f3e8; color: #1e6b3f; }
.tf-badge-3 { background: #fbe4e4; color: #9b2c2c; }

.tf-actions { white-space: nowrap; }
.tf-actions .tf-btn { margin-right: 4px; }
.tf-force {
  border: 1px dashed #c9c9c9;
  border-radius: 6px;
  background: #fff;
  color: #777;
  font-size: 8pt;
  padding: 2px 4px;
  cursor: pointer;
}

/* ---- Journal ---- */
.tf-journal {
  margin-top: 16px;
  background: #fff;
  border: 1px solid #e3e6ea;
  border-radius: 10px;
  padding: 10px 14px;
}
.tf-journal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.tf-journal-head h2 { margin: 0; font-size: 11pt; color: #333; }
.tf-journal-head h2 .fa { margin-right: 6px; }
.tf-jrow { border-left: 4px solid #ccc; border-radius: 6px; margin-bottom: 6px; background: #fafbfd; }
.tf-j-ok { border-left-color: #2e7d52; }
.tf-j-warn { border-left-color: #f07d00; }
.tf-j-err { border-left-color: #c0392b; }
.tf-jline {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  cursor: pointer;
  font-size: 9pt;
}
.tf-j-ok .tf-jstatus { color: #2e7d52; }
.tf-j-warn .tf-jstatus { color: #f07d00; }
.tf-j-err .tf-jstatus { color: #c0392b; }
.tf-jtime { color: #888; font-size: 8pt; font-family: monospace; }
.tf-jref { font-weight: 600; min-width: 110px; }
.tf-jaction { color: #555; min-width: 150px; }
.tf-jmsg { flex: 1; color: #333; }
.tf-j-err .tf-jmsg { color: #9b2c2c; }
.tf-jchev { color: #999; font-size: 8pt; }
.tf-jdetail {
  padding: 4px 14px 10px 32px;
  font-size: 8.5pt;
  color: #444;
  border-top: 1px dashed #e3e6ea;
}
.tf-jdetail pre {
  background: #f1f3f5;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 8pt;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 200px;
  overflow: auto;
  margin: 4px 0 0;
}

/* ---- Modale ---- */
.tf-modal { max-width: 520px; width: 92vw; padding: 0; border-radius: 12px; overflow: hidden; text-align: left; }
.tf-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--main-bg-color);
  color: #fff;
}
.tf-modal-head h3 { margin: 0; font-size: 11pt; }
.tf-modal-head h3 .fa { margin-right: 6px; }
.tf-close { border: none; background: transparent; color: #fff; font-size: 13pt; cursor: pointer; }
.tf-modal-body { padding: 14px 16px; font-size: 9.5pt; }
.tf-modal-body p { margin: 0 0 10px; }
.tf-arrow { margin: 0 8px; color: #888; }
.tf-endpoint { font-family: monospace; font-size: 8.5pt; background: #f1f3f5; padding: 6px 8px; border-radius: 6px; color: #333; }
.tf-opts { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.tf-hint { background: #eef4fb; border: 1px solid #c7dbf5; color: #1b4f8a; border-radius: 6px; padding: 6px 10px; font-size: 8.5pt; }
.tf-hint .fa { margin-right: 5px; }
.tf-modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 16px 14px; border-top: 1px solid #eef0f3; }

@media (max-width: 768px) {
  .page_etat_facture { padding: 6px 8px; }
  .tf-actions { white-space: normal; }
  /* « Afficher plus » : jusqu'à 2000 lignes sans pagination sur mobile
     (comportement PC inchangé, la liste complète reste rendue). */
  .tf-showmore { display: flex; justify-content: center; padding: 12px; }
  .tf-showmore .tf-btn { width: 100%; justify-content: center; }
}
