:root {
  --bg: #f5f4f0; --panel: #ffffff; --ink: #1d1f24; --muted: #6b6f78; --line: #e4e2dc;
  --accent: #0f6e5c; --accent-ink: #ffffff; --warn: #b4521a; --err: #b42318; --ok: #1e7a3d;
  --side: #14201d; --side-ink: #d7e2de;
  --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); display: flex; min-height: 100vh; }
a { color: var(--accent); }
code { background: #ecebe6; padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
h1 { font-size: 22px; margin: 0; }
h1 a { text-decoration: none; }
h2 { font-size: 15px; margin: 0 0 12px; }
.muted { color: var(--muted); }

.side { width: 220px; flex-shrink: 0; background: var(--side); color: var(--side-ink); padding: 22px 14px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { font-weight: 700; font-size: 17px; line-height: 1.2; margin: 0 8px 22px; color: #fff; }
.brand span { font-weight: 400; color: #9fc9bd; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a { color: var(--side-ink); text-decoration: none; padding: 7px 10px; border-radius: 7px; display: flex; justify-content: space-between; align-items: center; }
.side nav a:hover { background: rgba(255,255,255,.06); }
.side nav a.on { background: rgba(255,255,255,.12); color: #fff; }
.pill { background: #e8b04a; color: #1d1f24; border-radius: 99px; padding: 0 7px; font-size: 12px; }
.side-foot { margin-top: auto; font-size: 12.5px; padding: 0 8px; color: #9fb1ab; }
.side-foot a { color: #9fc9bd; }
.side-foot .mock { color: #e8b04a; }
.side-foot .live { color: #7fe0b5; }

main { flex: 1; padding: 26px 30px 60px; max-width: 1280px; min-width: 0; }
.head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; overflow-x: auto; }
.card.off { opacity: .6; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; align-items: start; }
.grid2 .card { margin-bottom: 0; }
.grid2 + .card { margin-top: 16px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; }
.stat span { color: var(--muted); font-size: 12.5px; }
.stat b { font-size: 24px; font-variant-numeric: tabular-nums; }
.stat small { color: var(--muted); }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 8px; border-bottom: 1px solid #f0eee9; vertical-align: middle; }
tr.off td { color: var(--muted); }
tr.hl td { background: #fff7e0; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.actions { display: flex; gap: 6px; }

.btn { display: inline-block; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 7px 14px; border-radius: 8px; cursor: pointer; font: inherit; text-decoration: none; }
.btn:hover { border-color: #c8c5bd; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.primary[disabled] { opacity: .6; cursor: progress; }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.icon { border: 0; background: none; cursor: pointer; font-size: 17px; opacity: .25; }
.icon.on { opacity: 1; }
.toggle { border: 1px solid var(--line); border-radius: 99px; background: #f3f2ee; color: var(--muted); padding: 2px 11px; cursor: pointer; font: inherit; font-size: 12.5px; }
.toggle.on { background: #dff3ea; border-color: #b7e0cd; color: var(--ok); }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
form { margin: 0; }

label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
input, select, textarea { font: inherit; color: var(--ink); border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px; background: #fff; }
textarea { width: 100%; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; }
form.inline { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
form.inline input:not([type=checkbox]) { width: 150px; }
form.stack { display: flex; flex-direction: column; gap: 8px; }
form.stack small { margin-top: -4px; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; border: 1px solid; }
.flash.ok { background: #e9f6ee; border-color: #bfe3cc; color: #14532d; }
.flash.err { background: #fdecea; border-color: #f5c2bd; color: #7a1a12; }
.flash.info { background: #eef4f8; border-color: #cddfea; color: #1f3d52; }

.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs a { padding: 6px 12px; border-radius: 99px; text-decoration: none; color: var(--ink); border: 1px solid var(--line); background: #fff; }
.tabs a.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.tabs small { opacity: .6; margin-left: 3px; }

.lvl { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.lvl.erreur_probable { background: #fde2e1; color: #9b1c1c; }
.lvl.top { background: #ffe8d1; color: #9a4410; }
.lvl.bon_plan { background: #dff3ea; color: #1e6b45; }
.lvl.prix_cible { background: #e3ecfb; color: #1e4a8a; }
.lvl.excellent_prix { background: #efe7fb; color: #5b2d91; }
.tabs.sub { margin-top: -6px; }
.tabs.sub a { font-size: 13px; }
.st { font-size: 12px; padding: 2px 8px; border-radius: 6px; background: #f0eee9; color: var(--muted); white-space: nowrap; }
.st.nouveau, .st.en_cours { background: #fff3cd; color: #7a5a00; }
.st.envoye, .st.ok { background: #dff3ea; color: var(--ok); }
.st.rejete, .st.erreur { background: #fde2e1; color: var(--err); }
.pl.low { color: var(--ok); font-weight: 600; }
.pl.high { color: var(--err); }

.facts { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.big { font-size: 22px; }

details.scan summary { cursor: pointer; }
details.scan pre { white-space: pre-wrap; font-size: 12.5px; background: #f7f6f2; padding: 12px; border-radius: 8px; margin: 12px 0 0; max-height: 420px; overflow: auto; }

.bars { display: flex; align-items: flex-end; gap: 4px; height: 190px; padding-top: 18px; overflow-x: auto; }
.bar { flex: 1; min-width: 28px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; }
.bar i { display: block; width: 70%; background: var(--accent); border-radius: 4px 4px 0 0; opacity: .85; }
.bar .val { font-size: 10.5px; color: var(--muted); }
.bar .lbl { font-size: 10.5px; color: var(--muted); margin-top: 3px; }
.bars.dense { gap: 1px; height: 160px; }
.bars.dense .bar { min-width: 4px; }
.bars.dense .bar i { width: 100%; border-radius: 1px 1px 0 0; }
.bars.dense .bar .lbl { position: absolute; bottom: -16px; left: 0; white-space: nowrap; font-size: 10px; }
.bars.dense { padding-bottom: 18px; }
.bar.hot i { background: #d64545; opacity: 1; }
.small-list { padding-left: 18px; font-size: 13px; }

body.login { align-items: center; justify-content: center; }
.login-card { width: 340px; display: flex; flex-direction: column; gap: 12px; }
.login-card h1 { font-size: 20px; }
.login-card p { margin: 0; }

@media (max-width: 760px) {
  body { flex-direction: column; }
  .side { width: 100%; height: auto; position: static; }
  .side nav { flex-direction: row; flex-wrap: wrap; }
  main { padding: 16px; }
  .grid2 { grid-template-columns: 1fr; }
}

/* critères (recherche flexible, profils) */
.crit fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin: 0 0 12px; }
.crit legend { font-weight: 600; padding: 0 6px; }
.crit label.check { display: inline-flex; align-items: center; gap: 4px; margin: 3px 12px 3px 0; white-space: nowrap; }
.crit-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.crit-row select[multiple] { min-width: 180px; }
.crit-sub { margin-top: 8px; }
.crit-sub > .muted { margin-right: 6px; }
pre.msg { white-space: pre-wrap; background: #faf9f6; border: 1px solid var(--line); border-radius: 8px; padding: 12px; font-size: 13px; }
details { margin-top: 8px; }
details summary { cursor: pointer; }
div.inline { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
div.inline input:not([type=checkbox]):not([type=date]) { width: 150px; }
small.hint { color: #9a4410; white-space: nowrap; }
