/* ============================================================
   RADAR PATRIMONIAL — charte cabinet (inspirée Groupe Premium)
   Blanc cassé, noir profond, doré cuivré.
   Bodoni Moda (display) · Montserrat (texte) · Spline Sans Mono (chiffres)
   ============================================================ */

:root {
  --paper: #faf7f3;
  --paper-deep: #f1ede7;
  --ink: #1c1c1c;
  --ink-soft: #4a4a4a;
  --ink-faint: #8b8b8b;
  --brass: #b3824f;
  --brass-soft: #c49669;
  --hairline: rgba(28, 28, 28, 0.13);
  --hairline-strong: rgba(28, 28, 28, 0.30);
  --good: #3d6b50;
  --warn: #a4541c;
  --card: #ffffff;
  --shadow: 0 18px 50px -18px rgba(28, 28, 28, 0.30);
  --serif: "Inter", "Helvetica Neue", sans-serif;  /* display : Inter en graisse forte */
  --sans: "Inter", "Helvetica Neue", sans-serif;
  --mono: "Spline Sans Mono", "SF Mono", monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.55;
  background-image:
    radial-gradient(ellipse at 15% -10%, rgba(196, 150, 105, 0.10), transparent 55%);
  min-height: 100vh;
}

.hidden { display: none !important; }

/* ---------- Wordmark ---------- */
.wordmark {
  font-family: var(--serif);
  display: flex;
  flex-direction: column;
  line-height: 1;
}
.wordmark-radar {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.wordmark-patrimonial {
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.46em;
  text-transform: uppercase;
  color: var(--brass);
  margin-top: 8px;
}
.wordmark-small { flex-direction: row; align-items: baseline; gap: 10px; }
.wordmark-small .wordmark-radar { font-size: 24px; }
.wordmark-small .wordmark-patrimonial { font-size: 11px; letter-spacing: 0.34em; margin-top: 0; }

/* ---------- Co-branding Groupe Premium ---------- */
.brand-row { display: flex; align-items: center; gap: 16px; }
.brand-x {
  font-size: 17px;
  font-weight: 300;
  color: var(--brass);
  line-height: 1;
}
.cobrand {
  display: flex;
  flex-direction: column;
  line-height: 1;
  font-family: "Montserrat", var(--sans);
}
.cobrand-groupe {
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.42em;
  color: var(--ink-soft);
}
.cobrand-premium {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.005em;
  color: var(--ink);
  margin-top: 2px;
}
.login-cobrand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}
.login-cobrand .cobrand { align-items: flex-start; text-align: left; }
.login-cobrand .cobrand-groupe { font-size: 9px; }
.login-cobrand .cobrand-premium { font-size: 21px; }

/* ---------- Boutons ---------- */
.btn {
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  padding: 10px 18px;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.18s ease, color 0.18s ease, transform 0.12s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: #2a352f; }
.btn-primary:disabled { opacity: 0.5; cursor: default; transform: none; }
.btn-ghost:hover { background: rgba(28, 36, 32, 0.06); }
.btn-quiet { border-color: transparent; color: var(--ink-faint); }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Connexion ---------- */
.login-screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--paper);
  background-image: radial-gradient(ellipse at 50% -20%, rgba(179, 130, 79, 0.12), transparent 60%);
  z-index: 100;
}
.login-card {
  width: min(400px, 90vw);
  background: var(--card);
  border: 1px solid var(--hairline-strong);
  padding: 52px 44px 36px;
  text-align: center;
  box-shadow: var(--shadow);
  animation: rise 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.login-card .wordmark { align-items: center; }
.login-tagline {
  margin: 22px 0 30px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.65;
}
.login-card input {
  width: 100%;
  padding: 12px 14px;
  font-family: var(--sans);
  font-size: 14px;
  border: 1px solid var(--hairline-strong);
  background: var(--paper);
  color: var(--ink);
  margin-bottom: 12px;
  outline: none;
  transition: border-color 0.15s;
}
.login-card input:focus { border-color: var(--brass); }
.login-error { color: var(--warn); font-size: 12.5px; margin-top: 12px; min-height: 18px; }
.login-foot {
  margin-top: 34px;
  padding-top: 18px;
  border-top: 1px solid var(--hairline);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Barre haute ---------- */
.app { max-width: 1280px; margin: 0 auto; padding: 0 32px 80px; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 26px 0 22px;
  border-bottom: 1px solid var(--hairline-strong);
}
.topbar-right { display: flex; align-items: center; gap: 12px; }
.last-run { font-size: 12px; color: var(--ink-faint); margin-right: 8px; }

.run-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  margin-top: 14px;
  background: rgba(179, 130, 79, 0.08);
  border: 1px solid rgba(179, 130, 79, 0.35);
  font-size: 13px;
  color: var(--ink-soft);
}
.run-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--brass);
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.25; } }

/* ---------- KPIs ---------- */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 30px;
  border: 1px solid var(--hairline);
  background: var(--card);
}
.kpi {
  padding: 24px 26px 20px;
  border-right: 1px solid var(--hairline);
  animation: rise 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.kpi:nth-child(2) { animation-delay: 0.06s; }
.kpi:nth-child(3) { animation-delay: 0.12s; }
.kpi:nth-child(4) { animation-delay: 0.18s; border-right: none; }
.kpi-value {
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.kpi-accent { color: var(--brass); }
.kpi-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-top: 6px;
}
.kpi-hint { text-transform: none; letter-spacing: 0; }

/* ---------- Onglets + filtres ---------- */
.tabs {
  display: flex;
  gap: 4px;
  align-items: center;
  margin: 28px 0 0;
  border-bottom: 1px solid var(--hairline-strong);
}
.tab {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 11px 16px 12px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--ink-faint);
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 0.15s;
}
.tab:hover { color: var(--ink); }
.tab.active {
  color: var(--ink);
  border-bottom-color: var(--brass);
  font-weight: 600;
}
.tab-count {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  padding: 1px 7px;
  margin-left: 5px;
  border-radius: 10px;
  background: rgba(28, 36, 32, 0.07);
  color: var(--ink-soft);
}
.tab.active .tab-count { background: var(--brass); color: var(--paper); }
.tabs-spacer { flex: 1; }
.tabs input[type="search"] {
  width: 230px;
  padding: 8px 12px;
  font-family: var(--sans);
  font-size: 13px;
  border: 1px solid var(--hairline);
  background: var(--card);
  color: var(--ink);
  outline: none;
  margin-bottom: 6px;
}
.tabs input[type="search"]:focus { border-color: var(--brass); }
.tabs select {
  padding: 8px 10px;
  font-family: var(--sans);
  font-size: 12.5px;
  border: 1px solid var(--hairline);
  background: var(--card);
  color: var(--ink-soft);
  cursor: pointer;
  outline: none;
  margin: 0 0 6px 8px;
  max-width: 190px;
}

/* ---------- Tableau ---------- */
.table-wrap {
  border: 1px solid var(--hairline-strong);
  border-top: none;
  background: var(--card);
  overflow-x: auto;
  max-height: calc(100vh - 60px);
  overflow-y: auto;
}
.leads-table { width: 100%; border-collapse: collapse; }
.leads-table thead th {
  position: sticky;
  top: 0;
  background: var(--card);
  z-index: 2;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  text-align: left;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--hairline-strong);
  white-space: nowrap;
}
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--ink); }
th.sortable::after { content: " " attr(data-dir); color: var(--brass); }
th.sorted { color: var(--ink); }
.col-action { width: 42px; }
.quick-copy {
  font-size: 15px;
  width: 32px; height: 32px;
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--ink-faint);
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.15s;
}
.quick-copy:hover { border-color: var(--brass); color: var(--brass); }
.quick-copy.copied { border-color: var(--good); color: var(--good); }
.leads-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
}
.leads-table tbody tr {
  cursor: pointer;
  transition: background 0.12s ease;
}
.leads-table tbody tr:hover { background: rgba(179, 130, 79, 0.05); }
.leads-table tbody tr:last-child td { border-bottom: none; }

.col-score { width: 64px; }
.col-num { text-align: right; }
td.col-num { font-family: var(--sans); font-weight: 600; font-variant-numeric: tabular-nums; font-size: 13px; white-space: nowrap; text-align: right; }
.col-statut { width: 130px; }

.score-badge {
  font-family: var(--serif);
  font-size: 14.5px;
  font-weight: 700;
  width: 40px; height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--hairline-strong);
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.score-high { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.score-mid { border-color: var(--brass); color: var(--brass); }

.sig-chip {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 2px 8px;
  margin-bottom: 4px;
  border-radius: 9px;
  border: 1px solid var(--hairline-strong);
  color: var(--ink-soft);
}
.sig-cession { border-color: rgba(179, 130, 79, 0.55); color: var(--brass); }
.sig-holding { border-color: rgba(61, 107, 80, 0.55); color: var(--good); }
.sig-d55 { border-color: var(--hairline-strong); color: var(--ink-soft); }
.sig-amf { border-color: rgba(72, 78, 116, 0.55); color: #484e74; }

.cell-main { font-weight: 500; }
.cell-sub { font-size: 12px; color: var(--ink-faint); margin-top: 2px; }
.cell-sub .age-flag { color: var(--brass); font-weight: 500; }
.cell-activite {
  font-size: 12px;
  color: var(--ink-soft);
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.urgence { font-size: 11.5px; color: var(--warn); margin-top: 2px; }
.urgence-ok { color: var(--ink-faint); }

.statut-select {
  font-family: var(--sans);
  font-size: 12px;
  padding: 6px 8px;
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  outline: none;
  width: 100%;
}
.statut-rdv, .statut-client { border-color: var(--good); color: var(--good); font-weight: 600; }
.statut-a_contacter { border-color: var(--brass); color: var(--brass); font-weight: 500; }
.statut-ecarte { opacity: 0.45; }

.empty-state {
  text-align: center;
  padding: 90px 20px;
  color: var(--ink-faint);
}
.empty-title {
  font-family: var(--serif);
  font-size: 22px;
  color: var(--ink-soft);
  margin-bottom: 8px;
}

/* ---------- Panneau détail ---------- */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 36, 32, 0.35);
  backdrop-filter: blur(2px);
  z-index: 40;
  animation: fade 0.2s ease both;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(560px, 94vw);
  background: var(--card);
  border-left: 1px solid var(--hairline-strong);
  box-shadow: -30px 0 60px -30px rgba(28, 36, 32, 0.45);
  z-index: 50;
  overflow-y: auto;
  animation: slide 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes slide { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }

.drawer-inner { padding: 34px 36px 60px; }
.drawer-close {
  position: absolute;
  top: 18px; right: 20px;
  font-size: 22px;
  background: none;
  border: none;
  color: var(--ink-faint);
  cursor: pointer;
  line-height: 1;
  padding: 6px;
}
.drawer-close:hover { color: var(--ink); }

.drawer-kicker {
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--brass);
  margin-bottom: 10px;
}
.drawer-title {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.drawer-subtitle { color: var(--ink-soft); font-size: 13.5px; margin-top: 6px; }

.drawer-scoreline {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 20px 0;
  padding: 14px 0;
  border-top: 1px solid var(--hairline-strong);
  border-bottom: 1px solid var(--hairline);
}
.drawer-section { margin-top: 26px; }
.drawer-section h3 {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.drawer-section h3::after { content: ""; flex: 1; height: 1px; background: var(--hairline); }

.fact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 22px;
  font-size: 13px;
}
.fact { border-left: 2px solid var(--hairline); padding-left: 10px; }
.fact b { display: block; font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); font-weight: 600; margin-bottom: 1px; }
.fact .mono { font-family: var(--mono); font-size: 12.5px; }

.angle-box {
  background: rgba(179, 130, 79, 0.07);
  border: 1px solid rgba(179, 130, 79, 0.3);
  padding: 16px 18px;
  font-size: 13.5px;
  line-height: 1.65;
}
.message-box {
  background: var(--paper);
  border: 1px solid var(--hairline-strong);
  padding: 16px 18px;
  font-size: 13.5px;
  line-height: 1.6;
  font-style: italic;
  position: relative;
}
.copy-btn {
  margin-top: 10px;
  font-size: 11.5px;
  padding: 7px 14px;
}
.fiabilite { font-size: 13px; color: var(--ink-soft); }
.fiabilite b { text-transform: capitalize; }

.points-list { list-style: none; font-size: 13px; color: var(--ink-soft); }
.points-list li { padding: 5px 0 5px 18px; position: relative; }
.points-list li::before { content: "—"; position: absolute; left: 0; color: var(--brass); }

.score-details { list-style: none; font-size: 12.5px; }
.score-details li {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 6px 0;
  border-bottom: 1px dotted var(--hairline);
  color: var(--ink-soft);
}
.score-details .pts { font-family: var(--mono); color: var(--brass); white-space: nowrap; }

.dirigeants-list { list-style: none; font-size: 13px; }
.dirigeants-list li { padding: 5px 0; border-bottom: 1px dotted var(--hairline); }
.dirigeants-list .quality { color: var(--ink-faint); font-size: 12px; }

.source-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--brass);
  text-decoration: none;
  border-bottom: 1px solid rgba(179, 130, 79, 0.4);
  padding-bottom: 1px;
}
.source-link:hover { color: var(--ink); border-color: var(--ink); }

.notes-area {
  width: 100%;
  min-height: 76px;
  font-family: var(--sans);
  font-size: 13px;
  padding: 12px;
  border: 1px solid var(--hairline-strong);
  background: var(--paper);
  color: var(--ink);
  resize: vertical;
  outline: none;
}
.notes-area:focus { border-color: var(--brass); }
.notes-saved { font-size: 11.5px; color: var(--good); margin-left: 10px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi:nth-child(2) { border-right: none; }
  .kpi:nth-child(1), .kpi:nth-child(2) { border-bottom: 1px solid var(--hairline); }
  .filters { flex-wrap: wrap; }
  .app { padding: 0 16px 60px; }
  .topbar { flex-direction: column; gap: 14px; align-items: flex-start; }
  .fact-grid { grid-template-columns: 1fr; }
}
