@font-face { font-family: 'Instrument Sans'; font-weight: 400 700; font-display: swap; src: url(/fonts/instrument-sans-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Instrument Sans'; font-weight: 400 700; font-display: swap; src: url(/fonts/instrument-sans-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'JetBrains Mono'; font-weight: 400 500; font-display: swap; src: url(/fonts/jetbrains-mono-latin.woff2) format('woff2'); }

:root {
  --bg: oklch(0.975 0.006 75); --side: oklch(0.965 0.007 72); --panel: oklch(0.99 0.004 75);
  --ink: oklch(0.24 0.012 60); --body: oklch(0.45 0.012 60); --muted: oklch(0.5 0.012 60);
  --line: oklch(0.9 0.008 70); --line-2: oklch(0.86 0.008 70); --line-3: oklch(0.93 0.006 70);
  --accent: oklch(0.6 0.16 32); --accent-text: oklch(0.55 0.16 32);
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: 'Instrument Sans', system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent-text); }
button, input, select { font-family: inherit; color: inherit; }
button { cursor: pointer; }
button[disabled] { cursor: progress; opacity: .7; }
input::placeholder { color: oklch(0.55 0.012 60); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
h1 { margin: 0; font-size: 28px; font-weight: 500; letter-spacing: -.025em; }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 13px; }
.xs { font-size: 12.5px; }
.mono { font-family: var(--mono); }
.strong { font-size: 15px; font-weight: 600; }
.grow { flex: 1; min-width: 0; }
.err { color: oklch(0.52 0.18 28); }
.r { text-align: right; }
.link { border: 0; background: none; padding: 0; font-size: 13px; color: var(--muted); text-align: left; }
.link:hover { color: var(--accent-text); }

.btn { height: 38px; padding: 0 14px; border-radius: 9px; border: 1px solid transparent; font-size: 13.5px; white-space: nowrap; background: none; }
.btn.line { border-color: oklch(0.85 0.008 70); background: #fff; }
.btn.accent { border: 0; background: var(--accent); color: #fff; font-weight: 500; height: 40px; padding: 0 16px; font-size: 14px; border-radius: 10px; }
.btn.dark { border: 0; background: var(--ink); color: #fff; font-weight: 500; }
.btn.sm { height: 34px; font-size: 13px; }

.brand { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.brand img { width: 24px; height: 24px; display: block; }
.tag { margin-left: auto; height: 20px; padding: 0 7px; border-radius: 5px; background: var(--ink); color: oklch(0.97 0.006 75); font-family: var(--mono); font-size: 10px; letter-spacing: .08em; display: flex; align-items: center; font-weight: 400; }

/* Connexion */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.login-card .brand .tag { margin-left: 4px; }
.login-card h1 { margin-top: 8px; font-size: 24px; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; }
.login-card input { height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2); background: #fff; font-size: 15px; outline-color: var(--accent); }
.login-msg { margin: 0; font-size: 14px; line-height: 1.5; color: var(--body); }

/* Structure */
.app { min-height: 100vh; display: grid; grid-template-columns: 232px minmax(0, 1fr); }
.side { position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--line); background: var(--side); padding: 18px 14px; display: flex; flex-direction: column; gap: 22px; }
.side .brand { padding: 0 6px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button { height: 36px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; font-size: 14px; display: flex; align-items: center; gap: 10px; text-align: left; }
.nav button:hover { background: oklch(0.94 0.008 70); }
.nav button[aria-current="page"] { background: oklch(0.92 0.009 70); font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 2px; }
.d-cust { background: var(--accent); } .d-brevo { background: #0b996e; } .d-req { background: oklch(0.55 0.1 250); }
.badge { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.badge.accent { color: var(--accent-text); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 0 6px; font-size: 13px; color: var(--muted); }
.who { font-size: 12px; overflow: hidden; text-overflow: ellipsis; padding-top: 6px; border-top: 1px solid var(--line); }
.main { min-width: 0; padding: 32px clamp(20px, 3vw, 40px) 64px; }
.page { display: flex; flex-direction: column; gap: 24px; }
.page.narrow { max-width: 880px; }
.page.wide { max-width: 960px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.titles { display: flex; flex-direction: column; gap: 4px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Clients */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.kpi span:first-child { font-size: 12.5px; color: var(--muted); }
.kpi .v { font-family: var(--mono); font-size: 24px; font-weight: 500; letter-spacing: -.03em; }
.kpi span:last-child { font-size: 12px; color: oklch(0.55 0.012 60); }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.filters input { flex: 1 1 240px; max-width: 340px; height: 38px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line-2); background: #fff; font-size: 14px; outline-color: var(--accent); }
.filters select, .table select { height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-2); background: #fff; font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 32px; padding: 0 12px; border-radius: 16px; border: 1px solid var(--line-2); background: transparent; font-size: 13px; display: flex; align-items: center; gap: 6px; white-space: nowrap; color: oklch(0.35 0.012 60); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip .mono { font-size: 11px; opacity: .7; }
.table { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow-x: auto; }
.tbl-inner { min-width: 820px; }
.tbl-inner.min520 { min-width: 640px; }
.row { display: grid; gap: 12px; align-items: center; padding: 11px 18px; border-bottom: 1px solid var(--line-3); font-size: 13.5px; }
.row.head { padding: 10px 18px; border-bottom-color: var(--line); font-size: 12px; color: var(--muted); }
.c-grid { grid-template-columns: minmax(220px, 2fr) 100px 100px 110px 80px 140px; }
.r-grid { grid-template-columns: 170px minmax(0, 1fr) 128px 60px; padding: 12px 18px; }
.vcell { display: flex; align-items: center; gap: 6px; }
.vcell .votes { min-width: 26px; }
.vcell .src { font-size: 11.5px; color: var(--muted); }
.mini { height: 26px; min-width: 30px; padding: 0 7px; border-radius: 7px; border: 1px solid var(--line-2); background: #fff; font-size: 12px; font-family: var(--mono); }
.card.thr { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 14px 18px; font-size: 13.5px; }
.card.thr input { width: 70px; height: 32px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line-2); background: #fff; font-family: var(--mono); font-size: 13px; }
.cust { display: flex; align-items: center; gap: 10px; min-width: 0; }
.av { flex: none; width: 30px; height: 30px; border-radius: 50%; color: oklch(0.3 0.02 60); font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.av0 { background: oklch(0.9 0.05 32); } .av1 { background: oklch(0.9 0.05 155); } .av2 { background: oklch(0.9 0.05 250); } .av3 { background: oklch(0.92 0.06 85); } .av4 { background: oklch(0.9 0.05 300); }
.cust-t { min-width: 0; display: flex; flex-direction: column; }
.cust-t span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cust-t span:first-child { font-weight: 500; }
.cust-t span:last-child { font-size: 12.5px; color: var(--muted); }
.st { justify-self: start; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 500; display: flex; align-items: center; white-space: nowrap; }
.st-active, .st-shipped { background: oklch(0.94 0.05 155); color: oklch(0.42 0.09 155); }
.st-past_due, .st-progress { background: oklch(0.94 0.05 70); color: oklch(0.45 0.1 60); }
.st-canceled, .st-exploring { background: oklch(0.94 0.008 70); color: oklch(0.5 0.012 60); }
.st-planned { background: oklch(0.94 0.04 250); color: oklch(0.42 0.1 250); }
.since { color: var(--body); }
.paid { font-family: var(--mono); font-size: 12.5px; text-align: right; }
.bv { display: flex; align-items: center; gap: 6px; font-size: 12.5px; white-space: nowrap; }
.bv i { width: 7px; height: 7px; border-radius: 50%; }
.bv.synced { color: var(--body); } .bv.synced i { background: oklch(0.65 0.12 155); }
.bv.pending { color: oklch(0.5 0.1 60); } .bv.pending i { background: oklch(0.75 0.14 70); }
.bv.unmapped { color: var(--muted); } .bv.unmapped i { background: oklch(0.8 0.01 60); }
.empty { padding: 28px 18px; font-size: 14px; color: var(--muted); }

/* Brevo */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.card-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; }
.brevo-top { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 16px; }
.brevo-top .grow { flex: 1 1 220px; display: flex; flex-direction: column; gap: 3px; }
.b-logo { width: 40px; height: 40px; border-radius: 10px; background: #0b996e; color: #fff; font-weight: 700; font-size: 17px; display: flex; align-items: center; justify-content: center; }
.b-name { display: flex; align-items: center; gap: 8px; }
.pill { height: 20px; padding: 0 7px; border-radius: 5px; font-size: 11.5px; font-weight: 500; display: inline-flex; align-items: center; }
.pill.ok { background: oklch(0.94 0.05 155); color: oklch(0.42 0.09 155); }
.pill.ko { background: oklch(0.94 0.05 30); color: oklch(0.5 0.15 30); }
.b-progress { flex-basis: 100%; display: flex; flex-direction: column; gap: 6px; }
.bar { height: 6px; border-radius: 3px; background: oklch(0.93 0.008 70); overflow: hidden; }
.bar > div { height: 100%; width: 100%; background: var(--accent); transition: width .2s; }
.map-row { display: grid; grid-template-columns: minmax(140px, 1fr) 20px minmax(200px, 1.4fr) 90px; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line-3); }
.map-row select { height: 36px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line-2); background: #fff; font-size: 13.5px; min-width: 0; }
.arrow { color: oklch(0.6 0.01 60); }
.count { text-align: right; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); gap: 16px; }
.toggle { display: flex; align-items: center; gap: 12px; padding: 10px 0; border: 0; border-top: 1px solid var(--line-3); background: none; text-align: left; width: 100%; }
.toggle .grow { display: flex; flex-direction: column; gap: 2px; }
.toggle .grow span:first-child { font-size: 14px; font-weight: 500; }
.toggle .grow span:last-child { font-size: 12.5px; color: var(--muted); }
.sw { flex: none; width: 36px; height: 20px; border-radius: 10px; background: oklch(0.85 0.008 70); position: relative; transition: background .2s; }
.sw::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: left .2s; }
.toggle[aria-checked="true"] .sw { background: var(--accent); }
.toggle[aria-checked="true"] .sw::after { left: 18px; }
.mapping > div { display: grid; grid-template-columns: 1fr 20px 1fr; align-items: center; gap: 8px; padding: 9px 0; border-top: 1px solid var(--line-3); font-size: 13.5px; }
.mapping .mono { font-size: 12.5px; }
.mapping span:nth-child(2) { color: oklch(0.6 0.01 60); }
.hist { display: grid; grid-template-columns: 150px minmax(0, 1fr) 70px; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line-3); font-size: 13.5px; align-items: baseline; }
.hist .when { color: var(--muted); font-size: 12.5px; }
.hist .s-Success { color: oklch(0.55 0.12 155); } .hist .s-Partial, .hist .s-Failed { color: oklch(0.6 0.13 60); }
.hist .errs { grid-column: 2 / -1; font-size: 12px; color: var(--muted); }

/* Demandes */
.seg { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: oklch(0.94 0.008 70); }
.seg button { height: 30px; padding: 0 12px; border-radius: 7px; border: 0; background: transparent; font-size: 13px; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.seg button[aria-pressed="true"] { background: #fff; box-shadow: 0 1px 2px oklch(0.2 0.01 60 / .12); }
.seg .mono { font-size: 11px; opacity: .7; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.dash { padding: 28px; border: 1px dashed oklch(0.85 0.008 70); border-radius: 14px; font-size: 14px; color: var(--muted); }
.pend { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.pend input { height: 38px; padding: 0 10px; margin: 0 -10px; border-radius: 8px; border: 1px solid transparent; background: transparent; font-size: 16px; font-weight: 600; outline-color: var(--accent); }
.pend input:hover { border-color: var(--line-2); }
.pend .desc { font-size: 14px; line-height: 1.5; color: oklch(0.42 0.012 60); }
.pend-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.pend-foot .meta { flex: 1 1 200px; font-size: 12.5px; color: var(--muted); }
.pend-foot select { height: 34px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line-2); background: #fff; font-size: 13px; }
.votes { font-family: var(--mono); font-size: 14px; }
.req-t { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.req-t span:first-child { font-size: 14.5px; font-weight: 600; }
.req-t span:last-child { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-grid select { font-weight: 500; border: 1px solid transparent; }
.rm { height: 30px; border: 0; background: none; color: oklch(0.5 0.16 30); font-size: 12.5px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; font-size: 13.5px; padding: 10px 16px; border-radius: 10px; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .4); z-index: 20; }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: column; gap: 12px; }
  .side-foot { flex-direction: row; flex-wrap: wrap; gap: 8px 16px; }
  .who { border: 0; padding: 0; }
  .map-row { grid-template-columns: 1fr; gap: 6px; }
  .count { text-align: left; }
}
