/* CRM COD — thème clair (par défaut) + thème sombre · accent cyan, titres bleu nuit */
:root, [data-theme="light"] {
  color-scheme: light;
  --bg: #eaf1f8; --bg2: #f5f8fc; --panel: #ffffff; --panel2: #f3f7fb; --panel3: #e6edf5; --line: #e3eaf2; --line2: #d2dce8;
  --ink: #0f2540; --ink2: #3a4e68; --muted: #7b8aa0;
  --brand: #0e9cc0; --brand-2: #0b87a8; --brand-ink: #ffffff; --brand-soft: rgba(14, 156, 192, .10); --brand-line: rgba(14, 156, 192, .35);
  --navy: #1c3a66; --navy-2: #2b5b97; --nav-active: #1c3a66; --nav-active-ink: #ffffff;
  --blue: #2563eb; --green: #15924a; --amber: #b7791f; --violet: #6d4fd0; --orange: #e0621f; --red: #dc2626; --gray: #64748b; --teal: #0d8f83;
  --shadow: 0 1px 2px rgba(16, 40, 80, .04), 0 10px 28px rgba(16, 40, 80, .07);
  --tip-bg: #0f2540; --tip-ink: #ffffff; --alert-ink: #8a5a00;
  --radius: 20px;
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a111e; --bg2: #0d1626; --panel: #111a2b; --panel2: #16223a; --panel3: #1c2a44; --line: #22314d; --line2: #2c3d5c;
  --ink: #eaf2fb; --ink2: #b9c7da; --muted: #7f90a8;
  --brand: #22c3e6; --brand-2: #0fb0d4; --brand-ink: #04121f; --brand-soft: rgba(34, 195, 230, .12); --brand-line: rgba(34, 195, 230, .4);
  --navy: #1f3d6b; --navy-2: #2a5a96; --nav-active: #22c3e6; --nav-active-ink: #04121f;
  --blue: #5b9cf0; --green: #4fcf7f; --amber: #f2b33a; --violet: #a99cf5; --orange: #f08a4b; --red: #f06a6a; --gray: #9aa8b8; --teal: #3fd4bd;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .25);
  --tip-bg: #050a12; --tip-ink: #eaf2fb; --alert-ink: #f5cf86;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; color: var(--ink); font: 14px/1.45 "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; }
body { background: radial-gradient(1100px 500px at 15% -10%, var(--brand-soft), transparent 60%), linear-gradient(180deg, var(--bg), var(--bg2)); background-attachment: fixed; min-height: 100vh; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 28px; margin: 0; font-weight: 750; letter-spacing: -.02em; color: var(--ink); }
h2 { font-size: 15px; font-weight: 650; color: var(--ink); margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }
h3 { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.r { text-align: right; }
.grow { flex: 1; }
.neg { color: var(--red); } .pos { color: var(--green); }
.warn { color: var(--orange); font-weight: 600; }
.boot { padding: 40px; color: var(--muted); }
code { background: var(--panel3); color: var(--ink2); padding: 1px 6px; border-radius: 6px; font-size: 12px; }
::selection { background: var(--brand); color: var(--brand-ink); }
::-webkit-scrollbar { width: 10px; height: 10px; } ::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }

/* ---------- structure : barre du haut ---------- */
#app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 18px; padding: 12px 28px; background: color-mix(in srgb, var(--panel) 82%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; font-size: 19px; letter-spacing: .01em; color: var(--ink); display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.brand .logo { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--brand), var(--navy-2)); display: grid; place-items: center; color: #fff; font-size: 15px; }
.brand b { color: var(--brand); }
.brand small { font-size: 11px; font-weight: 500; color: var(--muted); display: block; line-height: 1; margin-top: 2px; }
.brand.big { font-size: 24px; margin-bottom: 6px; }
.mainnav { display: flex; gap: 4px; flex: 1; justify-content: center; flex-wrap: nowrap; }
.navgrp { position: relative; }
.navbtn { background: transparent; color: var(--ink2); border: 0; padding: 9px 16px; border-radius: 999px; font-weight: 600; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; line-height: 1.2; font-size: 14px; }
.navbtn:hover { text-decoration: none; }
.navbtn:hover { background: var(--panel2); color: var(--ink); }
.navgrp.on > .navbtn { background: var(--nav-active); color: var(--nav-active-ink); }
.navbtn .car { font-size: 10px; opacity: .6; }
.navmenu { position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%); min-width: 220px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 8px; display: none; flex-direction: column; gap: 2px; z-index: 40; }
.navgrp:hover > .navmenu, .navgrp.open > .navmenu { display: flex; }
.navgrp::after { content: ''; position: absolute; left: 0; right: 0; top: 100%; height: 10px; }
.navmenu a { color: var(--ink2); padding: 9px 12px; border-radius: 10px; font-weight: 500; display: flex; align-items: center; gap: 10px; }
.navmenu a::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--line2); }
.navmenu a:hover { background: var(--panel2); text-decoration: none; color: var(--ink); }
.navmenu a.on { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.navmenu a.on::before { background: var(--brand); }
.tright { display: flex; align-items: center; gap: 10px; }
.iconbtn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--ink2); display: grid; place-items: center; padding: 0; font-size: 16px; }
.iconbtn:hover { color: var(--brand); border-color: var(--brand-line); }
.userchip { display: flex; align-items: center; gap: 10px; padding: 4px 4px 4px 4px; }
.userchip .avatar { width: 36px; height: 36px; font-size: 13px; }
.userchip div { display: flex; flex-direction: column; line-height: 1.2; }
.userchip b { font-size: 13px; } .userchip small { color: var(--muted); font-size: 12px; }
main { flex: 1; width: 100%; max-width: 1560px; margin: 0 auto; padding: 26px 28px 60px; min-width: 0; }
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.top .muted.small { font-size: 13px; margin-top: 4px; }
.tools { display: flex; gap: 8px; flex-wrap: wrap; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.cols > .panel, .cols > section, .cols > div > .panel:last-child { margin-bottom: 0; }
.cols + .panel, .cols + section, .cols + .cols { margin-top: 16px; }
.row { display: grid; gap: 16px; margin-bottom: 16px; }
.row > .panel { margin: 0; }
.r2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.r3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.r4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.r21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.r12 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }

/* ---------- contrôles ---------- */
button, .btn { font: inherit; border-radius: 999px; border: 1px solid transparent; padding: 8px 16px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; text-decoration: none !important; }
button:disabled { opacity: .45; cursor: default; }
.primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: var(--brand-ink); box-shadow: 0 6px 16px var(--brand-soft); }
.primary:hover:not(:disabled) { filter: brightness(1.06); }
.ghost { background: var(--panel); border-color: var(--line2); color: var(--ink); }
.ghost:hover:not(:disabled) { background: var(--panel2); border-color: var(--brand-line); }
.sm { padding: 6px 12px; font-size: 13px; }
.wide { width: 100%; justify-content: center; }
.row-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
.row-btns.left { justify-content: flex-start; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline select { flex: 1; }
input, select, textarea { font: inherit; width: 100%; padding: 10px 12px; border: 1px solid var(--line2); border-radius: 12px; background: var(--panel2); color: var(--ink); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--brand-soft); border-color: var(--brand); background: var(--panel); }
input:disabled, select:disabled, textarea:disabled { opacity: .6; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--brand); }
input[type=color] { padding: 2px; height: 42px; }
input[type=range] { accent-color: var(--brand); padding: 0; background: transparent; border: 0; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 600; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grid .wide { grid-column: 1 / -1; }
.inline-label { margin-top: 12px; max-width: 320px; }
.chk { display: inline-flex; flex-direction: row; align-items: center; gap: 7px; color: var(--ink); font-size: 13px; }
.top select { width: auto; min-width: 180px; background: var(--panel); border-radius: 999px; box-shadow: var(--shadow); }

/* ---------- puces ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; white-space: nowrap; text-decoration: none !important; }
.chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.xs { font-size: 11px; padding: 1px 7px; }
.chip.blue { background: color-mix(in srgb, var(--blue) 13%, transparent); color: var(--blue); }
.chip.green { background: color-mix(in srgb, var(--green) 13%, transparent); color: var(--green); }
.chip.amber { background: color-mix(in srgb, var(--amber) 15%, transparent); color: var(--amber); }
.chip.violet { background: color-mix(in srgb, var(--violet) 13%, transparent); color: var(--violet); }
.chip.orange { background: color-mix(in srgb, var(--orange) 13%, transparent); color: var(--orange); }
.chip.red { background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--red); }
.chip.gray { background: color-mix(in srgb, var(--gray) 13%, transparent); color: var(--gray); }
.chip.teal { background: color-mix(in srgb, var(--teal) 13%, transparent); color: var(--teal); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* ---------- cartes KPI ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 16px; }
.card, .kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; min-width: 0; box-shadow: var(--shadow); }
.card span, .kpi > span { color: var(--ink2); font-size: 14px; font-weight: 600; }
.card b, .kpi > b { font-size: 30px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.card small { color: var(--muted); font-size: 12px; }
.card.green b { color: var(--green); } .card.red b { color: var(--red); } .card.blue b { color: var(--blue); } .card.orange b { color: var(--orange); } .card.violet b { color: var(--violet); }
.kpi.hero, .card.hero { background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%); border-color: transparent; color: #fff; }
.kpi.hero > span, .kpi.hero > b, .card.hero span, .card.hero b, .card.hero small { color: #fff; }
.kpi.hero .delta i { color: rgba(255, 255, 255, .75); }
.kpi.hero .delta.up, .kpi.hero .delta.down, .kpi.hero .delta.flat { background: rgba(255, 255, 255, .16); color: #fff; }
.delta { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; align-self: flex-start; padding: 3px 9px; border-radius: 99px; }
.delta.up { color: var(--green); background: color-mix(in srgb, var(--green) 12%, transparent); }
.delta.down { color: var(--red); background: color-mix(in srgb, var(--red) 10%, transparent); }
.delta.flat { color: var(--muted); padding: 0; background: none; font-weight: 500; }
.delta i { font-style: normal; color: var(--muted); font-weight: 500; }

/* ---------- tableaux & listes ---------- */
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
td { color: var(--ink2); }
td b { color: var(--ink); }
tbody tr:last-child td { border-bottom: 0; }
th.r, td.r { text-align: right; }
table.orders tbody tr, tr[data-href] { cursor: pointer; }
tbody tr:hover td { background: var(--panel2); }
tr.dim td { opacity: .45; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs button, .tabbtn { background: var(--panel); border: 1px solid var(--line); color: var(--ink2); padding: 7px 15px; border-radius: 99px; font-weight: 600; font-size: 13px; box-shadow: var(--shadow); }
.tabs button.on, .tabbtn.on { background: var(--nav-active); color: var(--nav-active-ink); border-color: var(--nav-active); }
.tabs button:hover:not(.on), .tabbtn:hover:not(.on) { background: var(--panel2); text-decoration: none; }
.filters { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.filters input { flex: 2; min-width: 200px; }
.filters select { flex: 1; min-width: 160px; width: auto; }
.bulk { display: flex; align-items: center; gap: 8px; background: var(--brand-soft); border: 1px solid var(--brand-line); padding: 8px 14px; border-radius: 14px; margin-bottom: 12px; flex-wrap: wrap; }
.bulk select { width: auto; }
.pager { display: flex; align-items: center; gap: 10px; justify-content: flex-end; margin-top: 12px; }
.pager .muted { margin-right: auto; }

/* ---------- fiche / appel ---------- */
.callcard { border-top: 4px solid var(--brand); }
.callhead { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; align-items: flex-start; }
.cname { font-size: 22px; font-weight: 750; color: var(--ink); }
.callbtns { display: flex; gap: 8px; align-items: flex-start; }
.btn.call { background: var(--navy); color: #fff; font-size: 15px; }
.btn.wa { background: #25d366; color: #06290f; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line2); }
.act { font-weight: 600; border: 1px solid; background: var(--panel); }
.act.green { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: var(--brand-ink); border-color: transparent; font-size: 15px; padding: 9px 22px; }
.act.amber { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 45%, transparent); }
.act.violet { color: var(--violet); border-color: color-mix(in srgb, var(--violet) 45%, transparent); }
.act.red { color: var(--red); border-color: color-mix(in srgb, var(--red) 45%, transparent); }
.act.orange { color: var(--orange); border-color: color-mix(in srgb, var(--orange) 45%, transparent); }
.act.gray { color: var(--gray); border-color: var(--line2); }
.act.teal { color: var(--teal); border-color: color-mix(in srgb, var(--teal) 45%, transparent); }
.act.blue { color: var(--blue); border-color: color-mix(in srgb, var(--blue) 45%, transparent); }
.act:hover:not(:disabled):not(.green) { background: var(--panel2); }
.act.green:hover:not(:disabled) { filter: brightness(1.06); }
.line { display: flex; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--ink2); flex-wrap: wrap; }
.line:hover { text-decoration: none; color: var(--ink); }
.line:last-child { border-bottom: 0; }
.hist { list-style: none; margin: 0; padding: 0; }
.hist li { padding: 9px 0; border-bottom: 1px solid var(--line); color: var(--ink2); }
.hist li:last-child { border-bottom: 0; }
.hist small { display: block; color: var(--muted); }
.empty { background: var(--panel); border: 1px dashed var(--line2); border-radius: var(--radius); padding: 40px; text-align: center; color: var(--muted); margin-bottom: 16px; }
.empty.small { padding: 22px; margin: 0; background: transparent; }
.alert { background: color-mix(in srgb, var(--amber) 10%, var(--panel)); border: 1px solid color-mix(in srgb, var(--amber) 35%, transparent); color: var(--alert-ink); padding: 11px 16px; border-radius: 14px; margin: 0 0 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.alert.ok { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand); }
.alert ul { margin: 6px 0 0; padding-left: 18px; }
textarea#csv { margin-top: 10px; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.pimg { width: 64px; height: 64px; object-fit: cover; border-radius: 14px; border: 1px solid var(--line); }
.thumb { width: 120px; height: 120px; object-fit: cover; border-radius: 14px; border: 1px solid var(--line); }
.mini { width: 38px; height: 38px; object-fit: cover; border-radius: 10px; }
.offer-row { margin-bottom: 8px; }
.pulse { animation: pulse 1.4s infinite; } @keyframes pulse { 50% { box-shadow: 0 0 0 7px var(--brand-soft); } }

/* ---------- finance ---------- */
table.pl td { white-space: normal; }
table.pl tr.b td { font-weight: 700; color: var(--ink); }
table.pl tr.total td { font-weight: 800; font-size: 17px; border-top: 2px solid var(--brand); color: var(--brand); }
.funnel { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.funnel > div:not(.muted) { background: var(--panel2); border-radius: 14px; padding: 10px 20px; text-align: center; }
.funnel b { display: block; font-size: 24px; } .funnel span { color: var(--muted); font-size: 12px; } .funnel i { color: var(--muted); font-style: normal; font-size: 20px; }

/* ---------- connexion ---------- */
.auth { flex: 1; display: grid; place-items: center; padding: 20px; }
.authcard { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line); border-radius: 24px; padding: 32px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); }
.authcard h2 { font-size: 20px; margin: 0; }
.authcard p { margin: 0 0 4px; }
.auththeme { position: fixed; top: 16px; right: 16px; }

/* ---------- dialogues ---------- */
dialog { border: 1px solid var(--line); border-radius: 22px; padding: 24px; width: min(440px, 92vw); background: var(--panel); color: var(--ink); box-shadow: 0 30px 80px rgba(10, 25, 50, .35); }
dialog.wide { width: min(860px, 94vw); }
dialog::backdrop { background: rgba(10, 20, 40, .45); backdrop-filter: blur(3px); }
.mbody { display: flex; flex-direction: column; gap: 10px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; max-height: 50vh; overflow: auto; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; cursor: pointer; border: 3px solid transparent; }
.gallery img:hover, .gallery img.on { border-color: var(--brand); }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; font-weight: 600; padding: 12px 20px; border-radius: 999px; z-index: 99; box-shadow: 0 10px 30px rgba(10, 25, 50, .3); }
.toast.err { background: var(--red); color: #fff; }

/* ---------- graphiques ---------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-l { stroke: var(--line); stroke-width: 1; }
.chart .axis-t { fill: var(--muted); font-size: 11px; }
.chart .band { fill: transparent; }
.chart .band:hover { fill: var(--panel2); fill-opacity: .7; }
.chart .xh { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0; pointer-events: none; }
.chart g.pt:hover .xh, .chart g.pt:hover .dot { opacity: 1; }
.chart .dot { opacity: 0; pointer-events: none; }
.chart .col:hover, .chart .seg:hover { filter: brightness(1.12); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--ink2); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend b { color: var(--ink); font-weight: 600; }
.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut-wrap .chart { width: 190px; flex: none; }
.donut-legend { flex: 1; min-width: 180px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.donut-legend div { display: flex; flex-direction: column; gap: 2px; }
.donut-legend span { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.donut-legend i { width: 9px; height: 9px; border-radius: 3px; }
.donut-legend b { font-size: 18px; font-variant-numeric: tabular-nums; color: var(--ink); }
.hbars { display: grid; gap: 12px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 160px) 1fr auto; gap: 12px; align-items: center; font-size: 13px; }
.hbar > span { color: var(--ink2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar > b { font-variant-numeric: tabular-nums; min-width: 60px; text-align: right; color: var(--ink); }
.hbar .track { height: 12px; background: var(--panel3); border-radius: 99px; overflow: hidden; display: flex; gap: 2px; }
.hbar .track i { display: block; height: 100%; border-radius: 99px; min-width: 2px; }
.gauge { text-align: center; }
.gauge svg { width: 100%; max-width: 240px; }
.gauge b { display: block; font-size: 32px; margin-top: -54px; font-variant-numeric: tabular-nums; color: var(--ink); }
.gauge small { color: var(--muted); font-size: 12px; display: block; margin-top: 4px; }
.stack { display: flex; height: 14px; border-radius: 99px; overflow: hidden; gap: 2px; background: var(--panel3); }
.stack i { display: block; height: 100%; }
.tip { position: fixed; z-index: 100; pointer-events: none; background: var(--tip-bg); color: var(--tip-ink); padding: 8px 11px; border-radius: 11px; font-size: 12px; line-height: 1.45; box-shadow: 0 10px 30px rgba(10, 25, 50, .3); white-space: nowrap; }
.tip b { color: var(--brand); }

/* ---------- tableau de bord ---------- */
.dash { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 18px; align-items: start; }
.feed { position: sticky; top: 86px; display: flex; flex-direction: column; gap: 16px; }
.feed .panel { margin: 0; padding: 18px; }
.fitem { display: flex; gap: 11px; padding: 8px 0; align-items: flex-start; color: var(--ink2); }
.fitem:hover { text-decoration: none; }
.fitem .ic { width: 32px; height: 32px; border-radius: 11px; display: grid; place-items: center; flex: none; font-size: 13px; font-weight: 700; }
.fitem .ic.g { background: color-mix(in srgb, var(--green) 13%, transparent); color: var(--green); } .fitem .ic.r { background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--red); }
.fitem .ic.b { background: var(--brand-soft); color: var(--brand); } .fitem .ic.a { background: color-mix(in srgb, var(--amber) 14%, transparent); color: var(--amber); }
.fitem div { min-width: 0; font-size: 13px; color: var(--ink2); }
.fitem div b { color: var(--ink); font-weight: 600; }
.fitem small { display: block; color: var(--muted); font-size: 11px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12px; color: #fff; flex: none; }
.promo { background: linear-gradient(150deg, var(--navy), var(--navy-2)); border-color: transparent; color: #fff; }
.promo h2, .promo .muted { color: rgba(255, 255, 255, .85); }
.promo b { font-size: 36px; color: #fff; }
.promo .btn.primary { background: #fff; color: var(--navy); box-shadow: none; }

/* ---------- espace confirmatrice ---------- */
.statusbar { display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); }
.statusbar #sclock { font-variant-numeric: tabular-nums; font-size: 14px; }
.statusbar .sbtns { display: flex; }
.lead-top { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.lead-id { display: flex; align-items: center; gap: 14px; }
.lead-id .cname { font-size: 24px; }
.lead-amount { margin-left: auto; font-size: 26px; color: var(--brand); white-space: nowrap; }
.lead-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 16px 0; }
.lead-facts div { background: var(--panel2); border-radius: 14px; padding: 10px 12px; min-width: 0; }
.lead-facts span { display: block; color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.lead-facts b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.btn.callbig { width: 100%; justify-content: center; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: var(--brand-ink); font-size: 18px; padding: 15px; box-shadow: 0 10px 24px var(--brand-soft); }
.btn.callbig:hover { filter: brightness(1.06); }
.incall { display: flex; align-items: center; gap: 12px; background: color-mix(in srgb, var(--red) 7%, var(--panel)); border: 1px solid color-mix(in srgb, var(--red) 35%, transparent); border-radius: 16px; padding: 12px 14px; }
.incall b { font-size: 22px; font-variant-numeric: tabular-nums; }
.incall button { margin-left: auto; }
.callalt { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.results { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.res { justify-content: center; padding: 12px; font-size: 14px; border: 0; color: #fff; border-radius: 14px; }
.res.green { background: #15924a; } .res.gray { background: #64748b; } .res.blue { background: #2563eb; }
.res.red { background: #dc2626; } .res.violet { background: #6d4fd0; } .res.orange { background: #e0621f; }
.res:hover:not(:disabled) { filter: brightness(1.1); }
dl.facts { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 0; font-size: 13px; }
dl.facts dt { color: var(--muted); } dl.facts dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.leadlist { display: flex; flex-direction: column; }
.leadrow { display: flex; align-items: center; gap: 12px; padding: 11px 8px; border-bottom: 1px solid var(--line); color: var(--ink2); border-radius: 12px; }
.leadrow:hover { background: var(--panel2); text-decoration: none; }
.leadrow.late { box-shadow: inset 4px 0 0 var(--red); }
.leadrow > b { color: var(--ink); white-space: nowrap; }
.ptiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.ptile { background: var(--panel2); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ptile b { font-size: 18px; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink); }
.ptile span { font-size: 11px; color: var(--muted); }
.ptile.green b { color: var(--green); } .ptile.blue b { color: var(--blue); } .ptile.violet b { color: var(--violet); } .ptile.amber b { color: var(--amber); } .ptile.orange b { color: var(--orange); }
.rings { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.rings .gauge b { font-size: 22px; margin-top: -40px; }
.agrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; }
.agrid .panel { margin: 0; }
.agcard.dim { opacity: .5; }
.modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.mode { flex-direction: column; gap: 4px; background: var(--panel2); border: 1px solid var(--line2); border-radius: 16px; padding: 12px 14px; cursor: pointer; color: var(--ink2); }
.mode input { display: none; }
.mode b { color: var(--ink); font-size: 14px; }
.mode span { font-weight: 400; color: var(--muted); }
.mode.on { border-color: var(--brand); background: var(--brand-soft); }
.slider { display: grid; grid-template-columns: auto 160px 1fr 60px; align-items: center; gap: 12px; padding: 8px 0; }
.wv { text-align: right; color: var(--brand); font-variant-numeric: tabular-nums; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.funnel2 { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.fstep { background: var(--panel2); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; border: 1px solid transparent; }
.fstep span { font-size: 12px; color: var(--muted); font-weight: 600; }
.fstep b { font-size: 24px; font-variant-numeric: tabular-nums; color: var(--ink); }
.fstep small { font-size: 12px; color: var(--muted); }
.fstep.leak { border-color: color-mix(in srgb, var(--red) 55%, transparent); background: color-mix(in srgb, var(--red) 6%, var(--panel)); }
.fstep.leak small { color: var(--red); font-weight: 700; }
.fbar { height: 7px; background: var(--panel3); border-radius: 99px; overflow: hidden; }
.fbar i { display: block; height: 100%; border-radius: 99px; }

/* ---------- responsive ---------- */
@media (max-width: 1280px) { .dash { grid-template-columns: 1fr; } .feed { position: static; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); } .userchip div { display: none; } }
@media (max-width: 1000px) { .r4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .r3, .r21, .r12 { grid-template-columns: 1fr; } .modes, .funnel2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .lead-facts, .ptiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .results { grid-template-columns: 1fr 1fr; } .slider { grid-template-columns: auto 1fr 50px; } .slider > b:first-of-type { display: none; } }
@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  .mainnav { order: 3; width: 100%; justify-content: flex-start; overflow-x: auto; }
  .navmenu { position: fixed; top: auto; left: 12px; right: 12px; transform: none; }
  .tright { margin-left: auto; }
  main { padding: 16px 12px 60px; }
  h1 { font-size: 23px; }
  .cols, .r2 { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr 1fr; }
  .act { flex: 1 1 45%; justify-content: center; }
  .act.green { flex-basis: 100%; }
}
@media (max-width: 520px) { .grid, .r4 { grid-template-columns: 1fr; } .callbtns { width: 100%; } .callbtns .btn { flex: 1; justify-content: center; } .donut-legend { grid-template-columns: 1fr 1fr; } .statusbar #sclock { display: none; } }

/* ---------- barre de recherche, compteurs, alertes ---------- */
.subbar { max-width: 1560px; width: 100%; margin: 14px auto 0; padding: 0 28px; display: flex; align-items: center; gap: 12px; }
.gsearch { position: relative; flex: 1; max-width: 640px; display: flex; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 0 12px; box-shadow: var(--shadow); }
.gsearch input { border: 0; background: transparent; padding: 10px 8px; box-shadow: none; outline: none; }
.gsearch input:focus { outline: none; background: transparent; }
.gsearch .gicon { color: var(--muted); font-size: 16px; }
.gsearch kbd { font: 11px ui-monospace, monospace; color: var(--muted); border: 1px solid var(--line2); border-radius: 6px; padding: 2px 6px; white-space: nowrap; }
.gres { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 6px; z-index: 50; }
.gitem { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 10px; color: var(--ink2); }
.gitem:hover, .gitem.on { background: var(--panel2); text-decoration: none; }
.counters { display: flex; gap: 8px; margin-left: auto; }
.cpill { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); color: var(--blue); box-shadow: var(--shadow); font-size: 13px; }
.cpill.green { color: var(--green); } .cpill.amber { color: var(--amber); }
.cpill:hover { text-decoration: none; border-color: var(--brand-line); }
.bellwrap { position: relative; }
#bell { position: relative; }
#bell .bdg { position: absolute; top: -4px; right: -4px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; border-radius: 99px; padding: 1px 5px; }
.alertbox { position: absolute; right: 0; top: calc(100% + 8px); width: 360px; z-index: 60; margin: 0; padding: 14px; max-height: 70vh; overflow: auto; }
.alert-item { display: block; padding: 10px 12px; border-radius: 12px; color: var(--ink2); border-left: 3px solid var(--amber); margin-bottom: 6px; background: var(--panel2); }
.alert-item.urgent { border-left-color: var(--red); } .alert-item.info { border-left-color: var(--brand); }
.alert-item b { color: var(--ink); } .alert-item small { display: block; color: var(--muted); margin-top: 2px; }
.alert-item:hover { text-decoration: none; filter: brightness(.98); }
@media (max-width: 900px) { .subbar { padding: 0 12px; flex-wrap: wrap; } .gsearch kbd { display: none; } .alertbox { position: fixed; left: 12px; right: 12px; width: auto; top: 70px; } }

/* parcours de la commande */
.stages { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; padding: 14px; }
.stage { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; position: relative; color: var(--muted); }
.stage i { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-weight: 700; background: var(--panel3); color: var(--muted); }
.stage b { font-size: 13px; color: var(--ink2); } .stage small { font-size: 11px; }
.stage.done i { background: var(--green); color: #fff; } .stage.done b { color: var(--ink); }
.stage.cur i { background: var(--brand); color: var(--brand-ink); box-shadow: 0 0 0 5px var(--brand-soft); }
.stage.bad i { background: var(--red); color: #fff; }
@media (max-width: 700px) { .stages { grid-template-columns: repeat(3, 1fr); } }

/* choix rapide de la ville */
.cpick { position: relative; }
.cpick input.bad { border-color: var(--orange); background: color-mix(in srgb, var(--orange) 6%, var(--panel2)); }
.cpick-list { position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; right: 0; max-height: 300px; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 6px; }
.cpick-item { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 10px; cursor: pointer; color: var(--ink); font-weight: 400; font-size: 13px; }
.cpick-item b { font-weight: 600; }
.cpick-item:hover, .cpick-item.on { background: var(--brand-soft); }

/* infos livreur dans la fiche */
.shipx { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.shipx summary { cursor: pointer; font-weight: 600; }
.shipx[open] summary { margin-bottom: 10px; }
/* bouton de résultat cliqué : reste visible et montre qu'il est en cours */
.act:disabled { opacity: 1; cursor: progress; background: color-mix(in srgb, currentColor 14%, var(--panel)); box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 22%, transparent); }
.act.green:disabled { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: var(--brand-ink); box-shadow: 0 0 0 4px var(--brand-soft); }
.act:disabled::after { content: ' …'; }

/* messagerie WhatsApp (admin + agent) — même look que WhatsApp */
.wabox { --wa-bg: #efeae2; --wa-in: #ffffff; --wa-out: #d9fdd3; --wa-txt: #111b21; --wa-meta: #667781; --wa-green: #25d366; --wa-dark: #008069; --wa-line: #e9edef; --wa-side: #ffffff; --wa-head: #f0f2f5;
  display: grid; grid-template-columns: 340px minmax(0, 1fr); height: calc(100vh - 150px); min-height: 480px; border: 1px solid var(--wa-line); border-radius: 14px; overflow: hidden; background: var(--wa-side); }
[data-theme="dark"] .wabox { --wa-bg: #0b141a; --wa-in: #202c33; --wa-out: #005c4b; --wa-txt: #e9edef; --wa-meta: #8696a0; --wa-line: #222d34; --wa-side: #111b21; --wa-head: #202c33; }
.walist { overflow: auto; border-right: 1px solid var(--wa-line); background: var(--wa-side); color: var(--wa-txt); }
.wafilter { display: flex; gap: 6px; padding: 10px 12px; flex-wrap: wrap; position: sticky; top: 0; background: var(--wa-side); z-index: 1; }
.wapill { border: 0; border-radius: 999px; padding: 5px 12px; font-size: 13px; background: var(--wa-head); color: var(--wa-meta); cursor: pointer; }
.wapill.on { background: #d9fdd3; color: #008069; font-weight: 600; } [data-theme="dark"] .wapill.on { background: #103529; color: #25d366; }
.waitem { display: flex; gap: 12px; align-items: center; padding: 10px 14px; color: var(--wa-txt); border-bottom: 1px solid var(--wa-line); }
.waitem:hover { background: var(--wa-head); text-decoration: none; } .waitem.on { background: var(--wa-head); }
.waav { flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 17px; }
.wamid { flex: 1; min-width: 0; }
.waell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.wanew { color: var(--wa-green); font-weight: 600; }
.wabadge { background: var(--wa-green); color: #fff; border-radius: 999px; min-width: 20px; padding: 1px 6px; font-size: 12px; font-weight: 700; text-align: center; }
.wathread { display: flex; flex-direction: column; min-height: 0; background: var(--wa-bg); color: var(--wa-txt); }
.waempty { margin: auto; display: grid; gap: 6px; text-align: center; color: var(--wa-meta); } .waempty div { font-size: 46px; }
.wahead { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--wa-head); border-bottom: 1px solid var(--wa-line); }
.waback { display: none; font-size: 22px; color: var(--wa-txt); }
.wamsgs { flex: 1; overflow: auto; padding: 14px 6%; display: flex; flex-direction: column; gap: 3px;
  background-color: var(--wa-bg); background-image: radial-gradient(rgba(0,0,0,.035) 1px, transparent 1px); background-size: 18px 18px; }
[data-theme="dark"] .wamsgs { background-image: radial-gradient(rgba(255,255,255,.03) 1px, transparent 1px); }
.waday { text-align: center; margin: 10px 0 6px; } .waday span { background: var(--wa-in); color: var(--wa-meta); font-size: 12px; padding: 5px 12px; border-radius: 8px; box-shadow: 0 1px .5px rgba(0,0,0,.13); }
.wamsg { display: flex; } .wamsg.in { justify-content: flex-start; } .wamsg.out { justify-content: flex-end; }
.wab { max-width: min(560px, 75%); padding: 6px 8px 4px 9px; border-radius: 8px; box-shadow: 0 1px .5px rgba(0,0,0,.13); background: var(--wa-in); color: var(--wa-txt); }
.wamsg.in .wab { border-top-left-radius: 0; } .wamsg.out .wab { background: var(--wa-out); border-top-right-radius: 0; }
.wawho { font-size: 12px; font-weight: 600; color: var(--wa-dark); margin-bottom: 2px; } [data-theme="dark"] .wawho { color: #53bdeb; }
.watxt { white-space: pre-wrap; word-wrap: break-word; font-size: 14.2px; line-height: 1.4; text-align: start; }
.wameta { font-size: 11px; color: var(--wa-meta); text-align: right; margin-top: 2px; white-space: nowrap; }
.watick { letter-spacing: -3px; margin-left: 2px; } .watick.read { color: #53bdeb; } .watick.fail { color: #ea0038; letter-spacing: 0; }
.waimg { display: block; max-width: 280px; max-height: 340px; border-radius: 6px; margin-bottom: 3px; } .waimg.stk { max-width: 140px; }
.waaud { width: 270px; max-width: 100%; height: 40px; }
.wadoc { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 6px; background: rgba(0,0,0,.05); color: var(--wa-txt); min-width: 220px; }
.wadoc span { font-size: 26px; } .wadoc b { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .wadoc small { color: var(--wa-dark); }
.wafile { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--wa-head); border-top: 1px solid var(--wa-line); }
.wafile img { width: 52px; height: 52px; object-fit: cover; border-radius: 6px; } .wafileic { font-size: 30px; }
.wacompose { display: flex; align-items: flex-end; gap: 8px; padding: 8px 12px; background: var(--wa-head); }
.wacompose textarea { flex: 1; resize: none; border: 0; border-radius: 8px; padding: 9px 12px; background: var(--wa-side); color: var(--wa-txt); font-size: 15px; min-height: 40px; max-height: 140px; }
.wacompose select { width: auto; max-width: 150px; border: 0; border-radius: 8px; background: var(--wa-side); color: var(--wa-meta); height: 40px; }
.waicon { border: 0; background: transparent; font-size: 22px; cursor: pointer; height: 40px; padding: 0 4px; color: var(--wa-meta); }
.wasendbtn { border: 0; width: 42px; height: 42px; border-radius: 50%; background: var(--wa-dark); color: #fff; font-size: 18px; cursor: pointer; }
.wasendbtn:disabled { opacity: .5; }
.wanote { margin: 8px 12px; }
.redtxt { color: var(--red); }
@media (max-width: 900px) {
  .wabox { grid-template-columns: 1fr; height: calc(100vh - 120px); }
  .wabox.open .walist { display: none; } .wabox:not(.open) .wathread { display: none; }
  .waback { display: block; } .wamsgs { padding: 12px 10px; }
}
