/* Ty Buzzy — Prospection · thème « CRM premium »
   Inspirations (mise en page, espacements, couleurs) : tableaux de bord CRM
   Dribbble — Closr (kanban + probabilités), Axis CRM (interface claire, étiquettes
   pastille), Pipedrive (en-tête d'affaire sombre, étapes, chronologie).
   Identité Ty Buzzy : ardoise, accent cyan, bandeau gwenn-ha-du noir et blanc. */

:root {
  --bg: #f3f5f8;
  --card: #ffffff;
  --soft: #f7f8fb;
  --ink: #1c2331;          /* ardoise Ty Buzzy */
  --ink-2: #2a3345;
  --logo-bg: #1b1f25;
  --muted: #6b7385;
  --muted-2: #98a0b0;
  --line: #e6e9ef;
  --line-2: #eef0f4;
  --cyan: #00d4ff;
  --cyan-ink: #0089a8;     /* cyan lisible sur fond clair */
  --cyan-soft: rgba(0, 212, 255, 0.12);
  --soleil: #ffb703;
  --soleil-soft: #fff4d6;
  --good: #1fae6b;
  --good-soft: #e3f6ec;
  --danger: #e5484d;
  --danger-soft: #fdecec;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(28, 35, 49, 0.04), 0 4px 16px rgba(28, 35, 49, 0.05);
  --shadow-lg: 0 12px 40px rgba(28, 35, 49, 0.16);
  --sans: "Inter", "SF Pro Text", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --display: "Outfit", "Inter", "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sidebar: 248px;
}

/* Couleurs par état (utilisées par .st-*) */
.st-a-contacter { --st: #a3adbd; --st-soft: #eef0f4; --st-ink: #4c5566; }
.st-contacte { --st: #5ab8e8; --st-soft: #e6f4fc; --st-ink: #1f6f99; }
.st-relance { --st: #ffb703; --st-soft: #fff4d6; --st-ink: #8a5a00; }
.st-reponse { --st: #8b7cf6; --st-soft: #efecfe; --st-ink: #5141c4; }
.st-rendez-vous { --st: #00c2e8; --st-soft: #dff8fd; --st-ink: #007a94; }
.st-gagne { --st: #1fae6b; --st-soft: #e3f6ec; --st-ink: #147a4a; }
.st-perdu { --st: #ef5b5b; --st-soft: #fdecec; --st-ink: #b42828; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--display); letter-spacing: -0.01em; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--cyan-ink); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
kbd {
  font: 500 11px/1 var(--mono);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  background: #fff;
  color: var(--muted);
  border-radius: 5px;
  padding: 2px 5px;
}
[hidden] { display: none !important; }

/* Bandeau gwenn-ha-du (rayures noires et blanches du drapeau breton) */
.gwenn-ha-du {
  height: 10px;
  background: repeating-linear-gradient(180deg, #0b0d10 0 2px, #ffffff 2px 4px);
  opacity: 0.9;
}
.gwenn-ha-du.thin { height: 6px; }

/* ------------------------------ Boutons ------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 10px;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  text-decoration: none;
  color: var(--ink);
  transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
  white-space: nowrap;
}
.btn:hover { border-color: #cfd5df; background: var(--soft); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .tab:focus-visible, .text-btn:focus-visible, .card:focus-visible, .stage:focus-visible, .kpi:focus-visible {
  outline: 2px solid var(--cyan); outline-offset: 2px;
}
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.dark:hover { background: var(--ink-2); }
.btn.accent { background: var(--cyan); border-color: var(--cyan); color: #06222b; box-shadow: 0 6px 18px rgba(0, 212, 255, 0.28); }
.btn.accent:hover { background: #2bdcff; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: #f5c8ca; background: #fff; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.small { padding: 6px 10px; font-size: 12.5px; }
.btn.mini { padding: 4px 10px; font-size: 12px; border-radius: 8px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .6; cursor: progress; }
.text-btn {
  border: 0; background: none; padding: 0; cursor: pointer;
  color: var(--cyan-ink); font-weight: 600; font-size: 12.5px; text-decoration: none;
}
.text-btn:hover { text-decoration: underline; }
.text-btn.danger { color: var(--danger); }
.link-btn { border: 0; background: none; padding: 0; cursor: pointer; font-weight: 600; text-align: left; color: var(--ink); }
.link-btn:hover { color: var(--cyan-ink); }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.06); color: #fff; font-size: 22px; line-height: 1; cursor: pointer;
}
.icon-btn:hover { background: rgba(255,255,255,.14); }

/* ------------------------------ Connexion ------------------------------ */
.login {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  background: radial-gradient(1200px 600px at 20% 0%, rgba(0,212,255,.18), transparent 60%), var(--ink);
  padding: 20px;
}
.login-card {
  width: min(400px, 100%);
  background: #fff; border-radius: 20px; padding: 0 28px 26px;
  box-shadow: var(--shadow-lg); overflow: hidden;
  display: grid; gap: 12px; text-align: center;
}
.login-card .gwenn-ha-du { margin: 0 -28px 8px; }
.login-logo { margin: 8px auto 0; border-radius: 10px; }
.login-card h1 { font-size: 24px; }
.login-card h1 span { color: var(--cyan-ink); }
.login-card p { margin: 0; color: var(--muted); }
.login-card input { border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; }
.login-card input:focus { outline: 2px solid var(--cyan); border-color: transparent; }
.login-card small { color: var(--muted-2); }
.login-error { color: var(--danger) !important; min-height: 1em; font-size: 13px; }

/* ------------------------------ Bandeau aperçu ------------------------------ */
.apercu-banner {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 16px;
  background: repeating-linear-gradient(135deg, #fff4d6 0 14px, #ffecb3 14px 28px);
  border-bottom: 1px solid #f3d27a;
  font-size: 13px; color: #6b4a00;
}
.apercu-banner strong {
  background: #1c2331; color: #ffd166; border-radius: 6px; padding: 2px 8px;
  font: 600 11px/1.6 var(--mono); text-transform: uppercase; letter-spacing: .08em;
}

/* ------------------------------ Mise en page ------------------------------ */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  background: var(--ink); color: #cfd6e4;
  display: flex; flex-direction: column;
  border-right: 1px solid rgba(255,255,255,.04);
}
body.has-apercu .sidebar { top: 37px; height: calc(100vh - 37px); }
.brand { display: flex; align-items: center; gap: 12px; padding: 20px 20px 22px; }
.brand-logo { border-radius: 8px; box-shadow: 0 0 0 1px rgba(255,255,255,.08); }
.brand-name { display: grid; font: 700 17px/1.2 var(--display); color: #fff; }
.brand-name small { font: 500 11.5px/1.4 var(--sans); color: #8d97ab; }

.sidenav { display: grid; gap: 4px; padding: 0 12px; }
.sidenav-label { font: 600 10.5px/1 var(--mono); text-transform: uppercase; letter-spacing: .12em; color: #6c768a; padding: 10px 10px 8px; }
.sidenav .tab {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 10px;
  color: #b9c2d3; text-decoration: none; font-weight: 500;
  transition: background .15s, color .15s;
}
.sidenav .tab svg { width: 18px; height: 18px; flex: none; }
.sidenav .tab:hover { background: rgba(255,255,255,.05); color: #fff; }
.sidenav .tab.active { background: rgba(0,212,255,.12); color: #fff; box-shadow: inset 3px 0 0 var(--cyan); }
.sidenav .tab.active svg { color: var(--cyan); }
.tab-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--danger); color: #fff; font: 700 11px/20px var(--sans); text-align: center;
}
.sidebar-foot { margin-top: auto; padding: 16px 20px 20px; display: grid; gap: 8px; }
.side-note { margin: 0 0 6px; font-size: 12px; color: #7f899c; line-height: 1.7; }
.side-note code { color: var(--cyan); font-family: var(--mono); font-size: 11.5px; }
.side-note kbd { background: transparent; color: #cfd6e4; border-color: #3a4458; }
.sidebar .btn.ghost { color: #b9c2d3; border-color: #333d50; justify-content: flex-start; }
.sidebar .btn.ghost:hover { background: rgba(255,255,255,.05); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
main { padding: 8px 28px 40px; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 28px;
  background: rgba(243,245,248,.86);
  backdrop-filter: saturate(1.4) blur(10px);
}
body.has-apercu .topbar { top: 37px; }
.mobile-brand { display: none; }

/* Recherche */
.search { position: relative; flex: 1; max-width: 560px; display: flex; align-items: center; }
.search > svg { position: absolute; left: 14px; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; border: 1px solid var(--line); background: #fff;
  border-radius: 12px; padding: 11px 44px 11px 42px;
  box-shadow: var(--shadow); font-size: 14px;
}
.search input::-webkit-search-cancel-button { display: none; }
.search input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 4px var(--cyan-soft), var(--shadow); }
.search-kbd { position: absolute; right: 12px; }
.search input:focus ~ .search-kbd { display: none; }
.search-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px);
  list-style: none; margin: 0; padding: 6px;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-lg); max-height: min(70vh, 520px); overflow: auto; z-index: 40;
}
.search-hit {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 10px; cursor: pointer;
}
.search-hit.active { background: var(--cyan-soft); box-shadow: inset 3px 0 0 var(--cyan); }
.hit-main { display: grid; min-width: 0; flex: 1; }
.hit-main strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hit-main small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hit-val { font: 600 12.5px var(--sans); color: var(--ink); white-space: nowrap; }
.search-hit mark { background: rgba(0,212,255,.28); color: inherit; border-radius: 3px; padding: 0 1px; }
.search-empty { padding: 14px 12px; color: var(--muted); }
.search-foot {
  display: flex; gap: 14px; flex-wrap: wrap; padding: 8px 10px 4px; margin-top: 4px;
  border-top: 1px solid var(--line-2); color: var(--muted); font-size: 11.5px;
}
.search-foot kbd { margin-right: 3px; }
.topbar-actions { display: flex; gap: 8px; margin-left: auto; }

/* En-tête de page */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 10px 0 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 28px; font-weight: 700; }
.eyebrow { margin: 0 0 2px; color: var(--muted); font-size: 12.5px; }
.eyebrow::first-letter { text-transform: uppercase; }
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; }
.select {
  border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 30px 8px 12px;
  font-size: 13px; box-shadow: var(--shadow); cursor: pointer;
}

/* ------------------------------ KPI ------------------------------ */
.kpis { display: grid; grid-template-columns: 1.35fr repeat(4, 1fr); gap: 14px; margin-bottom: 14px; }
.kpi {
  text-align: left; border: 1px solid var(--line); background: var(--card); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); display: grid; gap: 2px; align-content: start; min-width: 0;
}
button.kpi { cursor: pointer; transition: transform .15s, box-shadow .15s; }
button.kpi:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(28,35,49,.09); }
.kpi-head { display: flex; align-items: center; gap: 8px; }
.kpi-icon {
  width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  background: var(--soft); color: var(--ink); font-size: 13px; font-weight: 700;
}
.kpi-label { margin: 0; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.kpi-value { margin: 6px 0 0; font: 700 26px/1.1 var(--display); letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-hint { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.kpi.hero {
  background: radial-gradient(400px 160px at 100% 0%, rgba(0,212,255,.35), transparent 70%), var(--ink);
  border-color: var(--ink); color: #fff;
}
.kpi.hero .kpi-label, .kpi.hero .kpi-hint { color: #b6c0d2; }
.kpi.hero .kpi-icon { background: var(--cyan); color: #06222b; }
.kpi.hero .kpi-value { font-size: 32px; color: #fff; }
.kpi.good .kpi-icon { background: var(--good-soft); color: var(--good); }
.kpi.bad .kpi-icon { background: var(--danger-soft); color: var(--danger); }
.kpi.bad .kpi-value { color: var(--danger); }

/* ------------------------------ Panneaux ------------------------------ */
.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow); min-width: 0; margin-bottom: 14px;
}
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.panel-head h2 { font-size: 16px; font-weight: 600; }
.panel-sub { color: var(--muted); font-size: 12.5px; }
.dash-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px; }
.dash-grid .panel { margin-bottom: 0; }
.span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; } .span-7 { grid-column: span 7; } .span-12 { grid-column: span 12; }
.chart-wrap { position: relative; height: 220px; }
.chart-wrap.tall { height: 270px; }
.empty-note { color: var(--muted); font-size: 13px; margin: 6px 0; list-style: none; }
.empty-note.small { font-size: 12px; }

/* Étapes du pipeline (tableau de bord) */
.stages { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.stage {
  text-align: left; border: 1px solid var(--line); background: var(--soft); border-radius: 12px;
  padding: 12px 12px 10px; cursor: pointer; display: grid; gap: 4px; min-width: 0;
  border-top: 3px solid var(--st); transition: transform .15s, box-shadow .15s, background .15s;
}
.stage:hover { background: #fff; transform: translateY(-2px); box-shadow: var(--shadow); }
.stage-top { display: flex; justify-content: space-between; gap: 6px; align-items: baseline; }
.stage-name { font-weight: 600; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-proba { white-space: nowrap; font: 600 11px var(--mono); color: var(--st-ink); background: var(--st-soft); border-radius: 6px; padding: 1px 5px; }
.stage-count { margin: 2px 0 0; font: 700 24px/1.1 var(--display); }
.stage-bar { height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; }
.stage-bar span { display: block; height: 100%; background: var(--st); border-radius: 4px; }
.stage-val { margin: 4px 0 0; font-weight: 600; font-size: 13px; }
.stage-weighted { margin: 0; font-size: 11.5px; color: var(--muted); min-height: 1.2em; }

/* Relances */
.relance-list { display: grid; gap: 8px; }
.relance-item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff;
  border-left: 3px solid var(--soleil);
}
.relance-item.overdue { border-left-color: var(--danger); }
.relance-item.today { border-left-color: var(--cyan); }
.relance-item .who { border: 0; background: none; text-align: left; padding: 0; cursor: pointer; display: grid; min-width: 0; }
.relance-item .who strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.relance-item .who:hover strong { color: var(--cyan-ink); }
.relance-item .who small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.relance-actions { display: flex; gap: 6px; }
.more { display: inline-block; margin-top: 4px; }
.relances-full { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.relances-full .panel { margin: 0; }
.relance-group.bad .panel-head h2 { color: var(--danger); }
.relance-group.today .panel-head h2 { color: var(--cyan-ink); }

.badge {
  display: inline-flex; align-items: center; white-space: nowrap;
  font-size: 11.5px; font-weight: 600; border-radius: 999px; padding: 3px 9px;
  background: var(--good-soft); color: var(--good);
}
.badge.warn { background: var(--soleil-soft); color: #8a5a00; }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.today { background: var(--cyan-soft); color: var(--cyan-ink); }
.pill {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  font-size: 11.5px; font-weight: 600; border-radius: 999px; padding: 3px 9px;
  background: var(--st-soft); color: var(--st-ink);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--st); }

/* Fil d'activité */
.feed { list-style: none; margin: 0; padding: 0; display: grid; }
.feed li { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: start; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.feed li:last-child { border-bottom: 0; }
.feed .dot {
  width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; background: var(--soft); color: var(--muted);
}
.dot.contact { background: var(--cyan-soft); color: var(--cyan-ink); }
.dot.etat { background: #efecfe; color: #5141c4; }
.dot.relance { background: var(--soleil-soft); color: #8a5a00; }
.dot.devis { background: var(--good-soft); color: var(--good); }
.dot.creation { background: var(--soft); color: var(--ink); }
.feed-body { display: grid; min-width: 0; }
.feed .who { border: 0; background: none; padding: 0; text-align: left; font-weight: 600; cursor: pointer; }
.feed .who:hover { color: var(--cyan-ink); }
.feed .what { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; }
.feed time { color: var(--muted-2); font-size: 12px; white-space: nowrap; }

/* Devis */
.devis-list { display: grid; gap: 8px; }
.devis-item { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.devis-item .who { display: grid; flex: 1; min-width: 200px; }
.devis-item .who small { color: var(--muted); }
.devis-amount { font-weight: 700; }

/* ------------------------------ Pipeline (kanban) ------------------------------ */
.counts { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.count {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px;
  font-size: 12.5px; cursor: pointer; box-shadow: var(--shadow);
}
.count strong { font-weight: 700; }
.count.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.dot-mini { width: 8px; height: 8px; border-radius: 50%; background: var(--st, var(--muted-2)); display: inline-block; flex: none; }
.board {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(268px, 1fr);
  gap: 14px; overflow-x: auto; padding-bottom: 12px; scroll-snap-type: x proximity;
}
.board.single { grid-auto-columns: minmax(268px, 520px); }
.column {
  background: #eceff4; border-radius: var(--radius); padding: 12px; min-height: 240px;
  display: flex; flex-direction: column; gap: 10px; scroll-snap-align: start;
  border: 1px solid transparent; transition: background .15s, border-color .15s;
}
.column.drop { background: var(--cyan-soft); border-color: var(--cyan); }
.column > header { padding: 2px 4px 6px; border-bottom: 2px solid var(--st); }
.col-title { display: flex; align-items: center; gap: 8px; }
.col-title h2 { font-size: 14px; font-weight: 600; }
.col-count { margin-left: auto; font: 600 12px var(--mono); background: #fff; border-radius: 999px; padding: 1px 8px; color: var(--muted); }
.col-sums { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.col-sums strong { color: var(--ink); }
.cards { display: grid; gap: 10px; align-content: start; }
.card {
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 13px;
  box-shadow: 0 1px 2px rgba(28,35,49,.05); cursor: pointer; display: grid; gap: 6px;
  transition: box-shadow .15s, transform .15s;
}
.card:hover { box-shadow: 0 8px 22px rgba(28,35,49,.1); transform: translateY(-1px); }
.card.dragging { opacity: .5; }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.card h3 { font: 600 14px/1.3 var(--sans); }
.card .val { font-weight: 700; font-size: 13px; white-space: nowrap; }
.card .ville { margin: 0; color: var(--muted); font-size: 12px; }
.card .souci { margin: 0; font-size: 12.5px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.proba { display: flex; align-items: center; gap: 8px; }
.proba-bar { flex: 1; height: 5px; background: var(--line); border-radius: 5px; overflow: hidden; min-width: 40px; }
.proba-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--cyan), #00a6d6); border-radius: 5px; }
.proba-txt { font: 600 11.5px var(--mono); color: var(--muted); min-width: 36px; text-align: right; }
.proba-txt.manual { color: var(--cyan-ink); }
.proba-txt.manual::after { content: "*"; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 6px; border-top: 1px dashed var(--line); }
.chip { font-size: 11.5px; font-weight: 600; color: var(--muted); background: var(--soft); border-radius: 6px; padding: 2px 7px; }
.chip.danger { background: var(--danger-soft); color: var(--danger); }
.chip.today { background: var(--cyan-soft); color: var(--cyan-ink); }
.card-actions { display: flex; gap: 10px; margin-left: auto; }
.column .empty { color: var(--muted-2); font-size: 12.5px; text-align: center; margin: 20px 0; }

/* ------------------------------ Liste ------------------------------ */
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  position: sticky; top: 0; background: var(--soft); text-align: left; font-weight: 600; color: var(--muted);
  font-size: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; white-space: nowrap; user-select: none;
}
.table th.sorted { color: var(--ink); }
.table th.sorted::after { content: " ↑"; }
.table th.sorted.desc::after { content: " ↓"; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.table tr:hover td { background: #fafbfd; }
.t-name { min-width: 200px; }
.t-name small { display: block; color: var(--muted); font-size: 12px; }
.num { white-space: nowrap; }
.table .proba { min-width: 110px; }
.row-etat {
  border: 1px solid transparent; background: var(--st-soft); color: var(--st-ink);
  border-radius: 999px; padding: 4px 8px; font-weight: 600; font-size: 12px; cursor: pointer;
}
.co { font-size: 12px; color: var(--muted); }
.td-actions { white-space: nowrap; }
.td-actions .text-btn { margin-right: 10px; }

/* ------------------------------ Fiche (dialogue) ------------------------------ */
dialog {
  border: 0; padding: 0; border-radius: 20px; width: min(1120px, calc(100vw - 32px));
  max-height: calc(100vh - 32px); box-shadow: var(--shadow-lg); background: var(--bg); color: var(--ink);
}
dialog::backdrop { background: rgba(14, 18, 26, .55); backdrop-filter: blur(3px); }
dialog form { display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
.deal-head {
  background: radial-gradient(600px 200px at 100% 0%, rgba(0,212,255,.22), transparent 70%), var(--ink);
  color: #fff; padding: 0 24px 16px;
}
.deal-head .gwenn-ha-du { margin: 0 -24px 14px; }
.deal-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.deal-id .eyebrow { color: #9aa5b9; }
.deal-id h2 { font-size: 24px; font-weight: 700; }
.deal-figures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
.fig { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); border-radius: 12px; padding: 9px 12px; display: grid; min-width: 0; }
.fig-label { font-size: 11.5px; color: #9aa5b9; }
.fig-value { font: 600 16px/1.3 var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fig.accent .fig-value { color: var(--cyan); }
.fig.bad .fig-value { color: #ff8a8d; }
.stepper { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; }
.step { flex: 1; min-width: 0; }
.step button {
  width: 100%; border: 0; cursor: pointer; padding: 7px 8px; font-size: 11.5px; font-weight: 600;
  background: rgba(255,255,255,.08); color: #aeb8ca; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 0 100%, 8px 50%);
}
.step:first-child button { clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 0 100%); border-radius: 8px 0 0 8px; }
.step.done button { background: rgba(0,212,255,.28); color: #e6fbff; }
.step.current button { background: var(--cyan); color: #06222b; }
.step.lost { flex: 0 0 auto; margin-left: 8px; }
.step.lost button { clip-path: none; border-radius: 8px; padding: 7px 12px; }
.step.lost.current button { background: var(--danger); color: #fff; }
.step button:hover { filter: brightness(1.15); }

.dialog-tabs { display: none; gap: 4px; padding: 10px 16px 0; background: var(--bg); }
.dialog-tab {
  flex: 1; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px; font-weight: 600; cursor: pointer; color: var(--muted);
}
.dialog-tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.deal-body { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; padding: 16px 20px; overflow: auto; flex: 1; }
.tab-body { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.fields label { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.fields .wide, .proba-field { grid-column: 1 / -1; }
.fields input, .fields select, .fields textarea {
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #fff; color: var(--ink); font-weight: 400; font-size: 13.5px; width: 100%;
}
.fields textarea { resize: vertical; min-height: 110px; line-height: 1.5; font-family: var(--sans); }
.fields input:focus, .fields select:focus, .fields textarea:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px var(--cyan-soft); }
.fields [aria-invalid="true"] { border-color: var(--danger); }
.proba-field {
  display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center;
  background: var(--soft); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
}
.proba-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.proba-label b { color: var(--ink); font: 700 15px var(--display); margin-left: 6px; }
.proba-field input[type="range"] {
  grid-column: 1 / -1; width: 100%; padding: 0; border: 0; appearance: none; height: 6px; border-radius: 6px;
  background: linear-gradient(90deg, var(--cyan) var(--pct, 0%), var(--line) var(--pct, 0%)); box-shadow: none;
}
.proba-field input[type="range"]::-webkit-slider-thumb { appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 3px solid var(--cyan); cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.proba-field input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid var(--cyan); cursor: pointer; }
.proba-hint { font-size: 12px; color: var(--muted); }
.proba-field .text-btn { justify-self: end; }

/* Chronologie */
.timeline-pane { display: flex; flex-direction: column; gap: 12px; }
.pane-head { display: flex; align-items: baseline; justify-content: space-between; }
.pane-head h3 { font-size: 16px; }
.add-note { display: flex; gap: 8px; }
.add-note input { flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.add-note input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px var(--cyan-soft); }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.tl-infos { background: var(--soleil-soft); border-radius: 12px; padding: 10px 12px; font-size: 12.5px; color: #5b4300; }
.tl-infos p { margin: 4px 0 0; }
.tl-infos-title { font: 600 10.5px var(--mono); text-transform: uppercase; letter-spacing: .1em; }
.tl-date { margin: 0 0 6px; font: 600 11px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.tl-items { list-style: none; margin: 0; padding: 0 0 0 13px; border-left: 2px solid var(--line); display: grid; gap: 8px; }
.tl-item { display: grid; grid-template-columns: 28px 1fr; gap: 10px; margin-left: -28px; }
.tl-icon {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12.5px; font-weight: 700; background: #fff; border: 2px solid var(--line); color: var(--muted);
}
.tl-body { background: var(--soft); border: 1px solid var(--line-2); border-radius: 12px; padding: 8px 11px; min-width: 0; }
.tl-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
.tl-head time, .tl-src { color: var(--muted-2); font-size: 11.5px; }
.tl-head time { margin-left: auto; }
.tl-src { font-family: var(--mono); }
.tl-tag { font-size: 11px; font-weight: 600; border-radius: 999px; padding: 1px 8px; background: var(--cyan-soft); color: var(--cyan-ink); }
.tl-tag.first { background: var(--ink); color: #fff; }
.tl-text { margin: 3px 0 0; font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }
.tl-item.journal .tl-body { background: #fff; border-style: dashed; }
.tl-item.journal .tl-text { color: var(--muted); font-size: 12.5px; }
.k-email .tl-icon { border-color: #5ab8e8; color: #1f6f99; }
.k-appel .tl-icon { border-color: var(--cyan); color: var(--cyan-ink); }
.k-visite .tl-icon { border-color: #1c2331; color: #1c2331; }
.k-relance .tl-icon, .k-prevu .tl-icon { border-color: var(--soleil); color: #8a5a00; }
.k-reponse .tl-icon { border-color: #8b7cf6; color: #5141c4; }
.k-devis .tl-icon { border-color: var(--good); color: var(--good); }
.k-rdv .tl-icon { border-color: #00c2e8; background: var(--cyan-soft); color: var(--cyan-ink); }
.k-gagne .tl-icon { background: var(--good); border-color: var(--good); color: #fff; }
.k-perdu .tl-icon { background: var(--danger); border-color: var(--danger); color: #fff; }
.k-etat .tl-icon { border-color: #8b7cf6; color: #5141c4; }
.tl-item.futur .tl-body { background: var(--soleil-soft); border-color: #f5dc94; }
.tl-item.overdue .tl-body { background: var(--danger-soft); border-color: #f5c8ca; }
.tl-item.overdue .tl-tag { background: #fff; color: var(--danger); }

.dialog-actions { display: flex; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); background: #fff; }
.spacer { flex: 1; }

/* Notifications */
.toasts { position: fixed; bottom: 20px; right: 20px; display: grid; gap: 8px; z-index: 60; }
.toast { background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 13px; border-left: 3px solid var(--cyan); }
.toast.err { border-left-color: var(--danger); }

.bottom-nav { display: none; }

/* ------------------------------ Adaptatif ------------------------------ */
@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .kpi.hero { grid-column: span 3; }
  .stages { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .span-4, .span-5, .span-7 { grid-column: span 12; }
  .deal-body { grid-template-columns: 1fr; }
  .dialog-tabs { display: flex; }
  dialog form[data-tab="fiche"] #tab-historique,
  dialog form[data-tab="historique"] #tab-fiche { display: none; }
  .relances-full { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  :root { --sidebar: 0px; }
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { padding: 10px 14px; gap: 10px; flex-wrap: wrap; }
  .mobile-brand { display: flex; align-items: center; gap: 8px; font: 700 16px var(--display); }
  .mobile-brand img { border-radius: 6px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .search-kbd { display: none; }
  .hide-sm { display: none; }
  main { padding: 4px 14px 96px; }
  .page-head h1 { font-size: 23px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi.hero { grid-column: span 2; }
  .kpi { padding: 13px 14px; }
  .kpi-value { font-size: 21px; }
  .kpi.hero .kpi-value { font-size: 28px; }
  .stages { grid-template-columns: repeat(7, 132px); overflow-x: auto; padding-bottom: 4px; scroll-snap-type: x proximity; }
  .stage { scroll-snap-align: start; }
  .panel { padding: 14px; }
  .board { grid-auto-columns: 84vw; }
  .relance-item { grid-template-columns: minmax(0, 1fr) auto; }
  .relance-item .relance-actions { grid-column: 1 / -1; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(4, 1fr);
    position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom));
    background: var(--ink); border-radius: 16px; padding: 6px; z-index: 25; box-shadow: var(--shadow-lg);
  }
  .bottom-nav .tab {
    position: relative; text-align: center; color: #aeb8ca; text-decoration: none; font-size: 12px; font-weight: 600;
    padding: 9px 4px; border-radius: 11px;
  }
  .bottom-nav .tab.active { background: rgba(0,212,255,.16); color: #fff; }
  .bottom-nav .tab-badge { position: absolute; top: 2px; right: 8px; min-width: 17px; height: 17px; line-height: 17px; font-size: 10px; }
  dialog { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; margin: 0; }
  dialog form { max-height: 100dvh; height: 100dvh; }
  .deal-head { padding: 0 16px 12px; }
  .deal-head .gwenn-ha-du { margin: 0 -16px 12px; }
  .deal-id h2 { font-size: 20px; }
  .deal-figures { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 10px 0; }
  .stepper { overflow-x: auto; }
  .step { flex: 0 0 auto; }
  .step button { padding: 6px 12px 6px 14px; }
  .deal-body { padding: 12px; }
  .fields { grid-template-columns: 1fr; }
  .dialog-actions { padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
  .toasts { left: 14px; right: 14px; bottom: 84px; }
}
@media (max-width: 420px) {
  .hide-xs { display: none; }
  .btn.accent { width: 40px; height: 40px; padding: 0; font-size: 20px; border-radius: 12px; }
}
