/* Gestionnaire de tickets — UI dense et rapide */
:root {
  --tm-blanc: #fff;
  --tm-jaune: #fff8bb;
  --tm-orange: #ffe0b2;
  --tm-rouge: #f5c6c6;
  --tm-vert: #c8e6c9;
  --tm-gris: #e0e5e8;
  --tm-bleu: #c5e5ff;
  --tm-violet: #e4d4f5;
  --tm-border: #ced4da;
  --tm-border-input: #adb5bd;
  --tm-border-focus: #86b7fe;
  --tm-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.tm-page {
  max-width: 1280px;
  margin-inline: auto;
  padding-top: .75rem;
  padding-bottom: .75rem;
}

/* Boîte : chrome fixe + scroll uniquement dans le tableau (classe body.tm-mode-inbox) */
html:has(body.tm-mode-inbox),
body.tm-mode-inbox {
  height: 100%;
  overflow: hidden;
}
body.tm-mode-inbox .tm-page {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-height: 100dvh;
  box-sizing: border-box;
}
body.tm-mode-inbox #tm-inbox-panel {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}
.tm-inbox-chrome {
  flex: 0 0 auto;
  background: var(--bs-body-bg, #fff);
  z-index: 5;
}
.tm-tickets-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.tm-toolbar {
  display: flex; flex-wrap: wrap; gap: .5rem 1rem;
  align-items: center; justify-content: space-between;
  margin-bottom: .75rem;
}
.tm-title-brand h1 {
  line-height: 1.15;
}
/* Logo blanc teinté en bleu (masque) */
.tm-logo-choco {
  display: inline-block;
  flex: 0 0 auto;
  width: 3rem;
  height: 3rem;
  margin-right: 15px;
  background-color: #0d6efd;
  -webkit-mask: url("../../assets_choco/0/logo_chocolatine_blanc.svg") center / contain no-repeat;
  mask: url("../../assets_choco/0/logo_chocolatine_blanc.svg") center / contain no-repeat;
}
/* Logo blanc (bouton primaire, fond sombre) */
.tm-logo-choco.tm-logo-choco-white {
  width: 1.15rem;
  height: 1.15rem;
  margin-right: 0;
  background-color: #fff;
}

.tm-tabs .nav-link {
  cursor: pointer; display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem .9rem;
}
.tm-tabs .nav-link.active { font-weight: 600; }
.tm-count {
  font-size: .7rem; min-width: 1.25rem; padding: .1rem .35rem;
  border-radius: 999px; background: #6c757d; color: #fff;
}
.tm-tabs .nav-link.active .tm-count { background: #0d6efd; }

.tm-table { font-size: .875rem; margin-bottom: 0; border-collapse: separate; border-spacing: 0; }
.tm-table thead th {
  font-size: .9rem; 
  text-transform: uppercase; 
  letter-spacing: .02em;
  color: #6c757d; 
  font-weight: 600; 
  border-bottom-width: 1px;
  white-space: nowrap;
}
/* Sticky limité à la zone scrollable de la boîte (évite effets de bord ailleurs) */
.tm-tickets-scroll .tm-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--bs-body-bg, #fff);
  box-shadow: inset 0 -1px 0 var(--tm-border);
}
.tm-table td { vertical-align: top; padding: .1rem .4rem; border-color: rgba(0,0,0,.06); }
.tm-table tbody tr { transition: background-color .12s ease; }
.tm-table tbody tr:hover:not(.tm-reply-row) { filter: none; }

/* Fond de toute la bande (td Bootstrap écrase le fond du tr) */
.tm-table > tbody > tr.tm-row-blanc > td { --bs-table-bg: var(--tm-blanc); background-color: var(--tm-blanc); }
.tm-table > tbody > tr.tm-row-jaune > td { --bs-table-bg: var(--tm-jaune); background-color: var(--tm-jaune); }
.tm-table > tbody > tr.tm-row-orange > td { --bs-table-bg: var(--tm-orange); background-color: var(--tm-orange); }
.tm-table > tbody > tr.tm-row-rouge > td { --bs-table-bg: var(--tm-rouge); background-color: var(--tm-rouge); }
.tm-table > tbody > tr.tm-row-vert > td { --bs-table-bg: var(--tm-vert); background-color: var(--tm-vert); }
.tm-table > tbody > tr.tm-row-gris > td { --bs-table-bg: var(--tm-gris); background-color: var(--tm-gris); }
.tm-table > tbody > tr.tm-row-bleu > td { --bs-table-bg: var(--tm-bleu); background-color: var(--tm-bleu); }
.tm-table > tbody > tr.tm-row-violet > td { --bs-table-bg: var(--tm-violet); background-color: var(--tm-violet); }
.tm-table > tbody > tr.tm-reply-row > td { border-top: none; }

.tm-col-who { width: 14%; min-width: 110px; max-width: 170px; }
.tm-col-who .tm-meta { overflow-wrap: anywhere; word-break: break-word; }
.tm-col-desc {
  width: 42%;
  /* height:1px → la cellule s’étire à la hauteur de la ligne (notes / demandeur) */
  position: relative;
  height: 1px;
  min-height: calc(1.3em * 3 + 8px);
  vertical-align: top;
}
.tm-col-notes { width: 27%; min-width: 100px; }
.tm-col-actions { width: 16%; text-align: right; }

.tm-meta { font-size: .75rem; color: #6c757d; line-height: 1.3; }
.tm-meta-sep { white-space: nowrap; }
.tm-who-name { font-weight: 700; }
.tm-who-name .tm-field + .tm-field { margin-left: 0.25em; }
.tm-field-input {
  display: inline-block;
  width: auto;
  min-width: 6rem;
  max-width: 100%;
  padding: 0.1rem 0.35rem;
  font-size: inherit;
  line-height: inherit;
  vertical-align: baseline;
}
.tm-field-empty:empty::before {
  content: attr(data-placeholder);
  color: #adb5bd;
  font-style: italic;
}
.tm-badge-confiance {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: #198754; margin-right: 4px; vertical-align: middle;
}

/* Demande : occupe toute la hauteur du bandeau, tronquée si trop longue */
.tm-desc {
  padding: 4px;
  line-height: 1.3;
  white-space: pre-wrap;
  word-break: break-word;
  box-sizing: border-box;
}
.tm-desc:not(.tm-desc-open) {
  position: absolute;
  inset: 0;
  max-height: none;
  overflow: hidden;
  display: block;
  /* fondu bas pour indiquer la suite */
  -webkit-mask-image: linear-gradient(180deg, #000 70%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 70%, transparent 100%);
}
.tm-desc.tm-desc-open,
.tm-desc:has(textarea),
.tm-desc:has(input) {
  position: relative;
  max-height: none;
  overflow: visible;
  display: block;
  -webkit-mask-image: none;
  mask-image: none;
}
/* Notes : affichage intégral (la hauteur de la ligne suit le contenu) */
.tm-notes {
  padding: 4px;
  max-height: none;
  overflow: visible;
  display: block;
  line-height: 1.3;
  white-space: pre-wrap;
  word-break: break-word;
}
.tm-notes.tm-notes-empty:empty {
  display: block;
  min-height: 1.3em;
}
.tm-notes.tm-notes-empty:empty::before {
  content: attr(data-placeholder);
  color: #adb5bd;
  font-style: italic;
}

.tm-actions {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.2rem;
  max-width: 100%;
  vertical-align: top;
}
.tm-actions .btn {
  padding: .2rem .45rem;
  font-size: .8rem;
  margin: 0;
  flex: 0 0 auto;
}
.tm-color-dot {
  width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0,0,0,.25);
  display: inline-block; padding: 0; cursor: pointer; vertical-align: middle;
}
.tm-color-dot.is-active { outline: 2px solid #212529; outline-offset: 1px; }
.tm-color-dot.blanc { background: #fff; }
.tm-color-dot.jaune { background: #ffc107; }
.tm-color-dot.orange { background: #fd7e14; }
.tm-color-dot.rouge { background: #dc3545; }
.tm-color-dot.vert { background: #198754; }
.tm-color-dot.gris { background: #6c757d; }
.tm-color-dot.bleu { background: #0d6efd; }
.tm-color-dot.violet { background: #6f42c1; }

.tm-tippy-colors {
  display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0.35rem 0.45rem;
}
.tm-tippy-colors .tm-color-dot { margin: 0; }

.tm-tippy-menu {
  display: flex; flex-direction: column; gap: 0.1rem;
  min-width: 0; width: max-content; max-width: 9rem;
  padding: 0.15rem;
}
.tm-tippy-menu-btn {
  width: 100%; padding: 0.3rem 0.45rem; border-radius: 0.25rem;
  text-decoration: none; white-space: nowrap;
  font-size: 0.8rem; color: #f8f9fa;
}
.tm-tippy-menu-btn:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.tm-tippy-menu-btn.tm-tippy-danger,
.tm-tippy-menu-btn.text-danger {
  color: #ff6b7a !important;
}
.tm-tippy-menu-btn.tm-tippy-danger:hover,
.tm-tippy-menu-btn.text-danger:hover {
  background: rgba(220, 53, 69, 0.25);
  color: #ff8a95 !important;
}

.tm-reply-row td { background-color: inherit; }
.tm-reply-box { max-width: 90%; margin-left: auto; }
.tm-reply-copies {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem 0.65rem;
  margin-bottom: 0.65rem;
  align-items: flex-start;
}
.tm-reply-copy {
  flex: 1 1 0;
  min-width: 0;
}
.tm-reply-copy .form-label {
  color: #6c757d;
  white-space: nowrap;
}
@media (max-width: 768px) {
  .tm-reply-copies {
    flex-wrap: wrap;
  }
  .tm-reply-copy {
    flex: 1 1 100%;
  }
}

/* Champs multi-adresses (puces) */
.tm-email-field {
  min-width: 0;
}
.tm-email-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  min-height: calc(1.5em + 0.5rem + 2px);
  height: auto;
  padding: 0.2rem 0.4rem;
  cursor: text;
}
.tm-email-chips:focus-within {
  border-color: #86b7fe;
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}
.tm-email-chips-input {
  flex: 1 1 4rem;
  min-width: 3.5rem;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 0.1rem 0.15rem;
  font-size: inherit;
  line-height: 1.4;
}
.tm-email-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  max-width: 100%;
  padding: 0.1rem 0.25rem 0.1rem 0.4rem;
  border-radius: 0.25rem;
  background: #e9ecef;
  font-size: 0.8125rem;
  line-height: 1.3;
  cursor: grab;
  user-select: none;
}
.tm-email-chip:active {
  cursor: grabbing;
}
.tm-email-chip.is-invalid {
  background: #f8d7da;
  color: #842029;
}
.tm-email-chip.is-confiance {
  background: #e8f5ee;
}
.tm-email-chip .tm-badge-confiance {
  margin-right: 0;
  flex: 0 0 auto;
}
.tm-email-chip-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: text;
}
.tm-email-chip-text.choco-editable:hover {
  background-color: rgba(13, 110, 253, 0.12);
  border-radius: 0.15rem;
}
.tm-email-chip-text input.choco-edit-input {
  min-width: 8rem !important;
  max-width: 18rem;
  font-size: inherit;
  line-height: inherit;
}
.tm-email-chip-remove {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: inherit;
  opacity: 0.55;
  padding: 0 0.15rem;
  line-height: 1;
  font-size: 1rem;
  cursor: pointer;
}
.tm-email-chip-remove:hover {
  opacity: 1;
}

.tm-reply-main {
  display: flex;
  align-items: stretch;
  gap: 1rem;
  flex-wrap: wrap;
}
.tm-reply-side {
  flex: 1 1 280px;
  max-width: 420px;
  display: flex;
  flex-direction: column;
}
.tm-reply-libre {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}
.tm-reply-libre .tm-reply-textarea {
  flex: 1 1 auto;
  min-height: 6rem;
}
.tm-reply-modele-row {
  display: flex;
  gap: 0.35rem;
  align-items: stretch;
}
.tm-reply-modele-row .form-select {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
}
.tm-reply-modele-row .btn {
  flex: 0 0 auto;
  align-self: stretch;
}
.tm-reply-body {
  flex: 2 1 360px;
  min-width: 0;
}
.tm-reply-body textarea,
.tm-reply-textarea {
  width: 100%;
  min-height: 0;
  overflow-y: hidden;
  resize: none;
}
.tm-reply-html-preview {
  display: block;
  width: 100%;
  min-height: 4.5rem;
  height: auto;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--tm-border-input, #adb5bd) !important;
}
.tm-reply-extras {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.55rem 0.65rem;
}
.tm-reply-extra-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem 0.75rem;
}
.tm-reply-extra-row .tm-reply-extra-label {
  flex: 0 0 auto;
  max-width: 45%;
  margin: 0;
  line-height: 1.2;
  word-break: break-word;
  cursor: pointer;
}
.tm-reply-extra-row .form-control {
  flex: 1 1 auto;
  min-width: 0;
}

/* Panneau de validation des correspondances CSV */
.tm-reply-csv-match-wrap:not(.d-none) {
  display: block;
}
.tm-csv-match {
  border: 1px solid #cfe2ff;
  background: #FFFFFF;
  border-radius: .4rem;
  padding: .5rem .6rem;
  font-size: .8rem;
}
.tm-csv-match.is-accepted {
  border-color: #a3cfbb;
  background: #f0faf4;
}
.tm-csv-match-empty {
  display: flex;
  align-items: center;
  gap: .4rem;
  color: #6c757d;
  border: 1px dashed var(--tm-border);
  background: #f8f9fa;
  border-radius: .4rem;
  padding: .45rem .6rem;
  font-size: .8rem;
}
.tm-csv-match-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .25rem;
}
.tm-csv-match-title {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-weight: 600;
  font-size: .82rem;
}
.tm-csv-match-count {
  font-weight: 500;
  color: #6c757d;
  font-variant-numeric: tabular-nums;
}
.tm-csv-match-score {
  font-weight: 600;
  font-size: .72rem;
  border-radius: .25rem;
  padding: .1rem .35rem;
  font-variant-numeric: tabular-nums;
  cursor: help;
}
.tm-csv-match-score.is-score-high {
  color: #0f5132;
  background: #d1e7dd;
}
.tm-csv-match-score.is-score-mid {
  color: #984c0c;
  background: #fff3cd;
}
.tm-csv-match-score.is-score-low {
  color: #842029;
  background: #f8d7da;
}
.tm-csv-match.is-accepted .tm-csv-match-count { color: #198754; }
.tm-csv-compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .75rem;
  margin-bottom: .15rem;
}
.tm-csv-compare-table th {
  font-weight: 600;
  color: #6c757d;
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  padding: .1rem .3rem .2rem 0;
  text-align: left;
}
.tm-csv-compare-table td {
  padding: .2rem .3rem .2rem 0;
  vertical-align: top;
  word-break: break-word;
}
.tm-csv-compare-key {
  font-weight: 600;
  white-space: nowrap;
  width: 4.2rem;
  color: #495057;
}
.tm-csv-compare-status {
  width: 1.1rem;
  text-align: center;
  padding-right: 0 !important;
}
.tm-csv-compare-row.is-match .tm-csv-compare-status { color: #198754; }
.tm-csv-compare-row.is-fuzzy .tm-csv-compare-status { color: #e67e22; }
.tm-csv-compare-row.is-diff .tm-csv-compare-status { color: #dc3545; }
.tm-csv-compare-row.is-na .tm-csv-compare-status,
.tm-csv-compare-row.is-na .tm-csv-compare-csv { color: #adb5bd; }
.tm-csv-compare-row.is-match .tm-csv-compare-csv { color: #198754; font-weight: 500; }
.tm-csv-compare-row.is-fuzzy .tm-csv-compare-csv { color: #c2690a; font-weight: 500; }
.tm-csv-compare-row.is-diff .tm-csv-compare-csv { color: #b02a37; }
.tm-csv-match-nav {
  display: flex;
  gap: .2rem;
  flex: 0 0 auto;
}
.tm-csv-match-nav .btn {
  --bs-btn-padding-y: .1rem;
  --bs-btn-padding-x: .35rem;
  --bs-btn-font-size: .75rem;
}
.tm-csv-match-meta {
  font-size: .72rem;
  margin-bottom: .35rem;
}
.tm-csv-match-section { margin-bottom: .3rem; }
.tm-csv-match-label {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: #6c757d;
  margin-bottom: .15rem;
}
.tm-csv-match-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
}
.tm-csv-match-chip {
  display: inline-flex;
  align-items: baseline;
  gap: .25rem;
  padding: .1rem .35rem;
  border-radius: .25rem;
  background: #fff;
  border: 1px solid #dee2e6;
  font-size: .75rem;
  max-width: 100%;
  word-break: break-word;
}
.tm-csv-match-chip code {
  font-size: .7rem;
  color: #0d6efd;
}
.tm-csv-match-fill code { color: #198754; }
.tm-csv-match-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem;
  margin-top: .4rem;
}
.tm-csv-match-ok {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  color: #198754;
  font-weight: 600;
  font-size: .78rem;
}

.tm-var-missing {
  color: #b00020;
  padding: 0 0.2em;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}
.tm-reply-box textarea[readonly] {
  background: #f8f9fa;
  color: #212529;
}
.tm-reply-actions {
  display: flex; 
  gap: .4rem; 
  justify-content: flex-end;
  margin-bottom: .4rem;}

/* Historique ticket (modal) */
.tm-hist-list { margin: 0; }
.tm-hist-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.65rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--tm-border, #dee2e6);
  font-size: 0.875rem;
  line-height: 1.35;
}
.tm-hist-row:last-child { border-bottom: 0; }
.tm-hist-date {
  flex: 0 0 7.5rem;
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
}
.tm-hist-badge {
  flex: 0 0 auto;
  font-weight: 500;
}
.tm-hist-auteur {
  flex: 0 1 auto;
  color: #495057;
}
.tm-hist-detail {
  flex: 1 1 8rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tm-hist-msg {
  flex: 0 0 auto;
  cursor: help;
  color: #0d6efd;
  text-decoration: underline dotted;
  text-underline-offset: 2px;
  font-size: 0.8rem;
}
.tm-hist-msg:hover { color: #0a58ca; }

/* Tippy message : thème dédié (fond blanc, hors style Chocolatine) */
.tippy-box[data-theme~='tm-mail'] {
  background: #ffffff;
  color: #222222;
  border: 1px solid #ced4da;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}
.tippy-box[data-theme~='tm-mail'] > .tippy-arrow::before {
  color: #ffffff;
}
.tippy-box[data-theme~='tm-mail'] .tippy-content {
  padding: 0;
  color: #222222;
}

.tm-hist-tip-body {
  max-width: 420px;
  max-height: 320px;
  overflow: auto;
  margin: 0;
  padding: 12px 14px;
  background: #ffffff;
  color: #222222;
  font-family: Arial, Helvetica, sans-serif !important;
  font-size: 14px !important;
  font-weight: normal !important;
  line-height: 1.5 !important;
  text-align: left !important;
  text-transform: none !important;
  text-shadow: none !important;
  letter-spacing: normal !important;
  white-space: normal;
  word-wrap: break-word;
  word-break: break-word;
  -webkit-text-size-adjust: 100%;
  box-sizing: border-box;
}
.tm-hist-tip-body a {
  color: #0563c1 !important;
  text-decoration: underline !important;
  font-family: inherit !important;
}
.tm-hist-tip-body p {
  margin: 0 0 1em !important;
  padding: 0 !important;
  font-family: inherit !important;
  font-size: inherit !important;
  text-align: inherit !important;
  text-transform: none !important;
  text-shadow: none !important;
  letter-spacing: normal !important;
  color: inherit !important;
}
.tm-hist-tip-body p:last-child { margin-bottom: 0 !important; }
/* Évite un trou trop grand entre le dernier paragraphe et la signature */
.tm-hist-tip-body p:has(+ br) { margin-bottom: 0.35em !important; }
.tm-hist-tip-body h1,
.tm-hist-tip-body h2,
.tm-hist-tip-body h3,
.tm-hist-tip-body h4,
.tm-hist-tip-body h5,
.tm-hist-tip-body h6 {
  font-family: Arial, Helvetica, sans-serif !important;
  font-weight: bold !important;
  color: #222222 !important;
  line-height: 1.3 !important;
  margin: 0 0 0.6em !important;
  padding: 0 !important;
  text-align: left !important;
  text-transform: none !important;
  text-shadow: none !important;
  letter-spacing: normal !important;
  text-rendering: auto !important;
}
.tm-hist-tip-body h1 { font-size: 20px !important; }
.tm-hist-tip-body h2 { font-size: 18px !important; }
.tm-hist-tip-body h3 { font-size: 16px !important; }
.tm-hist-tip-body h4 { font-size: 14px !important; }
.tm-hist-tip-body h5,
.tm-hist-tip-body h6 { font-size: 13px !important; }
.tm-hist-tip-body ul,
.tm-hist-tip-body ol {
  margin: 0 0 1em !important;
  padding-left: 1.5em !important;
  font-family: inherit !important;
  text-align: left !important;
}
.tm-hist-tip-body li {
  margin: 0.2em 0 !important;
  padding: 0 !important;
  font-family: inherit !important;
  text-transform: none !important;
  text-shadow: none !important;
}
.tm-hist-tip-body img {
  max-width: 100%;
  height: auto;
  border: 0;
}
.tm-hist-tip-body table { border-collapse: collapse; }
.tm-hist-tip-body td,
.tm-hist-tip-body th {
  font-family: Arial, Helvetica, sans-serif !important;
  font-size: 14px !important;
  line-height: 1.5 !important;
  text-align: left !important;
  text-transform: none !important;
  text-shadow: none !important;
}
.tm-hist-tip-body hr {
  border: 0;
  border-top: 1px solid #cccccc;
  margin: 1em 0;
}
.tm-hist-tip-body b,
.tm-hist-tip-body strong {
  font-weight: bold !important;
}

.tm-org-card {
  border: 1px solid var(--tm-border); border-radius: .5rem; padding: 1.15rem;
  transition: box-shadow .2s ease, transform .2s ease; cursor: pointer;
  background: linear-gradient(160deg, #f8fafc, #eef2f7);
  box-shadow: var(--tm-shadow);
}
.tm-org-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.1); transform: translateY(-2px); }

.tm-form-public {
  max-width: 560px; margin: 0 auto; padding: 1.5rem;
  background: #fff;
  border: 1px solid var(--tm-border);
  border-radius: 0.5rem;
  box-shadow: var(--tm-shadow);
}
.tm-form-public #tm-form-title {
  text-align: center;
  font-weight: 700;
}
.tm-honeypot { position: absolute; left: -9999px; opacity: 0; height: 0; overflow: hidden; }

/* Pages auth (connexion, reset) */
.tm-shell.tm-auth {
  max-width: 440px;
  background: #fff;
  border: 1px solid var(--tm-border);
  border-radius: 0.5rem;
  padding: 1.5rem;
  box-shadow: var(--tm-shadow);
}
.tm-panel {
  border: 1px solid var(--tm-border) !important;
  background: #f8f9fa !important;
}

.tm-stats-toolbar .form-control { width: auto; min-width: 9.5rem; }
.tm-stats-chart-wrap {
  position: relative;
  width: 100%;
  max-width: 920px;
  min-height: 280px;
  padding: 0.5rem 0.25rem 0;
  background: #fff;
  border: 1px solid var(--tm-border, #dee2e6);
  border-radius: 0.5rem;
}
.tm-stats-chart-wrap canvas { width: 100% !important; }

.tm-mod-html {
  overflow-y: hidden;
  resize: none;
}
.tm-modele-preview {
  display: block;
  width: 100%;
  min-height: 4.5rem;
  height: auto;
  overflow: hidden;
  background: #fff;
  /* pas de styles de contenu ici : l’iframe embarque un CSS type messagerie */
}

/* --- Panneau admin (menu latéral type account.php) --- */
.tm-admin-sidebar {
  width: 230px;
  flex: 0 0 230px;
  max-width: 230px;
  align-self: flex-start; /* évite que la colonne s'étire avec le contenu (saut du sticky) */
}
.tm-admin-nav {
  position: sticky;
  top: 0.75rem; /* pas de navbar site sur tickets.php */
  z-index: 4;
  border-radius: 0.5rem;
  overflow: hidden;
  border: 1px solid #ced4da;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.tm-admin-nav .list-group-item {
  cursor: pointer;
  border-color: #dee2e6;
  font-size: 0.9rem;
  padding: 0.65rem 0.85rem;
  color: #343a40;
}
.tm-admin-nav .list-group-item:first-child {
  border-top-left-radius: 0.5rem;
  border-top-right-radius: 0.5rem;
}
.tm-admin-nav .list-group-item:last-child {
  border-bottom-left-radius: 0.5rem;
  border-bottom-right-radius: 0.5rem;
}
.tm-admin-nav .list-group-item.active {
  background: #0d6efd;
  border-color: #0d6efd;
  color: #fff;
  font-weight: 600;
}
.tm-admin-nav .list-group-item:not(.active):hover {
  background: #f1f3f5;
  color: #212529;
}

#tm-admin-content {
  background: #fff;
  border: 1px solid #ced4da;
  border-radius: 0.5rem;
  padding: 1.25rem 1.5rem;
  min-height: 420px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}
.tm-membre-form-panel {
  background: #f8f9fa;
  border-color: var(--tm-border) !important;
}

.tm-regle-form {
  background: #f8f9fa;
  border-color: var(--tm-border) !important;
  width: 100%;
  max-width: none;
}
.tm-regle-row {
  display: flex;
  align-items: center;
  gap: 0.75rem 1rem;
  flex-wrap: wrap;
}
.tm-regle-legend {
  flex: 0 0 240px;
  max-width: 100%;
  margin: 0;
  font-size: 0.9rem;
  font-weight: 500;
  color: #343a40;
}
.tm-regle-row > .form-control,
.tm-regle-row > .form-select,
.tm-regle-row > .tm-reg-champs-checks {
  flex: 1 1 280px;
  min-width: 0;
}
.tm-reg-champs-checks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.75rem;
}
.tm-regles-list {
  padding-left: 1.25rem;
  list-style-position: outside;
}
.tm-regles-list .tm-sortable-row {
  display: list-item;
  padding: 0.2rem 0.3rem;
  border-radius: 0.25rem;
  background: #fff;
}
.tm-regles-list .tm-sortable-row,
.tm-modeles-list .tm-modele-row,
.tm-transferts-list .tm-transfert-row,
.tm-sources-list .tm-source-row {
  --dd-radius: 0.35rem;
}
.tm-regles-list .btn-xsm.btn-icon {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 1.75rem;
  height: 1.75rem;
  min-height: 1.75rem;
  padding: 0 0.45rem !important;
  line-height: 1;
  vertical-align: middle;
}
.tm-regle-toggle {
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  /* même épaisseur de bordure que btn-outline-* pour égaliser la hauteur */
  border: 1px solid transparent !important;
}
.tm-regle-toggle.text-bg-success {
  border-color: var(--bs-success, #198754) !important;
}
.tm-regle-toggle.text-bg-secondary {
  border-color: var(--bs-secondary, #6c757d) !important;
}
.tm-regle-toggle:hover {
  filter: brightness(0.92);
}
.tm-regle-toggle:focus-visible {
  outline: 2px solid #0d6efd;
  outline-offset: 2px;
}

/* Pied d’action : boutons de validation à droite dans un cadre */
.tm-form-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 0.5rem;
}
.tm-form-actions-box {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0px;
  border: 0px;
}

/* --- Contraste formulaires et cadres (toutes les pages du module) --- */
.tm-page,
.tm-shell,
.tm-form-public,
#tm-admin-content {
  --bs-border-color: var(--tm-border);
}

.tm-page .form-control,
.tm-page .form-select,
.tm-page textarea.form-control,
.tm-shell .form-control,
.tm-shell .form-select,
.tm-shell textarea.form-control,
.tm-form-public .form-control,
.tm-form-public .form-select,
.tm-form-public textarea.form-control,
#tm-admin-content .form-control,
#tm-admin-content .form-select,
#tm-admin-content textarea.form-control,
.modal-content .form-control,
.modal-content .form-select,
.modal-content textarea.form-control {
  border: 1px solid var(--tm-border-input);
  background-color: #fff;
  color: #212529;
}
.tm-page .form-control::placeholder,
.tm-shell .form-control::placeholder,
.tm-form-public .form-control::placeholder,
#tm-admin-content .form-control::placeholder,
.modal-content .form-control::placeholder {
  color: #6c757d;
  opacity: 1;
}
.tm-page .form-control:focus,
.tm-page .form-select:focus,
.tm-page textarea.form-control:focus,
.tm-shell .form-control:focus,
.tm-shell .form-select:focus,
.tm-shell textarea.form-control:focus,
.tm-form-public .form-control:focus,
.tm-form-public .form-select:focus,
.tm-form-public textarea.form-control:focus,
#tm-admin-content .form-control:focus,
#tm-admin-content .form-select:focus,
#tm-admin-content textarea.form-control:focus,
.modal-content .form-control:focus,
.modal-content .form-select:focus,
.modal-content textarea.form-control:focus {
  border-color: var(--tm-border-focus);
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.2);
}
.tm-page .table-responsive.border,
.tm-page .border.rounded,
.tm-shell .border.rounded,
.tm-form-public .border.rounded,
#tm-admin-content .table-responsive.border,
#tm-admin-content .border.rounded {
  border-color: var(--tm-border) !important;
}
.tm-page .form-label,
.tm-shell .form-label,
.tm-form-public .form-label,
#tm-admin-content .form-label,
.modal-content .form-label {
  color: #343a40;
  font-weight: 500;
}

.tm-page .table-responsive.border,
.tm-page .tm-table,
#tm-admin-content .table-responsive.border {
  border-color: var(--tm-border) !important;
}
.tm-table td { border-color: rgba(0, 0, 0, 0.1); }
.tm-table thead th { border-bottom-color: var(--tm-border); }

.tm-page .nav-tabs,
.tm-shell .nav-tabs {
  border-bottom-color: var(--tm-border);
}
.tm-tabs .nav-link { color: #495057; }
.tm-tabs .nav-link.active {
  border-color: var(--tm-border) var(--tm-border) #fff;
  color: #212529;
}

.modal-content {
  border: 1px solid var(--tm-border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}
.tm-iframe-code {
  border: 1px solid var(--tm-border);
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  background: #f8f9fa;
  font-size: 0.85rem;
  word-break: break-all;
}

.tm-drag-handle {
  cursor: grab;
  margin-right: .35rem;
  opacity: .45;
  vertical-align: middle;
  font-size: 1rem;
}
.tm-drag-handle:hover { opacity: .85; }
.tm-drag-handle:active { cursor: grabbing; }
.tm-drag-cell {
  width: 1.5rem;
  vertical-align: middle !important;
}
.tm-modeles-list .tm-modele-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.4rem;
  border-bottom: 1px solid #dee2e6;
  background: #fff;
  cursor: default;
}
.tm-modeles-list .tm-modele-row:last-child {
  border-bottom: 0;
}
.tm-modeles-list .tm-modele-titre {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tm-transferts-list {
  background: #fff;
  overflow: hidden;
}
.tm-transferts-list .tm-transfert-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.3rem;
  border-bottom: 1px solid #dee2e6;
  background: #fff;
  cursor: default;
}
.tm-transferts-list .tm-transfert-row:last-child {
  border-bottom: 0;
}
.tm-transferts-list .tm-transfert-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tm-tabs .nav-link.drop-zone-ready,
.tm-tabs .nav-link.drag-over {
  --dd-radius: 0.375rem;
  --dd-inset: 2px;
}

/* Zones d’import CSV local (sous les boutons toolbar ; contenu jamais envoyé au serveur) */
.tm-toolbar-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .35rem;
  max-width: 100%;
}
.tm-csv-drops {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .3rem;
}
.tm-csv-drop {
  display: flex;
  align-items: center;
  gap: .3rem;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 180px;
  padding: .15rem .35rem .15rem .4rem;
  border: 1px dashed var(--tm-border);
  border-radius: .3rem;
  background: #f8f9fa;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
  font-size: .75rem;
  line-height: 1.2;
}
.tm-csv-drop.is-dragover {
  border-color: #0d6efd;
  background: #e8f1ff;
}
.tm-csv-drop.is-loaded {
  border-style: solid;
  border-color: #157347;
  background: #198754;
  color: #fff;
}
.tm-csv-drop.is-loaded .tm-csv-drop-meta,
.tm-csv-drop.is-loaded .text-muted {
  color: rgba(255, 255, 255, .85) !important;
}
.tm-csv-drop-icon {
  font-size: .95rem;
  color: #6c757d;
  line-height: 1;
  flex: 0 0 auto;
}
.tm-csv-drop.is-loaded .tm-csv-drop-icon { color: #fff; }
.tm-csv-drop-body { flex: 1 1 auto; min-width: 0; }
.tm-csv-drop-title { font-weight: 600; font-size: .75rem; }
.tm-csv-drop-meta { font-size: .65rem; }
.tm-csv-drop-actions {
  display: flex;
  gap: .15rem;
  flex: 0 0 auto;
}
.tm-csv-drop-actions .btn {
  --bs-btn-padding-y: .05rem;
  --bs-btn-padding-x: .3rem;
  --bs-btn-font-size: .7rem;
  line-height: 1.1;
}
.tm-csv-drop.is-loaded .tm-csv-drop-actions .btn-outline-secondary {
  --bs-btn-color: #fff;
  --bs-btn-border-color: rgba(255, 255, 255, .55);
  --bs-btn-hover-bg: rgba(255, 255, 255, .15);
  --bs-btn-hover-border-color: #fff;
  --bs-btn-hover-color: #fff;
}
.tm-csv-drop.is-loaded .tm-csv-drop-actions .btn-outline-danger {
  --bs-btn-color: #fff;
  --bs-btn-border-color: rgba(255, 255, 255, .55);
  --bs-btn-hover-bg: rgba(255, 255, 255, .2);
  --bs-btn-hover-border-color: #fff;
  --bs-btn-hover-color: #fff;
}

.tm-sources-list .tm-source-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .55rem .75rem;
  border-bottom: 1px solid var(--tm-border);
}
.tm-sources-list .tm-source-row:last-child { border-bottom: 0; }
.tm-src-fill-rows .tm-src-fill-row .input-group-text {
  font-family: Consolas, "Courier New", monospace;
  font-size: .8rem;
}

@media (max-width: 768px) {
  .tm-admin-sidebar {
    width: 100%;
    flex: 0 0 100%;
    max-width: 100%;
  }
  .tm-admin-nav { position: static !important; }
  .tm-col-who { min-width: 90px; max-width: 120px; }
  .tm-col-notes { min-width: 80px; }
  .tm-actions {
    max-width: 9.5rem;
  }
  .tm-actions .btn-primary { display: inline-block; }
}
