/* Maison AG CRM — thème sombre sobre (noir et gris), couleurs d'état en accents seulement */
:root {
  --bg: #0b0b0c;
  --surface: #151517;
  --surface-2: #1b1b1e;
  --surface-3: #232327;
  --line: #26262a;
  --line-2: #34343a;
  --ink: #ecebe8;
  --ink-2: #b6b6bc;
  --muted: #7f7f87;
  --bad: #ef5a50;
  --bad-soft: rgba(239, 90, 80, .13);
  --bad-line: rgba(239, 90, 80, .45);
  --good: #ecebe8;
  --good-soft: rgba(236, 235, 232, .1);
  --warn: #d6a650;
  --warn-soft: rgba(214, 166, 80, .12);
  --series-1: #b4b4bb;
  --series-2: #ecebe8;
  --hatch: #57575f;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 0 rgba(255,255,255,.02) inset, 0 8px 24px rgba(0,0,0,.25);
  --shadow-lg: 0 18px 50px rgba(0,0,0,.55);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --tap: 44px;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 600; }
h1 { font-size: 1.45rem; letter-spacing: -.015em; }
h2 { font-size: 1rem; letter-spacing: -.005em; }
h3 { font-size: .92rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
::selection { background: #3a3a40; }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar { background: #08080a; border-right: 1px solid var(--line); padding: 22px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 2px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 22px; font-weight: 600; letter-spacing: .01em; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--surface-3); display: grid; place-items: center; border: 1px solid var(--line-2); }
.brand small { display: block; font-weight: 400; color: var(--muted); font-size: .74rem; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 9px; text-decoration: none; color: var(--ink-2); font-size: .92rem; }
.nav a:hover { background: var(--surface); color: var(--ink); }
.nav a.active { background: var(--surface-3); color: var(--ink); }
.nav a .count { margin-left: auto; background: var(--bad); color: #fff; border-radius: 999px; font-size: .7rem; padding: 1px 7px; font-weight: 600; }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.sidebar .spacer { flex: 1; }
.sidebar .logout { background: none; border: 1px solid var(--line-2); color: var(--ink-2); border-radius: 9px; padding: 9px; cursor: pointer; }
.sidebar .logout:hover { color: var(--ink); border-color: #45454c; }
.main { min-width: 0; padding: 26px 30px 56px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.mobile-top, .tabbar, .only-mobile { display: none; }

/* ---------- Composants ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card-pad { padding: 18px 20px; }
.card h2 { margin-bottom: 12px; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { padding: 15px 16px; }
.kpi .label { color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 600; }
.kpi .value { font-size: 1.6rem; font-weight: 600; margin-top: 6px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi .sub { color: var(--muted); font-size: .8rem; margin-top: 3px; }
.kpi.alert .value { color: var(--bad); }
a.kpi { text-decoration: none; color: inherit; display: block; }
a.kpi:hover { border-color: var(--line-2); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line-2); background: var(--surface-2); padding: 8px 14px; border-radius: var(--radius-sm); cursor: pointer; font-weight: 500; font-size: .9rem; text-decoration: none; white-space: nowrap; min-height: 38px; color: var(--ink); }
.btn:hover { background: var(--surface-3); border-color: #45454c; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #0b0b0c; font-weight: 600; }
.btn-primary:hover { background: #fff; border-color: #fff; }
.btn-dark { background: var(--surface-3); border-color: #3c3c42; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-danger { color: var(--bad); }
.btn-sm { padding: 5px 10px; min-height: 32px; font-size: .84rem; }
.btn[disabled] { opacity: .5; cursor: wait; }

label.field { display: flex; flex-direction: column; gap: 5px; font-size: .8rem; color: var(--ink-2); font-weight: 500; }
input[type=text], input[type=email], input[type=url], input[type=number], input[type=date], input[type=password], input[type=search], select, textarea {
  border: 1px solid var(--line-2); background: #101012; border-radius: var(--radius-sm); padding: 8px 11px; min-height: 40px; font-size: .93rem; width: 100%; font-weight: 400; color: var(--ink);
}
input::placeholder, textarea::placeholder { color: #5d5d64; }
input[type=date] { color-scheme: dark; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
textarea { min-height: 80px; resize: vertical; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--ink); }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid #8a8a92; outline-offset: 1px; border-color: #8a8a92; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 12px; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: .72rem; font-weight: 600; background: var(--surface-3); color: var(--ink-2); white-space: nowrap; border: 1px solid transparent; }
.badge.bad { background: var(--bad-soft); color: #ff8a80; border-color: var(--bad-line); }
.badge.due { background: transparent; color: #ff8a80; border-color: var(--bad-line); }
.badge.good { background: var(--good-soft); color: var(--ink); }
.badge.warn { background: var(--warn-soft); color: #e5c07b; }
.badge.reply { background: var(--ink); color: #0b0b0c; }
.badge.outline { background: transparent; border-color: var(--line-2); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

.table { width: 100%; border-collapse: collapse; font-size: .89rem; }
.table th { text-align: left; color: var(--muted); font-weight: 600; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-2); }
.table tr.faint td { color: var(--muted); }
.table-wrap { overflow-x: auto; }

.empty { padding: 26px; text-align: center; color: var(--muted); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list a.title { font-weight: 600; text-decoration: none; }
.list a.title:hover { text-decoration: underline; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link { color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; }

/* Sections repliables */
details.fold { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
details.fold > summary { list-style: none; cursor: pointer; padding: 16px 20px; display: flex; align-items: center; gap: 10px; font-weight: 600; min-height: var(--tap); }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; }
details.fold[open] > summary::after { transform: rotate(-135deg); }
details.fold > summary .meta { color: var(--muted); font-weight: 400; font-size: .84rem; }
details.fold > .fold-body { padding: 0 20px 18px; }

/* ---------- Kanban (bureau) ---------- */
.kanban-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.kanban-toolbar input[type=search] { max-width: 260px; }
.kanban-toolbar select { width: auto; }
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(248px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.column { background: #111113; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-height: 200px; display: flex; flex-direction: column; gap: 8px; transition: border-color .12s, background .12s; }
.column.drag-over { border-color: #6a6a72; background: #18181b; }
.column-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px 6px; }
.column-head h3 { font-size: .85rem; font-weight: 600; }
.column-head .count { color: var(--muted); font-size: .8rem; }
.column-head .total { margin-left: auto; color: var(--muted); font-size: .78rem; font-variant-numeric: tabular-nums; }
.column-body { display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.column .more { color: var(--muted); font-size: .82rem; text-align: center; padding: 6px; text-decoration: none; }
.column .more:hover { color: var(--ink); }
.pcard { background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; cursor: grab; position: relative; }
.pcard:hover { border-color: var(--line-2); background: #1f1f23; }
.pcard.dragging { opacity: .4; }
.pcard.overdue, .pcard.due { box-shadow: inset 3px 0 0 var(--bad); }
.pcard.reply { box-shadow: inset 3px 0 0 var(--ink); }
.pcard .company { font-weight: 600; font-size: .92rem; display: block; text-decoration: none; padding-right: 26px; }
.pcard .meta { color: var(--muted); font-size: .79rem; margin-top: 2px; }
.pcard .foot { display: flex; align-items: center; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.pcard .value { margin-left: auto; font-size: .8rem; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.pcard .move { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 6px; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.pcard .move:hover { background: var(--surface-3); }
.pcard select.move-select { position: absolute; inset: 6px 6px auto auto; width: 26px; height: 26px; min-height: 0; opacity: 0; cursor: pointer; padding: 0; }

/* ---------- Liste compacte (mobile) ---------- */
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 10px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); padding: 0 14px; min-height: 40px; border-radius: 999px; font-size: .88rem; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; }
.chip .n { color: var(--muted); font-variant-numeric: tabular-nums; }
.chip.active { background: var(--ink); color: #0b0b0c; border-color: var(--ink); }
.chip.active .n { color: #55555c; }
.chip.alert .n { color: var(--bad); font-weight: 700; }
.chip.active.alert .n { color: #c0392b; }
.mlist { display: flex; flex-direction: column; gap: 8px; }
.mcard { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; min-height: 60px; text-decoration: none; }
.mcard:active { background: var(--surface-2); }
.mcard.overdue, .mcard.due { box-shadow: inset 3px 0 0 var(--bad); }
.mcard.reply { box-shadow: inset 3px 0 0 var(--ink); }
.mcard .body { flex: 1; min-width: 0; }
.mcard .name { font-weight: 600; font-size: .98rem; }
.mcard .sub { color: var(--muted); font-size: .82rem; margin-top: 1px; }
.mcard .chev { color: #4d4d54; flex: none; }

/* ---------- Fiche prospect ---------- */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 14px; align-items: start; }
.detail-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.detail-head .title { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.stage-select { font-weight: 600; max-width: 220px; }
.quick-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.qualify { margin-bottom: 14px; }
.qualify .row { gap: 6px; }
.qualify button.on { background: var(--ink); color: #0b0b0c; border-color: var(--ink); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 30px 1fr; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline .icon { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); font-size: .85rem; color: var(--ink-2); }
.timeline .icon.email_in { background: var(--ink); color: #0b0b0c; }
.timeline .head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.timeline .head strong { font-size: .88rem; }
.timeline .body { white-space: pre-wrap; color: var(--ink-2); font-size: .86rem; margin-top: 4px; max-height: 160px; overflow: auto; }
.tabs { display: flex; gap: 4px; margin-bottom: 10px; flex-wrap: wrap; }
.tabs button { border: 1px solid var(--line-2); background: transparent; color: var(--ink-2); padding: 5px 11px; border-radius: 999px; font-size: .83rem; cursor: pointer; min-height: 34px; }
.tabs button.active { background: var(--ink); color: #0b0b0c; border-color: var(--ink); }
.info-strip { display: flex; gap: 14px; flex-wrap: wrap; font-size: .85rem; color: var(--ink-2); }
.info-strip b { color: var(--ink); font-weight: 600; }
.seq { display: flex; gap: 4px; align-items: center; }
.seq span { width: 22px; height: 4px; border-radius: 3px; background: var(--line-2); }
.seq span.on { background: var(--ink-2); }

/* ---------- Audit ---------- */
.audit-score { display: flex; align-items: center; gap: 16px; }
.gauge { width: 80px; height: 80px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 1.35rem; flex: none; }
.gauge span { background: var(--surface); width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center; }
.checks { list-style: none; padding: 0; margin: 12px 0 0; }
.checks li { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .87rem; }
.checks li:last-child { border-bottom: 0; }
.checks .arg { color: var(--ink-2); font-size: .82rem; margin-top: 2px; }
.ok-ico { color: var(--good); font-weight: 700; }
.ko-ico { color: var(--bad); font-weight: 700; }

/* ---------- Projets ---------- */
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.project { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.project .top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.progress { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > div { height: 100%; background: #ecebe8; border-radius: 999px; }
.steps { display: flex; gap: 3px; }
.steps span { flex: 1; height: 4px; border-radius: 3px; background: var(--surface-3); }
.steps span.on { background: var(--ink-2); }
.payments { font-size: .84rem; color: var(--ink-2); }
.payments div { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 2px 0; }

/* ---------- Graphiques ---------- */
.chart { width: 100%; position: relative; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .axis-label { fill: var(--muted); font-size: 11px; }
.chart .hit:hover { fill: rgba(255,255,255,.03); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--ink-2); margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.tooltip { position: absolute; pointer-events: none; background: #f2f1ee; color: #111; font-size: .8rem; padding: 6px 9px; border-radius: 7px; white-space: nowrap; transform: translate(-50%, -110%); z-index: 5; box-shadow: var(--shadow-lg); }
.hbar-row { display: grid; grid-template-columns: 160px 1fr 70px; gap: 10px; align-items: center; font-size: .86rem; padding: 4px 0; }
.hbar { height: 22px; background: var(--surface-3); border-radius: 6px; overflow: hidden; position: relative; }
.hbar > div { height: 100%; background: #8e8e96; border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar > div.light, .hbar > div.good { background: #ecebe8; }
.hbar > div.hatch, .hbar > div.bad { background: var(--hatch); }
.hbar > div.light + span { color: #111; text-shadow: none; }
.hbar > span { position: absolute; left: 8px; top: 2px; font-size: .77rem; font-weight: 600; color: var(--ink); mix-blend-mode: normal; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.hbar-row .conv { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
details.table-view summary { cursor: pointer; color: var(--muted); font-size: .8rem; margin-top: 8px; }

/* Benchmarks */
.bench { display: flex; flex-direction: column; gap: 8px; }
.bench .value { font-size: 1.6rem; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.bench .scale { position: relative; height: 8px; border-radius: 999px; background: var(--surface-3); margin-top: 4px; }
.bench .scale .band { position: absolute; top: 0; bottom: 0; background: #3a3a40; border-radius: 999px; }
.bench .scale .mark { position: absolute; top: -4px; width: 3px; height: 16px; border-radius: 2px; background: var(--ink); transform: translateX(-1px); }
.bench .ref { color: var(--muted); font-size: .8rem; }
.verdict { font-size: .78rem; font-weight: 600; }
.verdict.good { color: var(--ink); } .verdict.bad { color: #ff8a80; } .verdict.mid { color: var(--ink-2); }
.cadence { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.cadence li { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.cadence .d { font-size: .74rem; color: var(--muted); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.cadence .l { font-weight: 600; margin: 3px 0; }
.cadence .h { color: var(--ink-2); font-size: .82rem; }

/* ---------- Modale / feuille / toasts ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 50; padding: 16px; backdrop-filter: blur(2px); }
.modal { background: var(--surface); border: 1px solid var(--line-2); border-radius: 16px; width: min(520px, 100%); max-height: 90vh; overflow: auto; padding: 20px; box-shadow: var(--shadow-lg); }
.modal h2 { margin-bottom: 12px; }
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 55; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line-2); border-radius: 18px 18px 0 0; padding: 8px 12px calc(16px + env(safe-area-inset-bottom)); z-index: 56; animation: up .18s ease-out; }
.sheet::before { content: ""; display: block; width: 38px; height: 4px; border-radius: 3px; background: var(--line-2); margin: 4px auto 10px; }
.sheet a, .sheet button { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 54px; padding: 0 10px; border: 0; background: none; text-decoration: none; color: var(--ink); font-size: 1rem; border-radius: 10px; text-align: left; cursor: pointer; }
.sheet a:active, .sheet button:active { background: var(--surface-2); }
.sheet svg { width: 22px; height: 22px; color: var(--ink-2); }
@keyframes up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
#toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: #f2f1ee; color: #111; padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: .9rem; max-width: 360px; animation: pop .18s ease-out; }
.toast.error { background: var(--bad); color: #fff; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(circle at 50% 0%, #1c1c20 0, var(--bg) 60%); }
.login .card { width: min(380px, 100%); padding: 28px; }
.login h1 { margin: 16px 0 4px; }
.error-text { color: #ff8a80; font-size: .86rem; min-height: 1.2em; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82rem; }
pre { background: #0e0e10; border: 1px solid var(--line); color: #d8d8dc; padding: 12px 14px; border-radius: 10px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
code.inline { background: var(--surface-3); padding: 1px 6px; border-radius: 5px; }

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
  html, body { font-size: 16px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar, .only-desktop { display: none !important; }
  .only-mobile { display: block; }
  .main { padding: 14px 16px calc(96px + env(safe-area-inset-bottom)); }
  .mobile-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; background: rgba(11,11,12,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; min-height: 56px; }
  .mobile-top .title { font-weight: 600; font-size: 1.05rem; }
  .mobile-top .add { width: var(--tap); height: var(--tap); border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-size: 1.4rem; line-height: 1; display: grid; place-items: center; cursor: pointer; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; background: rgba(11,11,12,.96); backdrop-filter: blur(10px); border-top: 1px solid var(--line); z-index: 30; padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 62px; font-size: .7rem; color: var(--muted); text-decoration: none; position: relative; background: none; border: 0; cursor: pointer; }
  .tabbar .active { color: var(--ink); }
  .tabbar svg { width: 23px; height: 23px; }
  .tabbar .count { position: absolute; top: 7px; left: calc(50% + 7px); background: var(--bad); color: #fff; border-radius: 999px; font-size: .64rem; padding: 0 5px; font-weight: 700; line-height: 1.5; }
  .page-head { margin-bottom: 14px; }
  .page-head h1 { display: none; }
  .page-head .sub-mobile { display: block; }
  .grid-2, .grid-3, .detail { grid-template-columns: minmax(0, 1fr); }
  .grid > *, .detail > * { min-width: 0; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 13px 14px; }
  .kpi .value { font-size: 1.3rem; }
  .kpi .sub { font-size: .74rem; line-height: 1.35; }
  .btn { min-height: var(--tap); font-size: .95rem; }
  .btn-sm { min-height: 40px; }
  input[type=text], input[type=email], input[type=url], input[type=number], input[type=date], input[type=password], input[type=search], select, textarea { min-height: 46px; font-size: 16px; }
  .quick-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .quick-actions .btn { width: 100%; white-space: normal; text-align: center; line-height: 1.2; min-height: 50px; }
  .quick-actions label { grid-column: 1 / -1; }
  .stage-select { max-width: none; width: 100%; }
  .detail-head > .row { width: 100%; }
  details.fold > summary { padding: 15px 16px; min-height: 54px; }
  details.fold > .fold-body { padding: 0 16px 16px; }
  #fold-edit > summary .meta, #fold-more > summary .meta { display: none; }
  .card-pad { padding: 16px; }
  .hbar-row { grid-template-columns: 110px 1fr 52px; }
  .cadence { grid-template-columns: 1fr 1fr; }
  #toasts { left: 16px; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); }
  .projects { grid-template-columns: minmax(0, 1fr); }
  .tabs button { min-height: 40px; padding: 6px 13px; }
  .qualify .row button { flex: 1 1 calc(50% - 6px); }
  .list li { flex-wrap: wrap; min-height: 54px; }
  .list li .todo-badges { flex-basis: 100%; justify-content: flex-start !important; padding-left: 18px; }
  .kanban-toolbar input[type=search] { max-width: none; flex: 1 1 100%; }
}

/* ---------- Finances ---------- */
.kpi .value.neg, .evo .value.neg { color: var(--bad); }
.kpi .value small { font-size: .9rem; color: var(--muted); font-weight: 500; }
.legend .sw-line { width: 16px; height: 0; border-radius: 0; background: none !important; }
.chart .direct-label { fill: var(--ink-2); font-size: 11px; font-weight: 600; }
.mini-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.mini-kpis > div { background: var(--surface); padding: 11px 12px; display: flex; flex-direction: column; gap: 3px; }
.mini-kpis span { color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.mini-kpis b { font-size: 1.05rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.evo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.evo { padding: 13px 14px 10px; background: var(--surface-2); }
.evo .label { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 600; }
.evo-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 5px 0 4px; }
.evo .value { font-size: 1.25rem; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.evo .var { font-size: .78rem; font-weight: 600; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.evo .var.bad { color: #ff8a80; }
.evo .spark { width: 100%; height: 32px; display: block; }
.evo-foot { color: #5d5d64; font-size: .7rem; margin-top: 2px; }
.project .big { font-size: 1.05rem; }
.project .big small { font-size: .75rem; color: var(--muted); font-weight: 500; }
.project.ended { opacity: .6; }
.modal [hidden] { display: none !important; }
@media (max-width: 900px) {
  .mini-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .evo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.demo-pill { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted); font-size: .68rem; font-weight: 600; letter-spacing: .04em; vertical-align: middle; }

/* ---------- Langage simple : faits, étapes, camembert, recherche ---------- */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.fact { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.fact b { font-size: 1.05rem; font-weight: 600; }
.fact span { color: var(--ink-2); font-size: .86rem; line-height: 1.4; }
.kind { font-size: .86rem; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; }
.kind b { color: var(--ink); font-weight: 600; }
.warn-text { color: #ff8a80; }
.progress-steps ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); position: relative; }
.progress-steps ol::before { content: ""; position: absolute; top: 12px; left: 8%; right: 8%; height: 2px; background: var(--line-2); }
.progress-steps li { display: flex; flex-direction: column; align-items: center; gap: 5px; position: relative; text-align: center; }
.progress-steps .mark { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; font-weight: 700; background: var(--surface); border: 2px solid var(--line-2); color: var(--muted); }
.progress-steps li.done .mark { background: var(--ink-2); border-color: var(--ink-2); color: #0b0b0c; }
.progress-steps li.current .mark { background: var(--ink); border-color: var(--ink); color: #0b0b0c; box-shadow: 0 0 0 4px rgba(236,235,232,.12); }
.progress-steps .name { font-size: .7rem; color: var(--muted); line-height: 1.2; }
.progress-steps li.current .name { color: var(--ink); font-weight: 600; }
.pay-status { font-size: .86rem; color: var(--ink-2); }
.pay-status b { color: var(--ink); font-weight: 600; }
.pay-status.paid { color: var(--ink); }
.donut { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut svg { width: 190px; height: 190px; flex: none; }
.donut path { stroke: var(--surface); stroke-width: 1; }
.donut-top { fill: var(--ink); font-size: 17px; font-weight: 600; }
.donut-bottom { fill: var(--muted); font-size: 11px; }
.donut-legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 6px; }
.donut-legend li { display: grid; grid-template-columns: 12px 1fr auto 42px; gap: 10px; align-items: center; font-size: .88rem; }
.donut-legend i { width: 12px; height: 12px; border-radius: 3px; }
.donut-legend .amt { font-variant-numeric: tabular-nums; font-weight: 600; }
.donut-legend .pc { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.finder-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; }
@media (max-width: 900px) {
  .finder-form { grid-template-columns: 1fr; }
  .donut { flex-direction: column; align-items: stretch; }
  .donut svg { margin: 0 auto; }
  .donut-legend { min-width: 0; width: 100%; flex: none; }
  .progress-steps .name { font-size: .62rem; }
}

/* ---------- Prospects de la semaine ---------- */
.disc-list { display: flex; flex-direction: column; gap: 10px; }
details.disc > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 14px; padding: 14px 16px; min-height: 64px; }
details.disc > summary::-webkit-details-marker { display: none; }
details.disc .chev { color: var(--muted); transition: transform .15s; flex: none; }
details.disc[open] .chev { transform: rotate(90deg); }
details.disc.ecarte { opacity: .55; }
.disc-score { flex: none; width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-size: 1.3rem; font-weight: 700; color: var(--c); border: 2px solid var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); line-height: 1; }
.disc-score small { font-size: .62rem; font-weight: 600; color: var(--muted); margin-top: -10px; }
.disc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.disc-name { font-weight: 600; font-size: 1rem; }
.disc-sub { color: var(--ink-2); font-size: .84rem; }
.disc-sub b { color: #34d399; font-weight: 600; }
.disc-body { padding: 0 16px 18px; border-top: 1px solid var(--line); }
.disc-body h4 { margin: 18px 0 8px; font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.disc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.btn.disabled { opacity: .45; cursor: default; }
.disc-info { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; color: var(--ink-2); }
.disc-info b { color: var(--ink); }
.disc-criteria { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.disc-criteria li { display: grid; grid-template-columns: 210px 90px 1fr; gap: 12px; align-items: center; font-size: .87rem; }
.disc-criteria .res { color: var(--ink-2); }
.gauge-seg { display: inline-flex; gap: 3px; }
.gauge-seg i { width: 24px; height: 8px; border-radius: 3px; background: var(--surface-3); }
.disc-google { margin-top: 12px; font-size: .88rem; padding: 9px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.disc-google.weak b { color: #fbbf24; }
.disc-problems { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.disc-problems li { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.pb-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sev { font-size: .68rem; font-weight: 700; color: #0b0b0c; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; }
.pb-detail { color: var(--ink-2); font-size: .86rem; margin-top: 5px; }
.pb-where { font-size: .82rem; margin-top: 5px; color: var(--ink); }
.pb-where::before { content: "👀 "; }
.thumb { display: inline-flex; flex-direction: column; gap: 4px; margin-top: 10px; padding: 0; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; background: #000; cursor: zoom-in; color: var(--ink-2); font-size: .75rem; }
.thumb img { display: block; width: 120px; height: 200px; object-fit: cover; object-position: top; }
.thumb span { padding: 4px 8px 6px; text-align: left; background: var(--surface); }
.disc-gallery { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.disc-gallery .thumb { margin-top: 0; flex: none; }
.disc-offer { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: .9rem; color: var(--ink-2); }
.disc-offer b { color: var(--ink); margin-right: 4px; }
.disc-offer b::after { content: " :"; }
.disc-gains { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; font-size: .9rem; }
.disc-gains li::before { content: "✓ "; color: #34d399; font-weight: 700; }
.disc-speech { margin: 0 0 10px; padding: 12px 14px; border-left: 3px solid #8b5cf6; background: var(--surface-2); border-radius: 0 10px 10px 0; font-size: .95rem; line-height: 1.5; }
.lightbox { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.92); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 80px); object-fit: contain; border-radius: 8px; }
.lightbox .cap { color: var(--ink-2); font-size: .9rem; margin-top: 10px; text-align: center; }
.lightbox .close { position: absolute; top: 12px; right: 12px; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-size: 1.5rem; cursor: pointer; }
@media (max-width: 900px) {
  details.disc > summary { padding: 12px; gap: 12px; }
  .disc-score { width: 46px; height: 46px; font-size: 1.15rem; }
  .disc-body { padding: 0 12px 16px; }
  .disc-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .disc-actions .btn { width: 100%; min-height: 48px; }
  .disc-actions .btn-primary { grid-column: 1 / -1; order: -1; }
  .disc-criteria li { grid-template-columns: 1fr auto; gap: 4px 10px; }
  .disc-criteria .res { grid-column: 1 / -1; font-size: .82rem; }
  .thumb img { width: 110px; height: 190px; }
}
