:root {
  /* Charte bleue (palette Adobe) : bleu roi + bleus foncés. */
  --brand: #163ab8;         /* bleu roi — accent principal */
  --brand-2: #2a3e85;       /* indigo — dégradés / hover */
  --brand-3: #2a3352;       /* bleu ardoise */
  --brand-soft: #e9edfb;    /* fond doux (nav active, badges) */
  --brand-tint: #f2f5fd;    /* survol léger */
  /* Alias conservés pour compatibilité (le reste de la feuille les utilise). */
  --pink: var(--brand);
  --pink-600: var(--brand-2);
  --pink-soft: var(--brand-soft);
  --pink-tint: var(--brand-tint);
  --header: #252833;        /* header foncé */
  --header-line: #363b47;
  --ink: #252833;
  --ink-soft: #3a3f4d;
  --muted: #6b7280;
  --line: #e6e8ee;
  --bg: #f5f6f9;
  --bg-grad: radial-gradient(1200px 500px at 100% -10%, #e7ecfa 0%, rgba(231,236,250,0) 60%), #f5f6f9;
  --card: #ffffff;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 1px 2px rgba(37,40,51,.05), 0 6px 20px rgba(37,40,51,.07);
  --shadow-lift: 0 10px 34px rgba(22,58,184,.18);
  --ring: 0 0 0 3px rgba(22,58,184,.2);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg-grad);
  background-attachment: fixed;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--pink); text-decoration: none; }
h2 { font-size: 1.45rem; letter-spacing: -.02em; margin: 1.1rem 0 .6rem; }
h3 { font-size: 1.05rem; letter-spacing: -.01em; margin: 1.6rem 0 .5rem; }
.muted { color: var(--muted); }
.hint { font-size: .85rem; margin-top: -.2rem; }

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: .75rem;
  padding: .7rem 1rem;
  background: linear-gradient(180deg, #2a3352, #252833);
  border-bottom: 1px solid var(--header-line);
}
.brand {
  font-weight: 800; font-size: 1.15rem; letter-spacing: -.02em;
  background: linear-gradient(90deg, #6f8cff, #cdd8ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.topbar nav { display: flex; gap: .3rem; margin-left: auto; font-size: .88rem;
  overflow-x: auto; }
.topbar nav a { color: #c3c9d6; padding: .35rem .6rem; border-radius: 999px;
  white-space: nowrap; font-weight: 500; transition: background .15s, color .15s; }
.topbar nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.topbar nav a.on { color: #fff; background: var(--brand); font-weight: 700; }
.topbar nav a.muted { color: #9aa2b1; }

main { padding: 1.1rem 1rem 3rem; max-width: 1120px; margin: 0 auto; }

/* Cards */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.1rem; margin: .6rem 0;
  box-shadow: var(--shadow);
}
.badge {
  display: inline-block; min-width: 1.5em; padding: .05em .5em;
  background: var(--pink-soft); color: var(--pink); border-radius: 999px;
  font-size: .78rem; font-weight: 800; text-align: center; vertical-align: middle;
}
.chip {
  display: inline-block; padding: .12rem .55rem; border-radius: 999px;
  background: #f1f1f4; color: var(--ink-soft); font-size: .73rem; font-weight: 700;
  letter-spacing: .01em;
}

/* Login */
.centered { display: grid; place-items: center; min-height: 100vh; padding: 1rem; }
.login { width: 100%; max-width: 340px; text-align: center; box-shadow: var(--shadow-lift); }
.login h1 {
  margin: 0; font-size: 1.8rem;
  background: linear-gradient(90deg, var(--brand), #4f7cff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.login input, .login button { width: 100%; margin-top: .7rem; }
.error { color: var(--danger); font-size: .9rem; }

input, select, button, textarea {
  font: inherit; padding: .65rem .8rem; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--pink);
  box-shadow: var(--ring); }
button {
  background: linear-gradient(180deg, var(--pink), var(--pink-600));
  color: #fff; border: none; font-weight: 700; cursor: pointer;
  box-shadow: 0 2px 8px rgba(22,58,184,.28);
}
button:hover { filter: brightness(1.03); }
button:active { transform: translateY(1px); }
button[disabled] { opacity: .45; box-shadow: none; cursor: not-allowed; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: .7rem; }
.kpi {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .95rem 1rem; display: flex; flex-direction: column; gap: .15rem;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(180deg, var(--brand), #4f7cff); }
.kpi .num { font-size: 1.7rem; font-weight: 800; letter-spacing: -.03em; color: var(--ink); }
.kpi .lbl { font-size: .78rem; color: var(--muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em; }

/* Lists */
.list { list-style: none; padding: 0; margin: .6rem 0; }
.list li {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-sm); margin-bottom: .5rem; box-shadow: var(--shadow);
  transition: transform .12s, box-shadow .12s;
}
.list li:hover { transform: translateY(-1px); box-shadow: var(--shadow-lift); }
.list li a, .list li { display: block; padding: .8rem .9rem; }
.list .meta { display: block; color: var(--muted); font-size: .82rem; margin-top: .2rem; }
.list strong { color: var(--ink); }
.list .amount { color: var(--pink); font-weight: 800; margin-left: .3rem; }

/* Alerts */
.alerts { list-style: none; padding: 0; }
.alert { border-left: 4px solid var(--line); border-radius: var(--radius-sm);
  background: var(--card); margin-bottom: .5rem; box-shadow: var(--shadow);
  transition: transform .12s; }
.alert:hover { transform: translateX(2px); }
.alert a { display: block; padding: .8rem .9rem; color: var(--ink); }
.alert.sev-haute { border-left-color: var(--danger); }
.alert.sev-moyenne { border-left-color: var(--warn); }
.alert.sev-basse { border-left-color: var(--muted); }

/* Search */
.search { display: flex; gap: .5rem; margin: .6rem 0; }
.search input { flex: 1; }

/* Fiche */
.fiche { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.fiche .full { grid-column: 1 / -1; }
.fiche .lbl, .lbl { display: block; font-size: .7rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em; font-weight: 700; margin-bottom: .1rem; }

/* Timeline */
.timeline { list-style: none; padding: 0; }
.timeline li { display: flex; justify-content: space-between; align-items: center;
  padding: .6rem .3rem; border-bottom: 1px solid var(--line); color: var(--muted); }
.timeline li:last-child { border-bottom: none; }
.timeline li.done { color: var(--ink); }
.timeline li.done .tl-label::before { content: "✓"; display: inline-grid; place-items: center;
  width: 1.25em; height: 1.25em; margin-right: .5em; border-radius: 999px;
  background: var(--ok); color: #fff; font-size: .7em; font-weight: 900; vertical-align: middle; }
.timeline li:not(.done) .tl-label::before { content: ""; display: inline-block;
  width: 1.25em; height: 1.25em; margin-right: .5em; border-radius: 999px;
  border: 2px dashed #d4d4d8; vertical-align: middle; }

/* Actions */
.actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: .6rem 0; }
.actions form.inline { display: flex; gap: .4rem; }
.billit { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .7rem 0; }
.billit button { background: linear-gradient(180deg, #2b2b30, #18181b);
  box-shadow: 0 2px 8px rgba(24,24,27,.2); }
.payform { display: flex; flex-wrap: wrap; gap: .45rem; margin: .6rem 0; }
.payform input { flex: 1 1 8rem; }
.payform button { flex: 1 1 100%; }

.back { font-size: .9rem; font-weight: 600; }
.editlink { font-size: .9rem; font-weight: 700; }
pre.err, pre.err.full { white-space: pre-wrap; background: #fff0f0; padding: .7rem;
  border-radius: var(--radius-sm); color: var(--danger); font-size: .8rem; }

/* Edit form */
.editform .field { display: block; margin-bottom: .8rem; }
.editform .field .lbl { margin-bottom: .25rem; }
.editform input[type=text], .editform textarea, .editform select { width: 100%; }
.editform input[readonly] { background: #f4f4f7; color: var(--muted); }

/* Kanban */
.board { display: flex; gap: .8rem; overflow-x: auto; padding: .2rem .2rem 1.2rem;
  -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; }
.board::-webkit-scrollbar { height: 8px; }
.board::-webkit-scrollbar-thumb { background: #d8d8de; border-radius: 8px; }
.col { flex: 0 0 80vw; max-width: 290px; scroll-snap-align: start; }
.col-head { margin: 0 0 .5rem; font-size: .82rem; text-transform: capitalize; font-weight: 800;
  display: flex; justify-content: space-between; align-items: center;
  padding: .5rem .7rem; border-radius: var(--radius-sm);
  background: var(--pink-soft); color: var(--pink); letter-spacing: .01em; }
.col-head .count { background: #fff; color: var(--pink); border-radius: 999px;
  padding: .05em .5em; font-size: .74rem; }
.col-body { min-height: 70px; display: flex; flex-direction: column; gap: .5rem;
  padding: .35rem; border-radius: var(--radius-sm); background: rgba(0,0,0,.025);
  border: 1px dashed transparent; transition: background .15s, border-color .15s; }
.col-body:empty::after { content: "Déposer ici"; display: block; text-align: center;
  color: #c4c4cc; font-size: .8rem; padding: 1rem 0; }
.deal-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: .7rem .75rem; box-shadow: var(--shadow); border-left: 3px solid var(--pink);
  cursor: grab; transition: box-shadow .12s, transform .12s; }
.deal-card:hover { box-shadow: var(--shadow-lift); }
.deal-card:active { cursor: grabbing; }
.deal-card .card-link { display: flex; flex-direction: column; gap: .12rem; color: var(--ink); }
.deal-card .model { font-size: .86rem; color: var(--ink-soft); }
.deal-card .amount { font-size: .82rem; color: var(--pink); font-weight: 800; }
.deal-card .did { font-size: .68rem; color: var(--muted); letter-spacing: .03em; }
.sortable-ghost { opacity: .35; }
.sortable-chosen { box-shadow: var(--shadow-lift); transform: scale(1.02); }

/* Status accent colors (chips + kanban headers) */
.st-nouveau    { background:#eef2ff; color:#4f46e5; }
.st-whatsapp   { background:#e7f8ee; color:#15803d; }
.st-qualifié   { background:#e0f2fe; color:#0369a1; }
.st-démo       { background:#f3e8ff; color:#7e22ce; }
.st-devis_envoyé{ background:#fff7ed; color:#c2410c; }
.st-gagné      { background:#fef9c3; color:#a16207; }
.st-commandé   { background:#ecfeff; color:#0e7490; }
.st-vin_reçu   { background:#e0e7ff; color:#4338ca; }
.st-e705_validé{ background:#dcfce7; color:#15803d; }
.st-coc_reçu   { background:#cffafe; color:#0e7490; }
.st-livré      { background:#dbeafe; color:#1d4ed8; }
.st-facturé    { background:#ede9fe; color:#6d28d9; }
.st-payé       { background:#dcfce7; color:#166534; }
.st-perdu      { background:#fee2e2; color:#b91c1c; }

@media (min-width: 720px) {
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .col { flex: 0 0 250px; }
}

/* Pipeline : bascule Kanban / Liste */
.pipe-head { display:flex; align-items:center; justify-content:space-between; gap:.5rem; flex-wrap:wrap; }
.view-toggle { display:inline-flex; border:1px solid #e5e7eb; border-radius:8px; overflow:hidden; }
.view-toggle a { padding:.35rem .7rem; font-size:.9rem; color:#4b5563; text-decoration:none; background:#fff; }
.view-toggle a.on { background:var(--brand); color:#fff; }

/* Pipeline : vue liste */
.table-wrap { overflow-x:auto; -webkit-overflow-scrolling:touch; }
table.pipe-list { width:100%; border-collapse:collapse; font-size:.9rem; }
table.pipe-list th, table.pipe-list td { padding:.5rem .6rem; text-align:left; border-bottom:1px solid #eef0f3; white-space:nowrap; }
table.pipe-list th { color:#6b7280; font-weight:600; font-size:.78rem; text-transform:uppercase; letter-spacing:.02em; }
table.pipe-list td.num, table.pipe-list th.num { text-align:right; }
table.pipe-list td.prochaine { white-space:normal; min-width:160px; color:#4b5563; }
table.pipe-list tbody tr:hover { background:#fafafe; }
.inline-status { margin:0; }
.inline-status select { border:none; border-radius:6px; padding:.3rem .5rem; font-size:.82rem; font-weight:600; cursor:pointer; }

/* Metrics : graphiques en barres CSS (sans dépendance) */
.chart { display:flex; align-items:flex-end; gap:.6rem; overflow-x:auto; padding:.5rem 0 0;
  min-height:210px; -webkit-overflow-scrolling:touch; }
.bar-col { display:flex; flex-direction:column; align-items:center; justify-content:flex-end;
  flex:1 0 60px; min-width:60px; text-align:center; }
.bar-val { font-size:.72rem; color:#4b5563; margin-bottom:.25rem; white-space:nowrap; }
.bar { width:60%; max-width:48px; min-height:3px; border-radius:6px 6px 0 0;
  background:linear-gradient(180deg,#3a5bd0,var(--brand)); }
.bar-marge { background:linear-gradient(180deg,var(--brand-2),var(--brand-3)); }
.bar-x { font-size:.78rem; font-weight:600; margin-top:.4rem; }
.bar-sub { font-size:.7rem; color:#9ca3af; }

/* Bouton supprimer (pièces, articles) */
.del-form { display:inline; margin:0 0 0 .4rem; }
.del { border:none; background:transparent; color:#c0392b; font-size:.95rem; cursor:pointer;
  padding:.1rem .35rem; border-radius:6px; line-height:1; }
.del:hover { background:#fee2e2; }

/* Bouton « Nouveau client » */
.btn-new { background:var(--brand); color:#fff; text-decoration:none; padding:.45rem .8rem;
  border-radius:8px; font-size:.9rem; font-weight:600; white-space:nowrap; }
.btn-new:hover { background:var(--brand-2); }
