/* =========================================================
   apps.matburo
   Design system : couleurs Matburo (bleu cobalt #2235AB)
   ========================================================= */

:root {
  /* ===== Palette Matburo (basée sur le logo) ===== */
  --bg: #f7f7fa;             /* fond clair, légère teinte bleutée */
  --bg-card: #ffffff;
  --ink: #1a1d2b;            /* texte principal, presque noir bleuté */
  --ink-soft: #4a5068;
  --ink-mute: #8a92a8;
  --line: #e5e5e8;           /* gris du logo, légèrement adouci */
  --line-strong: #d2d2d8;
  --accent: #2235AB;         /* bleu Matburo (du logo) */
  --accent-dark: #1A2A8A;    /* hover/active du bleu */
  --accent-light: #3D52D1;   /* pour gradients */
  --accent-soft: #EEF0FA;    /* fond très clair (notif/highlight) */
  --accent-ink: #1A2A8A;     /* texte sur fond accent-soft */
  --navy: #1a1d2b;
  --good: #15803d;
  --warn: #b45309;
  --danger: #b91c1c;

  --radius: 6px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 0 rgba(15, 23, 34, 0.04), 0 1px 2px rgba(15, 23, 34, 0.06);
  --shadow: 0 2px 4px rgba(15, 23, 34, 0.06), 0 8px 24px rgba(15, 23, 34, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  background-image:
    radial-gradient(circle at 20% 0%, rgba(194, 65, 12, 0.04), transparent 40%),
    radial-gradient(circle at 100% 100%, rgba(15, 23, 34, 0.05), transparent 50%);
}

#app { min-height: 100vh; }

.loading {
  display: flex; align-items: center; justify-content: center;
  height: 100vh; color: var(--ink-mute);
}

/* ========== Typographie ========== */
h1, h2, h3 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }

.mono, .code {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85em;
  letter-spacing: -0.01em;
}

/* ========== Layout : header + main ========== */
.shell {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 16px 96px;
  width: 100%;
  box-sizing: border-box;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(247, 247, 250, 0.92);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}
.brand-mark {
  width: 32px; height: 32px;
  background: var(--accent);
  color: #ffffff;
  display: grid; place-items: center;
  border-radius: 7px;
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-weight: 800;
  font-size: 18px;
  line-height: 1;
}
.brand-name {
  font-size: 1rem;
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--ink-soft);
}
.brand-name strong {
  font-weight: 700;
  color: var(--accent);
}

.topbar-spacer { flex: 1; }
.topbar .who {
  font-size: 13px;
  color: var(--ink-mute);
}
.topbar .who strong { color: var(--ink); font-weight: 500; }

/* ========== Composants : card / button / input ========== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.card + .card { margin-top: 14px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--bg);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.05s, background 0.15s;
}
.btn:hover { background: #1f2937; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.btn-accent:hover { background: #9a3412; }

.btn-ghost {
  background: transparent;
  color: var(--ink);
}
.btn-ghost:hover { background: var(--line); }

.btn-sm { padding: 6px 12px; font-size: 13px; }

.input, .textarea, .select {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(15, 23, 34, 0.08);
}

.label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-mute);
  font-weight: 500;
  margin-bottom: 6px;
}

.field { margin-bottom: 14px; }
.row { display: grid; gap: 12px; }
@media (min-width: 600px) {
  .row.cols-2 { grid-template-columns: 1fr 1fr; }
}

/* ========== Login ========== */
.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: var(--shadow);
}
.auth-card h1 { margin-bottom: 4px; }
.auth-card .sub {
  color: var(--ink-mute);
  font-size: 14px;
  margin-bottom: 24px;
}
.auth-card .btn { width: 100%; justify-content: center; }
.auth-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--danger);
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 14px;
}

/* ========== Search ========== */
.hero { padding: 32px 0 16px; }
.hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.4rem);
  margin-bottom: 6px;
}
.hero p {
  color: var(--ink-soft);
  margin: 0 0 20px;
}

.search-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 6px 6px 6px 14px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-bar:focus-within {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(15, 23, 34, 0.08);
}
.search-bar input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  padding: 10px 0;
  color: var(--ink);
}
.search-bar input::placeholder { color: var(--ink-mute); }

.hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--ink-mute);
  font-family: 'IBM Plex Mono', monospace;
}

/* ========== Liste de résultats ========== */
.results {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.result-item {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: transform 0.08s, border-color 0.15s, box-shadow 0.15s;
}
.result-item:hover {
  border-color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.result-item:active { transform: translateY(1px); }
.result-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
  display: grid; place-items: center;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}
.result-icon.firm {
  background: #e0e7ff;
  color: #3730a3;
}
.result-body { flex: 1; min-width: 0; }
.result-name {
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.result-meta {
  font-size: 13px;
  color: var(--ink-mute);
  margin-top: 2px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.result-meta span { white-space: nowrap; }
.result-arrow {
  color: var(--ink-mute);
  font-size: 18px;
  flex-shrink: 0;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-mute);
  font-size: 14px;
}

/* ========== Détail client ========== */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-mute);
  text-decoration: none;
  margin: 16px 0 8px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
}
.back-link:hover { color: var(--ink); }

.client-header {
  margin: 8px 0 20px;
}
.client-header .type-badge {
  display: inline-block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-ink);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
  font-weight: 500;
}
.client-header .type-badge.firm {
  color: #3730a3;
  background: #e0e7ff;
}
.client-header h1 { font-size: 1.8rem; }
.client-info {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}
@media (min-width: 600px) {
  .client-info { grid-template-columns: 1fr 1fr; }
}
.info-line {
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-size: 14px;
}
.info-line .lbl {
  color: var(--ink-mute);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.06em;
  min-width: 80px;
  font-weight: 500;
}
.info-line .val {
  color: var(--ink);
  word-break: break-word;
}
.info-line .val a { color: var(--accent); text-decoration: none; }
.info-line .val a:hover { text-decoration: underline; }

/* ========== Sections (interventions / tickets) ========== */
.section {
  margin-top: 28px;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.section-head h2 { font-size: 1.15rem; }

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.history-item {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.history-item:hover { border-color: var(--ink); }
.history-item .left { flex: 1; min-width: 0; }
.history-item .ref {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--ink-mute);
}
.history-item .title {
  font-weight: 500;
  margin-top: 2px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-item .date {
  font-size: 12px;
  color: var(--ink-mute);
  font-family: 'IBM Plex Mono', monospace;
  flex-shrink: 0;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}
.tag.open { background: #dcfce7; color: var(--good); }
.tag.closed { background: #f1f5f9; color: var(--ink-mute); }
.tag.urgent { background: #fee2e2; color: var(--danger); }

.empty-section {
  padding: 24px;
  text-align: center;
  color: var(--ink-mute);
  font-size: 14px;
  background: var(--bg-card);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}

/* ========== Formulaires (modale) ========== */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 34, 0.55);
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  animation: fadeIn 0.15s ease-out;
}
.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.18s ease-out;
}
.modal-head {
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-body { padding: 20px 24px; }
.modal-foot {
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--ink-mute);
  padding: 4px 8px;
}
.modal-close:hover { color: var(--ink); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========== Toasts ========== */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  z-index: 100;
  box-shadow: var(--shadow);
  animation: slideUp 0.2s ease-out;
}
.toast.error { background: var(--danger); }

/* ========== Spinner ========== */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--line);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.center-spin {
  display: grid; place-items: center; padding: 40px 0;
}

/* ========== Responsive tweaks ========== */
@media (max-width: 480px) {
  .hero { padding: 20px 0 12px; }
  .card { padding: 16px; }
  .modal-body, .modal-head, .modal-foot { padding-left: 18px; padding-right: 18px; }
}

/* ========== Diagnostic page ========== */
.config-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.config-table tr {
  border-bottom: 1px solid var(--line);
}
.config-table tr:last-child {
  border-bottom: none;
}
.config-table tr.row-warn {
  background: #fffbeb;
}
.config-table td {
  padding: 8px 10px;
  vertical-align: top;
}
.config-table td:first-child {
  color: var(--ink-mute);
  font-weight: 500;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.05em;
  width: 38%;
}
.config-table td:last-child {
  word-break: break-word;
}
.config-table code {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 3px;
}

.logs-box {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  max-height: 600px;
  overflow-y: auto;
}

.log-preview {
  background: var(--ink);
  color: #d4cdbe;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  padding: 8px 10px;
  border-radius: 4px;
  margin-top: 4px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
}

/* ========== Tickets page ========== */
.tabs {
  display: flex;
  gap: 6px;
  margin: 16px 0 18px;
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 0;
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  font: inherit;
  font-weight: 500;
  color: var(--ink-mute);
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--ink); }
.tab.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}
.tab-count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: var(--line);
  color: var(--ink);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 600;
}
.tab.active .tab-count {
  background: var(--accent);
  color: white;
}

.tickets-global-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ticket-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.05s;
}
.ticket-card:hover { border-color: var(--ink); }
.ticket-card:active { transform: translateY(1px); }

.ticket-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.ticket-card-subject {
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
  margin-bottom: 4px;
}
.ticket-card-client {
  font-size: 13px;
  color: var(--ink);
  margin-bottom: 6px;
}
.ticket-card-desc {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.4;
  margin: 6px 0;
}
.ticket-card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}
.ticket-card:has(.tag.closed) {
  border-left-color: var(--ink-mute);
  opacity: 0.85;
}

/* Badge de fraîcheur des données synchronisées (page recherche) */
.sync-badge {
  margin: -8px 0 12px;
  padding: 6px 10px;
  background: var(--bg-soft, #f9fafb);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
  width: fit-content;
}

/* ====== Recherche multi-critères ====== */
.multi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px 12px;
  margin: 12px 0 14px;
}
.multi-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.multi-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-mute);
  font-weight: 500;
}
.multi-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 14px;
  background: white;
  transition: border-color 0.15s;
}
.multi-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

.multi-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 6px;
}
.mode-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.mode-label {
  font-size: 12px;
  color: var(--ink-mute);
  margin-right: 4px;
}
.mode-btn {
  font-size: 12px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  background: white;
  border-radius: 4px;
  cursor: pointer;
  color: var(--ink-mute);
  font-family: inherit;
}
.mode-btn:hover {
  border-color: var(--accent);
  color: var(--ink);
}
.mode-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.results-summary {
  font-size: 12px;
  color: var(--ink-mute);
  margin: 8px 0 10px;
  padding: 6px 10px;
  background: var(--bg-soft, #f9fafb);
  border-radius: 4px;
}

/* ====== Sélection multiple tickets ====== */
.action-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #1f2937;
  color: white;
  border-radius: 8px;
  margin: 12px 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.action-bar .sel-count {
  font-weight: 600;
  font-size: 14px;
  margin-right: 8px;
}
.action-bar .btn {
  background: white;
  color: #1f2937;
  border: none;
}
.action-bar .btn-ghost {
  background: rgba(255,255,255,0.15);
  color: white;
}
.action-bar .btn-ghost:hover {
  background: rgba(255,255,255,0.25);
}
.action-bar .btn-accent {
  background: var(--accent, #6366f1);
  color: white;
}
.action-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.tech-select {
  padding: 5px 8px;
  border: 1px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.1);
  color: white;
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
}
.tech-select option {
  color: #111;
}

.ticket-checkbox-wrap {
  display: inline-flex;
  align-items: center;
  padding: 4px;
  cursor: pointer;
}
.ticket-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  margin: 0;
}
.ticket-card.selected {
  background: #eef2ff;
  border-left-color: var(--accent, #6366f1) !important;
  border-left-width: 4px !important;
}
.ticket-card-body {
  display: block;
}

/* ====== Encart métadonnées dans la modale ticket ====== */
.ticket-meta-box {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  padding: 14px 16px;
  margin: 0 0 18px;
  background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%);
  border: 1px solid #c7d2fe;
  border-radius: 8px;
}
.ticket-meta-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.ticket-meta-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6366f1;
  font-weight: 600;
}
.ticket-meta-value {
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ticket-meta-value.assigned {
  color: #3730a3;
}
.ticket-meta-value.unassigned {
  color: #9ca3af;
  font-weight: 500;
  font-style: italic;
}

/* ====== Compte-rendu de clôture ====== */
.required-mark {
  color: #dc2626;
  font-weight: 700;
  margin-left: 2px;
}
.field-error {
  color: #dc2626;
  font-size: 12px;
  margin-top: 4px;
}
.input-error,
textarea.input-error {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1) !important;
}
.resolution-field {
  background: linear-gradient(135deg, #fef3c7 0%, #fef9c3 100%);
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 12px 14px;
  margin-top: 8px;
}
.resolution-field .label {
  color: #92400e;
  font-weight: 600;
}

/* ====== Lecture seule pour les tickets fermés ====== */
.closed-banner {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  margin: 0 0 16px;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-left: 4px solid #6b7280;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
}
.closed-banner-hint {
  font-size: 12px;
  font-weight: 400;
  color: #6b7280;
}

/* Champs grisés en lecture seule */
.readonly-field {
  background: #f9fafb !important;
  color: #6b7280 !important;
  cursor: not-allowed !important;
  opacity: 1 !important;
}

/* Lien discret vers la fiche société/contact */
.modal-link {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  text-align: right;
}
.modal-link a {
  color: var(--accent, #6366f1);
  text-decoration: none;
  font-size: 13px;
}
.modal-link a:hover {
  text-decoration: underline;
}

/* ====== Tableau de découverte d'endpoints ====== */
.discover-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 13px;
}
.discover-table thead {
  background: #f3f4f6;
}
.discover-table th {
  text-align: left;
  padding: 8px 10px;
  font-weight: 600;
  font-size: 12px;
  color: var(--ink-mute);
  border-bottom: 1px solid var(--line);
}
.discover-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.discover-table tr:hover {
  background: #f9fafb;
}
.discover-table .discover-row-good {
  background: #ecfdf5;
}
.discover-table .discover-row-good:hover {
  background: #d1fae5;
}

/* ====== Bannière contrats (en haut de la fiche société) ====== */
.contracts-banner {
  margin: 0 0 18px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  border: 1px solid #86efac;
  border-radius: 10px;
}
.contracts-banner-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #065f46;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.contracts-banner-icon {
  font-size: 16px;
}
.contracts-banner-count-active {
  color: #047857;
  font-weight: 500;
  text-transform: none;
}
.contracts-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.contract-card {
  background: white;
  border: 1px solid #d1d5db;
  border-left: 4px solid #10b981;
  border-radius: 6px;
  padding: 10px 14px;
}
.contract-card-expired {
  border-left-color: #9ca3af;
  background: #f9fafb;
  opacity: 0.7;
}
.contract-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  gap: 8px;
  flex-wrap: wrap;
}
.contract-status {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.contract-status-active {
  background: #d1fae5;
  color: #065f46;
}
.contract-status-pending {
  background: #fef3c7;
  color: #92400e;
}
.contract-status-expired {
  background: #e5e7eb;
  color: #4b5563;
}
.contract-link {
  font-size: 12px;
  color: #6366f1;
  text-decoration: none;
}
.contract-link:hover {
  text-decoration: underline;
}
.contract-title {
  font-weight: 600;
  font-size: 14px;
  color: #111827;
  margin-bottom: 4px;
  word-break: break-word;
}
.contract-meta {
  font-size: 12px;
  color: #6b7280;
  margin-top: 4px;
}
.contract-warn {
  display: inline-block;
  margin: 4px 0;
  padding: 3px 8px;
  background: #fef3c7;
  color: #92400e;
  font-size: 12px;
  font-weight: 600;
  border-radius: 4px;
}

/* ====== Badges client associé / non trouvé ====== */
.tag-client-ok {
  background: #EEF0FA !important;
  color: #2235AB !important;
  font-weight: 600;
}
.tag-client-missing {
  background: #fee2e2 !important;
  color: #b91c1c !important;
  font-weight: 600;
}

/* ====== Mini-formulaire de rattachement dans la modale ticket ====== */
.attach-block {
  margin-top: 18px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #eff6ff 0%, #EEF0FA 100%);
  border: 1px solid #93c5fd;
  border-radius: 8px;
}
.attach-block-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 12px;
  font-weight: 600;
  font-size: 14px;
  color: #2235AB;
}
.attach-block-hint {
  font-size: 12px;
  font-weight: 400;
  color: #3D52D1;
}
.attach-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
@media (max-width: 500px) {
  .attach-grid { grid-template-columns: 1fr; }
}
.attach-results {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 280px;
  overflow-y: auto;
}
.attach-result {
  position: relative;
  padding: 8px 12px;
  background: white;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.1s;
}
.attach-result:hover {
  background: #eff6ff;
  border-color: #3D52D1;
}
.attach-result-name {
  font-weight: 600;
  font-size: 13px;
  color: #111827;
}
.attach-result-sub {
  font-size: 12px;
  color: #6b7280;
}
.attach-result-code {
  position: absolute;
  top: 8px;
  right: 12px;
  font-family: monospace;
  font-size: 11px;
  color: #6b7280;
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 4px;
}
.attach-loading, .attach-empty, .attach-hint {
  padding: 8px 12px;
  font-size: 12px;
  color: #6b7280;
  text-align: center;
}
.attach-hint {
  color: #2235AB;
  background: #EEF0FA;
  border-radius: 4px;
  margin-bottom: 6px;
}

/* ====== Badges hotline / intervention ====== */
.tag-hotline {
  background: #fef3c7 !important;
  color: #92400e !important;
  font-weight: 600;
}
.tag-intervention {
  background: #e0f2fe !important;
  color: #075985 !important;
  font-weight: 600;
}

/* ====== Bannière hotline dans la modale ====== */
.hotline-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  margin: 0 0 16px;
  background: linear-gradient(135deg, #fef3c7 0%, #fef9c3 100%);
  border: 1px solid #fde68a;
  border-left: 4px solid #f59e0b;
  border-radius: 6px;
}
.hotline-banner-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.hotline-banner-text strong {
  font-size: 14px;
  color: #92400e;
}
.hotline-banner-hint {
  font-size: 12px;
  color: #b45309;
  line-height: 1.4;
}
@media (max-width: 500px) {
  .hotline-banner {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ====== Page Administration ====== */
.admin-stats {
  padding: 12px 16px;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}
.stat-item {
  text-align: center;
  padding: 8px;
}
.stat-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}
.stat-label {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-top: 4px;
  letter-spacing: 0.04em;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.admin-users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-users-table thead {
  background: #f3f4f6;
}
.admin-users-table th {
  text-align: left;
  padding: 9px 10px;
  font-weight: 600;
  font-size: 12px;
  color: var(--ink-mute);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.admin-users-table td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.admin-users-table tr:hover {
  background: #f9fafb;
}
.user-row-inactive {
  opacity: 0.5;
  background: #f9fafb;
}
.role-badge {
  display: inline-block;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.status-active {
  color: #065f46;
  font-weight: 600;
  font-size: 12px;
}
.status-inactive {
  color: #9ca3af;
  font-weight: 600;
  font-size: 12px;
}
.me-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  background: #fef3c7;
  color: #92400e;
  font-size: 10px;
  font-weight: 600;
  border-radius: 10px;
  text-transform: uppercase;
}
.admin-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.admin-actions .btn {
  font-size: 11px;
  padding: 4px 8px;
  white-space: nowrap;
}

/* ====== Barre de filtre par technicien (liste des tickets) ====== */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0 14px;
  flex-wrap: wrap;
}
.filter-bar-label {
  font-size: 13px;
  color: var(--ink-mute);
  font-weight: 500;
}
.filter-wrapper {
  position: relative;
  display: inline-block;
}
.filter-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  color: var(--ink);
  min-width: 200px;
  justify-content: space-between;
}
.filter-trigger:hover {
  border-color: var(--accent);
}
.filter-trigger-arrow {
  font-size: 10px;
  color: var(--ink-mute);
  margin-left: auto;
}
.filter-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 20;
  min-width: 280px;
  max-height: 360px;
  overflow-y: auto;
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  padding: 4px;
}
.filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  user-select: none;
}
.filter-option:hover {
  background: #f3f4f6;
}
.filter-option-checked {
  background: #eff6ff;
  color: #2235AB;
  font-weight: 600;
}
.filter-option input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}
.filter-option-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.filter-option-login {
  color: var(--ink-mute);
  font-weight: 400;
  font-size: 11px;
}
.filter-option-clear {
  color: #dc2626;
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
  padding-bottom: 8px;
}
.filter-option-clear:hover {
  background: #fef2f2;
}
.filter-divider {
  height: 1px;
  background: var(--line);
  margin: 4px 0;
}

/* ====== Section Appels (commentaires téléphoniques) ====== */
.call-form {
  margin: 8px 0 16px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1px solid #bae6fd;
  border-radius: 8px;
}
.call-textarea {
  width: 100%;
  min-height: 56px;
  resize: vertical;
  padding: 8px 10px;
  border: 1px solid #bae6fd;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  background: white;
  box-sizing: border-box;
}
.call-textarea:focus {
  outline: none;
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.1);
}
.call-empty {
  font-size: 13px;
  color: var(--ink-mute);
  font-style: italic;
  padding: 12px 0;
}
.call-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.call-item {
  padding: 10px 12px;
  background: white;
  border: 1px solid var(--line);
  border-left: 3px solid #0284c7;
  border-radius: 6px;
}
.call-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.call-item-author {
  font-size: 13px;
  color: #0c4a6e;
  font-weight: 600;
}
.call-item-date {
  font-size: 11px;
  color: var(--ink-mute);
  font-family: monospace;
}
.call-item-text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Modale historique : limite la hauteur pour permettre le scroll */
.call-list-all {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 6px;
}

/* Compteur dans le titre de section (style discret) */
.section-count {
  color: var(--ink-mute);
  font-weight: 400;
  font-size: 0.85em;
}

/* ====== Cases à cocher des groupes (page Admin) ====== */
.groups-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 8px 0;
}
.group-checkbox-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #f3f4f6;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  user-select: none;
  transition: all 0.15s;
}
.group-checkbox-item:hover {
  background: #e5e7eb;
}
.group-checkbox-item input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}
.group-checkbox-item:has(input:checked) {
  background: #EEF0FA;
  border-color: #3D52D1;
  color: #2235AB;
}

/* Plusieurs badges côte à côte dans la cellule rôle */
.role-badges-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* Champ qui s'étend sur toute la largeur dans la grille */
.field-wide {
  grid-column: 1 / -1;
}
.field-help {
  font-size: 11px;
  color: var(--ink-mute);
  margin-top: 4px;
}

/* ====== Section CHAMPS PERSONNALISÉS ====== */
.custom-fields-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Carte Commercial (en haut, large) */
.cf-commercial-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(to right, #EEF0FA, #e0e7ff);
  border-left: 4px solid #3D52D1;
  border-radius: 6px;
}
.cf-commercial-card .cf-label {
  font-weight: 600;
  color: #2235AB;
}
.cf-commercial-card .cf-value-strong {
  font-size: 16px;
  font-weight: 700;
  color: #1A2A8A;
}

/* Liste des lignes d'équipement (compacte) */
.cf-equip-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cf-equip-row-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 8px 12px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13px;
}
.cf-equip-row-line:hover {
  background: #f9fafb;
}
.cf-equip-tag {
  background: #e5e7eb;
  color: #374151;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}
.cf-equip-piece {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.cf-equip-piece-label {
  color: var(--ink-mute);
  font-size: 12px;
}
.cf-equip-piece-value {
  font-weight: 600;
  color: var(--ink);
}
.cf-equip-garantie {
  font-weight: 500;
  font-size: 12px;
  margin-left: auto;
}
@media (max-width: 600px) {
  .cf-equip-garantie {
    margin-left: 0;
    width: 100%;
  }
}

/* Secteurs d'activité (sous les équipements) */
.cf-sectors {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 8px 12px;
  background: #f9fafb;
  border-radius: 6px;
}
.cf-sector-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.cf-sector-label {
  font-size: 12px;
  color: var(--ink-mute);
}
.cf-sector-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  background: #e5e7eb;
  padding: 2px 8px;
  border-radius: 4px;
}

/* ====== Page PROSPECTION ====== */

.prospect-actions-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.prospect-stats-card {
  margin-bottom: 14px;
}
.prospect-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}
.prospect-stat-item {
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  text-align: center;
}
.prospect-stat-value {
  font-size: 22px;
  font-weight: 700;
}
.prospect-stat-label {
  font-size: 11px;
  color: var(--ink-mute);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.prospect-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
  padding: 10px;
  background: #f9fafb;
  border-radius: 6px;
}
.prospect-filters .select,
.prospect-filters .input {
  margin: 0;
}
.prospect-filters .input {
  flex: 1;
  min-width: 200px;
}
.prospect-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.prospect-toggle:has(input:checked) {
  background: #EEF0FA;
  border-color: #3D52D1;
}

.prospect-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.prospect-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.prospect-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.prospect-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 6px;
}
.prospect-card-title {
  flex: 1;
  font-size: 15px;
}
.prospect-card-rs {
  color: var(--ink-mute);
  font-size: 13px;
}
.prospect-statut-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.prospect-statut-badge-large {
  padding: 6px 14px;
  font-size: 14px;
}
.prospect-card-line {
  font-size: 13px;
  color: var(--ink);
  margin: 2px 0;
}
.prospect-card-relance {
  margin: 6px 0;
}
.prospect-card-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 11px;
  color: var(--ink-mute);
}

/* Formulaire prospect */
.siren-search-box {
  margin-bottom: 16px;
  padding: 12px;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 8px;
}
.siren-results {
  max-height: 250px;
  overflow-y: auto;
  margin-top: 6px;
}
.siren-results:not(:empty) {
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.siren-result-item {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.siren-result-item:last-child {
  border-bottom: none;
}
.siren-result-item:hover {
  background: #f3f4f6;
}
.siren-result-name {
  font-weight: 600;
  font-size: 13px;
}
.siren-result-meta {
  font-size: 11px;
  color: var(--ink-mute);
  margin-top: 2px;
}

.prospect-form {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.prospect-form h3 {
  margin: 16px 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.prospect-form .input,
.prospect-form .select,
.prospect-form .textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.prospect-form .field {
  min-width: 0; /* permet aux flex/grid children de se réduire correctement */
}
.prospect-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
  max-width: 100%;
}
.prospect-grid-2 > * {
  min-width: 0; /* anti-débordement */
}
@media (max-width: 700px) {
  .prospect-grid-2 { grid-template-columns: 1fr; }
}

/* Détail prospect */
.prospect-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.prospect-detail-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 10px;
  background: #f9fafb;
  border-radius: 6px;
}
.prospect-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 8px;
}
.prospect-info-row {
  display: flex;
  gap: 8px;
  font-size: 13px;
}
.prospect-info-label {
  color: var(--ink-mute);
  min-width: 140px;
}
.prospect-info-value {
  font-weight: 600;
}
.prospect-notes {
  margin-top: 12px;
  padding: 10px;
  background: #fef3c7;
  border-radius: 6px;
  font-size: 13px;
}

.prospect-next-relance {
  padding: 10px;
  background: #EEF0FA;
  border-radius: 6px;
  margin-bottom: 12px;
  font-size: 13px;
}

.relances-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.relance-item {
  padding: 10px 12px;
  background: white;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
}
.relance-item.relance-system {
  background: #d1fae5;
  border-left-color: #059669;
}
.relance-head {
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
  margin-bottom: 4px;
  font-size: 12px;
}
.relance-mode {
  font-weight: 600;
}
.relance-author {
  color: var(--ink-mute);
}
.relance-date {
  margin-left: auto;
  color: var(--ink-mute);
}
.relance-comment {
  font-size: 13px;
  color: var(--ink);
}
.relance-next {
  margin-top: 6px;
  font-size: 11px;
  color: #3D52D1;
  font-style: italic;
}

.prospect-converted-banner {
  margin-top: 16px;
  padding: 12px;
  background: #d1fae5;
  color: #065f46;
  border-radius: 6px;
  text-align: center;
  font-weight: 600;
}
.prospect-converted-banner a {
  color: #047857;
  font-weight: 700;
}

/* ====== Sélecteur de dirigeants (formulaire prospect) ====== */
.dirigeant-picker {
  margin-bottom: 12px;
  padding: 10px 12px;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 6px;
}
.dirigeant-picker-title {
  font-size: 13px;
  font-weight: 600;
  color: #92400e;
  margin-bottom: 8px;
}
.dirigeant-picker-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.dirigeant-picker-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 6px 12px;
  background: white;
  border: 1px solid #fcd34d;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  text-align: left;
}
.dirigeant-picker-btn:hover {
  background: #fffbeb;
}
.dirigeant-picker-btn.selected {
  background: #10b981;
  color: white;
  border-color: #059669;
}
.dirigeant-picker-name {
  font-weight: 600;
}
.dirigeant-picker-role {
  font-size: 11px;
  color: var(--ink-mute);
}
.dirigeant-picker-btn.selected .dirigeant-picker-role {
  color: rgba(255, 255, 255, 0.85);
}

/* Grille 3 colonnes pour la section dirigeant */
.prospect-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  width: 100%;
  max-width: 100%;
}
.prospect-grid-3 > * {
  min-width: 0; /* anti-débordement */
}
@media (max-width: 700px) {
  .prospect-grid-3 { grid-template-columns: 1fr; }
}

/* ====== Liens contact cliquables (tel:, mailto:) ====== */
.contact-link {
  color: var(--accent, #2235AB);
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
  transition: background 0.15s;
}
.contact-link:hover,
.contact-link:active {
  background: rgba(30, 64, 175, 0.08);
  border-radius: 3px;
}
/* Sur mobile, on agrandit légèrement la zone tap pour faciliter le clic */
@media (max-width: 768px) {
  .contact-link {
    padding: 2px 4px;
    margin: -2px -4px;
    display: inline-block;
  }
}

/* ====== Container générique (utilisé par les écrans Prospects) ====== */
.container {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.container > * {
  max-width: 100%;
  box-sizing: border-box;
}

/* ====== Anti-débordement renforcé sur mobile ====== */
/* Filtres prospects : sur mobile, chaque filtre prend toute la largeur */
@media (max-width: 600px) {
  .prospect-filters {
    flex-direction: column;
    align-items: stretch;
  }
  .prospect-filters .select,
  .prospect-filters .input,
  .prospect-toggle {
    width: 100%;
    min-width: 0;
    flex: none;
  }
}
/* Stats grid : sur très petit écran, deux colonnes au lieu d'auto-fit */
@media (max-width: 480px) {
  .prospect-stats-grid {
    grid-template-columns: 1fr 1fr;
  }
}
/* Carte prospect : pas de débordement horizontal */
.prospect-card {
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.prospect-card-line {
  word-wrap: break-word;
  overflow-wrap: break-word;
}
/* Info-row sur mobile : passer en colonne pour ne pas couper */
@media (max-width: 600px) {
  .prospect-info-row {
    flex-direction: column;
    gap: 2px;
  }
  .prospect-info-label {
    min-width: 0;
  }
}
/* Sélecteur de dirigeant : empêcher les boutons de déborder */
.dirigeant-picker-btn {
  max-width: 100%;
  white-space: normal;
  word-wrap: break-word;
}
/* Détail prospect : actions wrap sur mobile */
@media (max-width: 600px) {
  .prospect-detail-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .prospect-detail-actions > * {
    width: 100%;
  }
}

/* ====== Conversation dans le ticket ====== */
.conv-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.conv-section-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 12px;
  color: var(--ink);
}
.ticket-conversation {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 360px;
  overflow-y: auto;
  padding: 4px;
  margin-bottom: 16px;
  background: #f9fafb;
  border-radius: 6px;
  padding: 10px;
}
.conv-msg {
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
  border: 1px solid transparent;
}
.conv-incoming {
  background: #eff6ff;
  border-color: #bfdbfe;
  margin-right: 20%;
}
.conv-outgoing {
  background: #f0fdf4;
  border-color: #bbf7d0;
  margin-left: 20%;
}
.conv-msg-head {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.conv-msg-icon { font-size: 14px; }
.conv-msg-from {
  font-weight: 600;
  font-size: 12px;
  color: var(--ink);
  flex: 1;
  min-width: 0;
  word-break: break-all;
}
.conv-msg-date {
  font-size: 11px;
  color: var(--ink-mute);
}
.conv-msg-meta {
  font-size: 11px;
  color: var(--ink-mute);
  margin-bottom: 4px;
}
.conv-msg-body {
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 13px;
  color: var(--ink);
}

/* Zone de réponse */
.conv-reply-box {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-top: 8px;
}
.conv-reply-title {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}
.conv-reply-field {
  margin-bottom: 10px;
}
.conv-reply-actions {
  display: flex;
  justify-content: flex-end;
}
.conv-reply-status {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 12px;
}
.conv-reply-status.conv-reply-info { background: #dbeafe; color: #1e40af; }
.conv-reply-status.conv-reply-ok { background: #d1fae5; color: #065f46; }
.conv-reply-status.conv-reply-err { background: #fee2e2; color: #991b1b; }

/* Mobile : pas de marge décorative */
@media (max-width: 600px) {
  .conv-incoming { margin-right: 0; }
  .conv-outgoing { margin-left: 0; }
}

/* ====== Section Activité unifiée (appels + tickets) ====== */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
.activity-list-all {
  max-height: 60vh;
  overflow-y: auto;
}

/* Item APPEL (pas cliquable, lecture seule) */
.activity-item.activity-call {
  background: #fefce8;
  border: 1px solid #fde68a;
  border-left: 3px solid #f59e0b;
  border-radius: 6px;
  padding: 10px 12px;
}
.activity-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.activity-icon { font-size: 14px; }
.activity-author {
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
  flex: 1;
  min-width: 0;
}
.activity-date {
  font-size: 12px;
  color: var(--ink-mute);
}
.activity-body {
  font-size: 13px;
  color: var(--ink);
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.5;
}

/* Les TICKETS dans la liste activité gardent le style history-item */
/* (déjà défini ailleurs, on rajoute juste un séparateur visuel) */
.activity-list .history-item {
  border-left: 3px solid var(--accent, #2235AB);
}
