/* ============================================================
   LeadExclu — design system
   ============================================================ */
:root {
  --ink: #0c1a24;
  --ink-2: #33414d;
  --muted: #5f6b76;
  --faint: #8a949d;
  --bg: #f6f7f5;
  --surface: #ffffff;
  --surface-2: #fafbfa;
  --line: #e4e7e5;
  --line-2: #eef0ee;

  --brand: #0d6b50;
  --brand-600: #0a5a43;
  --brand-700: #084534;
  --brand-50: #ebf5f0;
  --brand-100: #d3eadf;
  --accent: #f2b33d;
  --accent-50: #fdf5e4;

  --ok: #13804f;   --ok-50: #e8f5ee;
  --warn: #b26b00; --warn-50: #fdf3e0;
  --hot: #cf4a25;  --hot-50: #fcebe5;
  --info: #2563b8; --info-50: #e9f0fb;
  --violet: #6b4fc4; --violet-50: #f0ecfb;

  --r-sm: 8px; --r: 12px; --r-lg: 16px; --r-xl: 22px;
  --sh-1: 0 1px 2px rgba(12,26,36,.05);
  --sh-2: 0 1px 2px rgba(12,26,36,.04), 0 6px 20px -6px rgba(12,26,36,.08);
  --sh-3: 0 2px 6px rgba(12,26,36,.04), 0 24px 48px -12px rgba(12,26,36,.16);
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.55; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
img, svg { display: block; max-width: 100%; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.12; letter-spacing: -.025em; font-weight: 650; color: var(--ink); }
h1 { font-size: clamp(2.2rem, 5.2vw, 3.9rem); letter-spacing: -.04em; font-weight: 650; }
h2 { font-size: clamp(1.7rem, 3.4vw, 2.6rem); letter-spacing: -.035em; }
h3 { font-size: 1.12rem; letter-spacing: -.015em; }
h4 { font-size: .95rem; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
small { font-size: .85em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono, .num { font-family: var(--mono); font-feature-settings: "tnum"; letter-spacing: -.02em; }
.tnum { font-variant-numeric: tabular-nums; }
.ic { width: 18px; height: 18px; flex-shrink: 0; }
.ic.sm { width: 15px; height: 15px; }
.ic.lg { width: 22px; height: 22px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
::selection { background: var(--brand-100); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

/* ---------- Logo ---------- */
.logo { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; font-size: 1.22rem; letter-spacing: -.035em; color: var(--ink); text-decoration: none !important; }
.logo-mark { width: 28px; height: 28px; flex-shrink: 0; }

/* ---------- Boutons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent; font: inherit; font-weight: 550; font-size: .93rem; cursor: pointer; text-decoration: none !important; white-space: nowrap; transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .06s; user-select: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 1px 2px rgba(8,69,52,.3); }
.btn-primary:hover { background: var(--brand-600); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #1b2c38; }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); box-shadow: var(--sh-1); }
.btn-ghost:hover { border-color: #cfd4d1; background: var(--surface-2); }
.btn-soft { background: var(--brand-50); color: var(--brand-700); }
.btn-soft:hover { background: var(--brand-100); }
.btn-text { background: none; color: var(--ink-2); padding: 0 8px; }
.btn-text:hover { background: var(--line-2); }
.btn-danger { background: var(--hot); color: #fff; }
.btn-danger:hover { background: #b23d1c; }
.btn-sm { height: 32px; padding: 0 11px; font-size: .86rem; border-radius: 8px; gap: 6px; }
.btn-lg { height: 50px; padding: 0 22px; font-size: 1rem; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; padding: 0; }
.btn.ok { background: var(--ok); }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Champs ---------- */
.field { margin-bottom: 14px; }
.field > label, .label { display: block; font-weight: 550; font-size: .86rem; margin-bottom: 6px; color: var(--ink-2); }
.field .hint { font-size: .8rem; color: var(--faint); margin-top: 5px; }
input, select, textarea { width: 100%; font: inherit; font-size: .95rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; transition: border-color .15s, box-shadow .15s; box-shadow: var(--sh-1); }
input, select { height: 42px; }
textarea { resize: vertical; min-height: 80px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(13,107,80,.14); }
input::placeholder, textarea::placeholder { color: #a5adb3; }
input[type=checkbox], input[type=radio] { width: 17px; height: 17px; accent-color: var(--brand); box-shadow: none; padding: 0; margin: 0; flex-shrink: 0; }
input[type=range] { padding: 0; height: 24px; box-shadow: none; border: 0; accent-color: var(--brand); background: transparent; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235f6b76' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; padding-right: 34px; }
.input-ic { position: relative; }
.input-ic .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.input-ic input { padding-left: 38px; }
.err { color: var(--hot); font-size: .86rem; font-weight: 500; min-height: 1em; margin: 6px 0 0; }
.field.invalid input { border-color: var(--hot); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; cursor: pointer; }
.check input { margin-top: 3px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }

/* Interrupteur */
.switch { position: relative; display: inline-flex; width: 38px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: #cdd3cf; border-radius: 99px; transition: .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: .2s; }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(16px); }

/* Puces sélectionnables */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); font-size: .88rem; font-weight: 500; cursor: pointer; user-select: none; transition: .15s; }
.chip:hover { border-color: #c9cfcb; }
.chip input { display: none; }
.chip.on, .chip:has(input:checked) { border-color: var(--brand); background: var(--brand-50); color: var(--brand-700); }
.chip .ic { width: 15px; height: 15px; }

/* Segments */
.seg { display: inline-flex; background: var(--line-2); border-radius: 10px; padding: 3px; gap: 2px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg button { flex-shrink: 0; white-space: nowrap; }
.seg button { border: 0; background: none; font: inherit; font-size: .86rem; font-weight: 550; color: var(--muted); padding: 6px 12px; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); }

/* ---------- Cartes ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-1); }
.card-pad { padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.card-head h3 { margin: 0; font-size: 1rem; }
.card-body { padding: 20px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 600; padding: 3px 8px; border-radius: 6px; white-space: nowrap; line-height: 1.4; letter-spacing: .005em; }
.badge .ic { width: 13px; height: 13px; }
.b-ok { background: var(--ok-50); color: var(--ok); }
.b-warn { background: var(--warn-50); color: var(--warn); }
.b-hot { background: var(--hot-50); color: var(--hot); }
.b-info { background: var(--info-50); color: var(--info); }
.b-violet { background: var(--violet-50); color: var(--violet); }
.b-gray { background: var(--line-2); color: var(--muted); }
.b-dark { background: var(--ink); color: #fff; }
.b-brand { background: var(--brand-50); color: var(--brand-700); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }
.pulse { position: relative; }
.pulse::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid currentColor; opacity: 0; animation: pulse 1.8s ease-out infinite; }
@keyframes pulse { 0% { transform: scale(.6); opacity: .7; } 100% { transform: scale(1.8); opacity: 0; } }

/* Statuts CRM */
.s-new { background: var(--info-50); color: var(--info); }
.s-call { background: var(--warn-50); color: var(--warn); }
.s-rdv { background: var(--violet-50); color: var(--violet); }
.s-devis { background: #e7f3f6; color: #1c6f86; }
.s-win { background: var(--ok-50); color: var(--ok); }
.s-lost { background: var(--line-2); color: var(--muted); }
.t-brulant { background: var(--hot-50); color: var(--hot); }
.t-chaud { background: var(--warn-50); color: var(--warn); }
.t-tiede { background: var(--line-2); color: var(--muted); }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; max-width: 100%; min-width: 0; -webkit-overflow-scrolling: touch; }
table.t { width: 100%; border-collapse: collapse; font-size: .9rem; }
.t th { text-align: left; font-weight: 550; font-size: .78rem; color: var(--faint); text-transform: uppercase; letter-spacing: .04em; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); }
.t td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr.click { cursor: pointer; }
.t tbody tr.click:hover td { background: var(--surface-2); }
.t .r { text-align: right; }

/* ---------- Modale ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(12,26,36,.42); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; z-index: 100; opacity: 0; transition: opacity .2s; overflow-y: auto; }
.modal-bg.in { opacity: 1; }
.modal { position: relative; background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--sh-3); padding: 28px; width: 100%; max-width: 560px; transform: translateY(8px) scale(.98); transition: transform .2s; }
.modal-bg.in .modal { transform: none; }
.modal.sm { max-width: 420px; }
.modal.lg { max-width: 760px; }
.modal h3 { font-size: 1.2rem; margin-bottom: .4em; padding-right: 30px; }
.modal-x { position: absolute; top: 16px; right: 16px; width: 32px; height: 32px; border-radius: 8px; border: 0; background: none; cursor: pointer; color: var(--muted); display: grid; place-items: center; }
.modal-x:hover { background: var(--line-2); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* Paiement simulé */
.pay-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.pay-lock { display: inline-flex; gap: 6px; align-items: center; font-size: .85rem; font-weight: 600; color: var(--ok); }
.pay-lock .ic { width: 15px; height: 15px; }
.pay-brand { font-weight: 800; font-size: 1.1rem; color: #635bff; letter-spacing: -.03em; margin-right: 34px; }
.pay-amount { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 18px; display: grid; }
.pay-amount small { color: var(--muted); }
.pay-amount b { font-size: 1.7rem; letter-spacing: -.03em; font-family: var(--mono); }
.pay-demo { display: flex; gap: 8px; font-size: .8rem; color: var(--muted); background: var(--info-50); border-radius: 10px; padding: 10px 12px; }
.pay-demo .ic { width: 16px; height: 16px; color: var(--info); margin-top: 2px; }
.pay-foot { display: flex; gap: 6px; justify-content: center; align-items: center; font-size: .78rem; color: var(--faint); margin: 12px 0 0; }
.pay-foot .ic { width: 14px; height: 14px; }

/* ---------- Toasts ---------- */
#toasts { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: grid; gap: 10px; max-width: min(400px, calc(100vw - 32px)); }
.toast { display: flex; gap: 12px; align-items: flex-start; background: var(--ink); color: #fff; border-radius: 12px; padding: 13px 15px; box-shadow: var(--sh-3); transform: translateY(12px); opacity: 0; transition: .25s; font-size: .9rem; }
.toast.in { transform: none; opacity: 1; }
.toast .ic { color: #6ee7b7; margin-top: 1px; }
.toast.error .ic { color: #fda4a4; }
.toast div { flex: 1; display: grid; }
.toast span { color: #b6c2cb; font-size: .84rem; }
.toast button { background: rgba(255,255,255,.12); border: 0; color: #fff; font: inherit; font-weight: 600; font-size: .84rem; border-radius: 8px; padding: 6px 10px; cursor: pointer; }

/* ---------- Graphiques ---------- */
.bars { display: flex; align-items: flex-end; gap: 0; }
.bar { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; padding: 0 2px; position: relative; }
.bar span { width: 100%; max-width: 26px; border-radius: 4px 4px 1px 1px; min-height: 2px; transition: height .4s; }
.bar em { font-style: normal; font-size: .68rem; color: var(--faint); position: absolute; bottom: -18px; white-space: nowrap; }
.progress { height: 6px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand); border-radius: 99px; transition: width .5s; }

/* ---------- Divers ---------- */
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 650; font-size: .85rem; background: var(--brand-50); color: var(--brand-700); flex-shrink: 0; letter-spacing: -.02em; }
.kbd { font-family: var(--mono); font-size: .78rem; padding: 2px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; background: var(--surface); }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .ic { width: 34px; height: 34px; margin: 0 auto 12px; color: var(--faint); }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrapf { flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }
.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: 12px; background: var(--brand-50); color: var(--brand-700); font-size: .9rem; }
.callout.warn { background: var(--warn-50); color: #7a4a00; }
.callout.info { background: var(--info-50); color: #1d4e91; }
.callout .ic { margin-top: 2px; }
.callout p:last-child { margin: 0; }
.demo-pill { display: inline-flex; align-items: center; gap: 6px; font-size: .72rem; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--warn); background: var(--warn-50); padding: 3px 8px; border-radius: 6px; }
.blur { filter: blur(4.5px); user-select: none; }

/* Liste à coches */
.ticks { display: flex; flex-wrap: wrap; gap: 10px 22px; padding: 0; margin: 0; list-style: none; font-size: .92rem; color: var(--ink-2); font-weight: 500; }
.ticks li { display: inline-flex; gap: 7px; align-items: center; }
.ticks .ic { width: 16px; height: 16px; color: var(--brand); }
.logo em { font-style: normal; color: var(--brand); }
.auth-side .logo em, .side .logo em { color: #7ad3ad; }
body.app:not(.admin) .side .logo em { color: var(--brand); }
