:root {
  --bg: #f4f5f7; --panel: #ffffff; --text: #16181d; --muted: #646b78; --border: #dfe2e8;
  --accent: #2f6fde; --ok: #1f9d55; --warn: #d98a00; --bad: #d64545; --bad-bg: #fdecec;
  --s-buy_hold: #8a8f99; --s-regime_hold: #2f6fde; --s-momentum_rotation: #e07b24; --s-combo: #1f9d55;
  --s-reference: #8a8f99; --s-tendance_vol: #2f6fde; --s-cassure_max: #e07b24; --s-rotation_dual: #1f9d55;
  --s-regime_btc: #8e44ad; --s-rebond_asym: #d64545; --s-parite_risque: #b8860b;
  --s-scalp_rebond: #0e9aa7; --s-scalp_cassure: #c2185b; --s-seance_soir: #5d6d7e; --s-grille: #7cb342;
  --s-orb_30min: #ef6c00; --s-vwap_rebond: #1565c0; --s-ema_9_21: #2e7d32; --s-williams_vb: #6a1b9a;
  --s-rsi2_connors: #ad1457; --s-holy_grail: #f9a825; --s-bollinger_squeeze: #00838f; --s-turtle_soup: #4e342e;
  --s-adaptatif_v1: #1f9d55; --s-adaptatif_v2: #c2185b; --s-carry_toujours: #1f9d55; --s-carry_filtre: #0e9aa7; --s-regime_ls: #2f6fde; --s-carry_regime: #e07b24; --s-ls_btc: #2f6fde; --s-ls_propre: #d64545; --s-ls_btc_news: #8e44ad; --s-ls_propre_news: #b8860b; --s-long_cash_btc: #1f9d55; --s-v4_reference: #8e44ad; --s-v5a_pleine_toujours: #e07b24; --s-v5b_pleine_en_forte_hausse: #b8860b; --s-v5c_stop6_en_forte_hausse: #1f9d55; --s-v5d_pleine_et_stop6_en_forte_hausse: #2f6fde; --s-v2_double_creux: #2f6fde; --s-v2_drapeau: #e07b24; --s-v2_cassure_retest: #8e44ad; --s-v2_toutes: #c2185b; --s-a_base: #2f6fde; --s-b_news: #e07b24; --s-c_choc: #8e44ad; --s-d_news_choc: #d64545; --s-e_news_choc_structure: #1f9d55;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115; --panel: #181b22; --text: #e8eaef; --muted: #9aa1ad; --border: #2a2f3a;
    --accent: #6c9bff; --ok: #3fcf7f; --warn: #f2b33d; --bad: #ff6b6b; --bad-bg: #3a1d1f;
    --s-buy_hold: #9aa1ad; --s-regime_hold: #6c9bff; --s-momentum_rotation: #ff9f4a; --s-combo: #3fcf7f;
    --s-reference: #9aa1ad; --s-tendance_vol: #6c9bff; --s-cassure_max: #ff9f4a; --s-rotation_dual: #3fcf7f;
    --s-regime_btc: #c08bff; --s-rebond_asym: #ff6b6b; --s-parite_risque: #e8c45a;
    --s-scalp_rebond: #4dd0e1; --s-scalp_cassure: #f06292; --s-seance_soir: #b0bec5; --s-grille: #aed581;
    --s-orb_30min: #ffa726; --s-vwap_rebond: #64b5f6; --s-ema_9_21: #81c784; --s-williams_vb: #ba68c8;
    --s-rsi2_connors: #f48fb1; --s-holy_grail: #fff176; --s-bollinger_squeeze: #4dd0e1; --s-turtle_soup: #bcaaa4;
    --s-adaptatif_v1: #3fcf7f; --s-adaptatif_v2: #f06292; --s-carry_toujours: #3fcf7f; --s-carry_filtre: #4dd0e1; --s-regime_ls: #6c9bff; --s-carry_regime: #ff9f4a; --s-ls_btc: #6c9bff; --s-ls_propre: #ff6b6b; --s-ls_btc_news: #c08bff; --s-ls_propre_news: #e8c45a; --s-long_cash_btc: #3fcf7f; --s-v4_reference: #c08bff; --s-v5a_pleine_toujours: #ff9f4a; --s-v5b_pleine_en_forte_hausse: #e8c45a; --s-v5c_stop6_en_forte_hausse: #3fcf7f; --s-v5d_pleine_et_stop6_en_forte_hausse: #6c9bff; --s-v2_double_creux: #6c9bff; --s-v2_drapeau: #ff9f4a; --s-v2_cassure_retest: #c08bff; --s-v2_toutes: #f06292; --s-a_base: #6c9bff; --s-b_news: #ff9f4a; --s-c_choc: #c08bff; --s-d_news_choc: #ff6b6b; --s-e_news_choc_structure: #3fcf7f;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); max-width: 100%; overflow-x: hidden;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
header { position: sticky; top: 0; z-index: 5; background: var(--panel); border-bottom: 1px solid var(--border);
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); display: flex; align-items: center; gap: 12px; }
header h1 { font-size: 17px; margin: 0; flex: 1; }
nav { display: flex; gap: 4px; overflow-x: auto; max-width: 100%; min-width: 0; padding: 8px 16px; background: var(--panel);
  border-bottom: 1px solid var(--border); scrollbar-width: none; }
nav button { flex: none; border: 0; background: none; color: var(--muted); padding: 8px 12px; border-radius: 8px;
  font: inherit; cursor: pointer; }
nav button.active { background: var(--bg); color: var(--text); font-weight: 600; }
main { max-width: 1100px; margin: 0 auto; padding: 16px; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
section[hidden] { display: none; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.card h2 { font-size: 15px; margin: 0 0 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.agent { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.agent b { display: block; text-transform: capitalize; }
.agent small { color: var(--muted); }
.gauge b { text-transform: none; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; background: var(--muted); }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); }
.banner { border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; font-weight: 600; }
.banner.ok { background: var(--panel); border: 1px solid var(--border); }
.banner.bad { background: var(--bad-bg); color: var(--bad); border: 1px solid var(--bad); }
.btn { border: 1px solid var(--border); background: var(--panel); color: var(--text); padding: 9px 14px;
  border-radius: 9px; font: inherit; cursor: pointer; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; font-weight: 700; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.kill-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.pos { color: var(--ok); } .neg { color: var(--bad); }
.scroll { overflow-x: auto; }
.chart-wrap { position: relative; width: 100%; height: 320px; }
canvas { width: 100%; height: 100%; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; font-size: 14px; }
.legend span::before { content: ""; display: inline-block; width: 12px; height: 3px; margin-right: 6px;
  vertical-align: middle; background: var(--c); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
select, input[type=text], input[type=password] { font: inherit; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text); }
dl.cmds dt { font-family: ui-monospace, Consolas, monospace; font-weight: 600; margin-top: 10px; word-break: break-all; }
dl.cmds dd { margin: 2px 0 0; color: var(--muted); }
.alert-item { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.alert-item:last-child { border-bottom: 0; }
.model-item { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.model-item:last-child { border-bottom: 0; }
details summary { cursor: pointer; margin-top: 8px; }
details.wallet { padding: 12px 16px; }
details.wallet > summary { margin: 0; font-weight: 600; }
details.wallet[open] > summary { margin-bottom: 10px; }
.note { font-size: 13px; color: var(--muted); margin-top: 8px; }
dialog { border: 1px solid var(--border); border-radius: 14px; background: var(--panel); color: var(--text);
  padding: 20px; width: 420px; max-width: calc(100% - 32px); }
dialog::backdrop { background: rgba(0, 0, 0, .55); }
dialog label { display: block; margin: 12px 0 4px; font-size: 14px; }
dialog input { width: 100%; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login form { width: min(360px, 100%); }
.login label { display: block; margin: 12px 0 4px; font-size: 14px; }
.login input { width: 100%; }
.login .btn { width: 100%; margin-top: 18px; background: var(--accent); border-color: var(--accent); color: #fff; }
.error { color: var(--bad); min-height: 1.5em; margin-top: 10px; font-size: 14px; }
.pattern-title { font-size: 0.95rem; margin: 12px 0 4px; }
.pattern-list { margin: 0; padding-left: 1.4em; display: grid; gap: 6px; font-size: 0.9rem; line-height: 1.45; }
.pattern-list li::marker { font-weight: 600; }
.pattern-list .ok { color: var(--ok); } .pattern-list .ko { color: var(--bad); } .pattern-list .muted { color: var(--muted); }
.scan-row { cursor: pointer; } .scan-row:hover td { background: var(--bg); }
