/* TradeBot Ultimate — interface PWA. Thème clair/sombre par jetons CSS. */
/* Palette « encre & or » : sobre, contrastée, lisible ; l'or est réservé à la marque et aux accents rares. */
:root {
  --bg: #f3f5f9; --surface: #ffffff; --surface-2: #eef1f6; --surface-3: #e2e7ef; --border: #dde3ec;
  --text: #0f1722; --text-2: #465264; --text-3: #6b7689;
  --accent: #2553c7; --accent-2: #1b40a0; --accent-soft: #e6edfb;
  --gold: #a88532; --gold-soft: #f6efdc;
  --up: #0f7a3d; --up-soft: #e0f2e7; --down: #c0322b; --down-soft: #fbe6e5; --warn: #946200; --warn-soft: #fff2d1;
  --shadow: 0 1px 2px rgba(15,23,34,.05), 0 6px 18px -8px rgba(15,23,34,.12);
  --shadow-lg: 0 24px 60px -24px rgba(15,23,34,.35);
  --radius: 14px; --radius-sm: 9px;
  --sans: "Inter", "SF Pro Text", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Inter Display", "SF Pro Display", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;
  --nav-w: 244px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0e15; --surface: #111721; --surface-2: #161e2b; --surface-3: #1e2838; --border: #232e40;
    --text: #e9eef6; --text-2: #aeb9ca; --text-3: #7f8ba0;
    --accent: #6f9eff; --accent-2: #9cbcff; --accent-soft: #15254a;
    --gold: #d6b264; --gold-soft: #2c2412;
    --up: #3ec27a; --up-soft: #0f2e1d; --down: #ff6f66; --down-soft: #381617; --warn: #e3ad45; --warn-soft: #33270c;
    --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 8px 24px -12px rgba(0,0,0,.6);
    --shadow-lg: 0 30px 80px -30px rgba(0,0,0,.8); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0e15; --surface: #111721; --surface-2: #161e2b; --surface-3: #1e2838; --border: #232e40;
  --text: #e9eef6; --text-2: #aeb9ca; --text-3: #7f8ba0;
  --accent: #6f9eff; --accent-2: #9cbcff; --accent-soft: #15254a;
  --gold: #d6b264; --gold-soft: #2c2412;
  --up: #3ec27a; --up-soft: #0f2e1d; --down: #ff6f66; --down-soft: #381617; --warn: #e3ad45; --warn-soft: #33270c;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 8px 24px -12px rgba(0,0,0,.6);
  --shadow-lg: 0 30px 80px -30px rgba(0,0,0,.8); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.55 var(--sans); -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01", "tnum" 0; text-rendering: optimizeLegibility; }
::selection { background: var(--accent-soft); color: var(--text); }
.noscript { padding: 24px; }
svg.icon { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: -3px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font: 650 24px/1.25 var(--display); margin: 0 0 4px; letter-spacing: -.02em; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 0 0 8px; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; }
p { color: var(--text-2); margin: 0 0 10px; }
.muted { color: var(--text-3); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 13px; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.up { color: var(--up); } .down { color: var(--down); }
.hidden { display: none !important; }

/* ---------- structure ---------- */
.app { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); min-height: 100vh; }
.nav { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--border);
  padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 18px; margin-bottom: 6px; border-bottom: 1px solid var(--border); }
.brand img { width: 36px; height: 36px; border-radius: 50%; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--gold); }
.brand b { display: block; font: 700 15px/1.1 var(--display); letter-spacing: -.01em; }
.brand small { display: block; font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); font-weight: 600; margin-top: 3px; }
.nav .section { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); font-weight: 600; padding: 14px 10px 4px; }
.nav a { position: relative; display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500; font-size: 14.5px; }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold); }
.nav .ico { width: 20px; display: inline-flex; justify-content: center; }
.nav .spacer { flex: 1; }
.main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 12px 24px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.topbar .title { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content { padding: 24px; max-width: 1280px; margin: 0 auto; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); display: inline-block; }
.live-dot.on { background: var(--up); box-shadow: 0 0 0 3px var(--up-soft); }

/* ---------- mode Simulation / Réel ---------- */
.mode { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.mode button { border: 0; background: none; color: var(--text-2); font: 600 13px var(--sans); padding: 6px 12px; border-radius: 999px; cursor: pointer; }
.mode button.on.paper { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }
.mode button.on.live { background: var(--down); color: #fff; }
.banner-live { background: var(--down-soft); color: var(--down); border-bottom: 1px solid var(--down); padding: 6px 24px; font-size: 13px; font-weight: 600; }

/* ---------- composants ---------- */
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.card.clickable { cursor: pointer; transition: border-color .15s; }
.card.clickable:hover { border-color: var(--accent); }
.card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.kpi .label { font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.kpi .value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.kpi .sub { font-size: 13px; color: var(--text-3); }
.section { margin-top: 24px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }

.badge { display: inline-flex; align-items: center; gap: 4px; font: 600 11.5px/1 var(--sans); padding: 4px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.badge.ok { background: var(--up-soft); color: var(--up); }
.badge.bad { background: var(--down-soft); color: var(--down); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.info { background: var(--accent-soft); color: var(--accent); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font: 600 14px var(--sans); padding: 8px 14px; border-radius: var(--radius-sm); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { background: var(--down); border-color: var(--down); color: #fff; }
.btn.ghost { border-color: transparent; background: none; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

label.field { display: block; font-size: 13px; color: var(--text-2); font-weight: 600; }
label.field > span { display: block; margin-bottom: 5px; }
input, select, textarea { width: 100%; font: 15px var(--sans); color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 11px; }
input[type="checkbox"], input[type="radio"] { width: auto; flex: none; margin: 0; padding: 0; accent-color: var(--accent); }
label.row { flex-wrap: nowrap; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input.code { font: 600 22px var(--mono); letter-spacing: .3em; text-align: center; }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.error { color: var(--down); font-size: 13px; min-height: 18px; }
.info-msg { color: var(--up); font-size: 13px; min-height: 18px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th { background: var(--surface-2); color: var(--text-2); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 50%, transparent); }
td.empty { text-align: center; color: var(--text-3); padding: 24px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; overflow-x: auto; }
.tabs button { border: 0; background: none; color: var(--text-2); font: 600 14px var(--sans); padding: 9px 12px; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }

.chart { width: 100%; height: 220px; display: block; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--text-3); font: 11px var(--sans); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; }
.chart .area { fill: var(--accent-soft); opacity: .7; }
.chart .line.up { stroke: var(--up); } .chart .area.up { fill: var(--up-soft); }
.chart .line.down { stroke: var(--down); } .chart .area.down { fill: var(--down-soft); }

.news-item { padding: 10px 0; border-bottom: 1px solid var(--border); }
.news-item:last-child { border-bottom: 0; }
.news-item .t { font-weight: 600; color: var(--text); }
.news-item .m { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--border); background: var(--surface); color: var(--text-2); padding: 5px 10px; border-radius: 999px; font: 600 12.5px var(--sans); cursor: pointer; }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.tranche { display: grid; grid-template-columns: 40px 1fr auto; gap: 8px; align-items: center; padding: 6px 0; }
.bar { height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.bar > div { height: 100%; background: var(--accent); }

/* ---------- authentification ---------- */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(420px, .95fr); background: var(--bg); }
.auth-hero { position: relative; overflow: hidden; color: #eef2f8; padding: 56px 64px; display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(214,178,100,.18), transparent 60%),
    radial-gradient(700px 600px at 110% 110%, rgba(111,158,255,.20), transparent 60%),
    linear-gradient(160deg, #0b1220 0%, #0a0f19 55%, #070a11 100%); }
.auth-hero::before { content: ""; position: absolute; inset: 0; opacity: .5; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: radial-gradient(ellipse at 30% 40%, #000 30%, transparent 75%); }
.auth-hero::after { content: ""; position: absolute; left: -10%; right: -10%; bottom: 18%; height: 180px; opacity: .55; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(214,178,100,.55), rgba(111,158,255,.55), transparent) center / 100% 1.5px no-repeat;
  transform: rotate(-8deg); filter: blur(.3px); }
.auth-hero > * { position: relative; z-index: 1; }
.hero-brand { display: flex; align-items: center; gap: 14px; }
.hero-brand img { width: 52px; height: 52px; border-radius: 50%; box-shadow: 0 0 0 2px #0b1220, 0 0 0 3.5px #d6b264, 0 10px 30px -8px rgba(214,178,100,.6); }
.hero-brand b { font: 700 19px/1.1 var(--display); letter-spacing: -.01em; display: block; }
.hero-brand small { color: #d6b264; letter-spacing: .2em; text-transform: uppercase; font-size: 11px; font-weight: 600; }
.hero-copy { max-width: 540px; margin: 48px 0; }
.hero-copy .kicker { color: #d6b264; font-size: 12px; letter-spacing: .22em; text-transform: uppercase; font-weight: 600; margin-bottom: 18px; }
.hero-copy h1 { font: 650 clamp(30px, 3.4vw, 44px)/1.12 var(--display); letter-spacing: -.03em; color: #f5f7fb; margin: 0 0 18px; }
.hero-copy h1 em { font-style: normal; background: linear-gradient(90deg, #f0d79a, #d6b264 60%, #b88f3c); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-copy p { color: #a9b5c7; font-size: 16px; line-height: 1.65; margin: 0; }
.hero-features { display: grid; gap: 14px; max-width: 520px; }
.hero-feature { display: grid; grid-template-columns: 40px 1fr; gap: 14px; align-items: start; }
.hero-feature .ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; color: #d6b264;
  background: rgba(214,178,100,.08); border: 1px solid rgba(214,178,100,.22); }
.hero-feature .ic svg { width: 20px; height: 20px; }
.hero-feature b { display: block; color: #eef2f8; font-size: 14.5px; font-weight: 600; }
.hero-feature span { color: #8f9bb0; font-size: 13.5px; }
.hero-foot { color: #6f7b90; font-size: 12.5px; display: flex; gap: 18px; flex-wrap: wrap; margin-top: 40px; }
.hero-foot span { display: inline-flex; align-items: center; gap: 6px; }
.hero-foot svg { width: 14px; height: 14px; color: #d6b264; }

.auth-panel { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 410px; }
.auth-card .mobile-brand { display: none; }
.auth-card h2 { font: 650 26px/1.2 var(--display); letter-spacing: -.02em; margin: 0 0 6px; color: var(--text); }
.auth-card .lead { color: var(--text-3); margin: 0 0 26px; font-size: 14.5px; }
.steps-mini { display: flex; gap: 8px; margin: 0 0 22px; }
.steps-mini span { flex: 1; height: 3px; border-radius: 3px; background: var(--surface-3); }
.steps-mini span.on { background: linear-gradient(90deg, var(--accent), var(--gold)); }
.input-wrap { position: relative; }
.input-wrap > svg.icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.input-wrap input { padding-left: 40px; height: 46px; border-radius: 11px; background: var(--surface); }
.input-wrap input.code { padding-left: 11px; height: 56px; }
.input-wrap .reveal { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--text-3);
  padding: 8px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.input-wrap .reveal:hover { color: var(--text); background: var(--surface-2); }
.auth-card .btn.primary.block { width: 100%; height: 48px; font-size: 15px; border-radius: 11px; letter-spacing: .01em;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 92%, #fff), var(--accent)); box-shadow: 0 10px 24px -12px var(--accent); }
.auth-card .btn.primary.block:hover { filter: brightness(1.05); }
.auth-note { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; color: var(--text-3); margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.auth-note svg { color: var(--gold); width: 16px; height: 16px; margin-top: 1px; }
.auth-signup { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); text-align: center; font-size: 13px; color: var(--text-2); }
.auth-legal { margin-top: 26px; font-size: 11.5px; color: var(--text-3); text-align: center; }
.qr { background: #fff; border-radius: 14px; padding: 12px; width: 212px; margin: 6px auto; box-shadow: var(--shadow); }
.qr svg { width: 100%; height: auto; display: block; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font: 600 14px var(--mono); background: var(--surface-2); padding: 14px; border-radius: 11px; border: 1px dashed var(--border); }
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
@media (max-width: 960px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-card .mobile-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
  .auth-card .mobile-brand img { width: 44px; height: 44px; border-radius: 50%; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--gold); }
  .auth-card .mobile-brand b { font: 700 17px var(--display); display: block; }
  .auth-card .mobile-brand small { color: var(--gold); font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; font-weight: 600; }
}

/* ---------- fenêtres modales & notifications ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(8, 12, 20, .55); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; padding: 22px; }
.modal.wide { max-width: 920px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: var(--radius-sm); box-shadow: var(--shadow); font-size: 14px; }
.toast.error { background: var(--down); color: #fff; }
.toast.ok { background: var(--up); color: #fff; }
.callout { border-left: 3px solid var(--accent); background: var(--accent-soft); padding: 10px 14px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: 14px; color: var(--text); }
.callout.warn { border-color: var(--warn); background: var(--warn-soft); }
.callout.bad { border-color: var(--down); background: var(--down-soft); }
.callout.ok { border-color: var(--up); background: var(--up-soft); }
iframe.report { width: 100%; height: 75vh; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 6px; height: 16px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- mobile : barre d'onglets en bas ---------- */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .nav { position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; z-index: 20; flex-direction: row; justify-content: space-around;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--border); overflow-x: auto; }
  .nav .brand, .nav .spacer, .nav .label-long, .nav .section { display: none; }
  .nav a.active::before { display: none; }
  .nav a { flex-direction: column; gap: 2px; padding: 6px 8px; font-size: 11px; }
  .nav .ico { font-size: 18px; }
  .main { padding-bottom: 72px; }
  .content { padding: 16px; }
  .topbar { padding: 10px 16px; }
  .kpi .value { font-size: 19px; }
  .hide-mobile { display: none; }
}
.skeleton.boot { width: 160px; }

/* ---------- ticket d'ordre & avis IA ---------- */
[hidden] { display: none !important; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.seg button { border: 0; background: var(--surface); color: var(--text-2); font: 600 14px var(--sans); padding: 8px 16px; cursor: pointer; }
.seg button.on { background: var(--accent); color: #fff; }
.seg button.on.sell { background: var(--down); }
.ticket { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; }
.ticket .pane { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.fact { background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 10px; }
.fact .k { font-size: 11.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .03em; }
.fact .v { font: 600 15px var(--sans); margin-top: 2px; font-variant-numeric: tabular-nums; }
.ai-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.ai-card ul { margin: 0; padding-left: 18px; font-size: 13.5px; }
.meter { width: 100%; height: 6px; appearance: none; border: 0; border-radius: 3px; overflow: hidden; background: var(--surface-3); }
.meter::-webkit-progress-bar { background: var(--surface-3); }
.meter::-webkit-progress-value { background: var(--accent); }
.meter::-moz-progress-bar { background: var(--accent); }
.md { font-size: 14px; line-height: 1.55; white-space: pre-wrap; }
@media (max-width: 860px) { .ticket { grid-template-columns: 1fr; } }

/* ---------- avatars ---------- */
.avatar { display: inline-grid; place-items: center; border-radius: 50%; flex: none; object-fit: cover; color: #fff;
  font: 650 13px/1 var(--display); letter-spacing: .02em; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--border); }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.md { width: 34px; height: 34px; }
.avatar.lg { width: 88px; height: 88px; font-size: 30px; box-shadow: 0 0 0 3px var(--surface), 0 0 0 4.5px var(--gold); }
.avatar svg.icon { width: 55%; height: 55%; }
.av-or { background: linear-gradient(135deg, #f0d79a, #b88f3c); color: #2a1f08; }
.av-saphir { background: linear-gradient(135deg, #6f9eff, #1b3fa0); }
.av-emeraude { background: linear-gradient(135deg, #58d39a, #0f6b43); }
.av-rubis { background: linear-gradient(135deg, #ff8a80, #a3212a); }
.av-graphite { background: linear-gradient(135deg, #5b6576, #1c2230); }
.av-ivoire { background: linear-gradient(135deg, #fbf7ee, #d9ccb0); color: #3b3222; }
.av-taureau { background: linear-gradient(135deg, #3ec27a, #0c5a33); }
.av-ours { background: linear-gradient(135deg, #ff6f66, #7a1b1f); }
.user-chip { display: inline-flex; align-items: center; gap: 9px; padding: 3px 10px 3px 3px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer; }
.user-chip:hover { border-color: var(--gold); text-decoration: none; }
.avatar-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.avatar-grid button { border: 0; background: none; padding: 3px; border-radius: 50%; cursor: pointer; outline-offset: 3px; }
.avatar-grid button.on .avatar { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--gold); }
.avatar-grid button:focus-visible { outline: 2px solid var(--accent); }

/* ---------- impression (dossier fiscal, rapports) ---------- */
@media print {
  .nav, .topbar, .banner-live, .no-print, .btn, .toasts { display: none !important; }
  .app { display: block; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  .content { padding: 0; max-width: none; }
}

/* ---------- graphiques d'aide à la décision ---------- */
.spark { width: 110px; height: 30px; display: block; }
.spark .line { fill: none; stroke-width: 1.8; stroke: var(--accent); }
.spark .line.up { stroke: var(--up); } .spark .line.down { stroke: var(--down); }
.bars { width: 100%; display: block; }
.bars .bar.up { fill: var(--up); opacity: .85; } .bars .bar.down { fill: var(--down); opacity: .85; }
.bars .lbl { fill: var(--text-2); font-size: 12px; }
.gauge { width: 110px; height: 64px; }
.gauge .g-track { fill: none; stroke: var(--surface-3); stroke-width: 9; stroke-linecap: round; }
.gauge .g-value { fill: none; stroke: url(#none); stroke: var(--gold); stroke-width: 9; stroke-linecap: round; }
.gauge .g-text { fill: var(--text); font: 700 18px var(--display); }
.metric-card { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; }
.metric-card .name { font-size: 13px; color: var(--text-2); font-weight: 600; }
.metric-card .val { font: 650 19px var(--display); font-variant-numeric: tabular-nums; }
.metric-card .meta { font-size: 12px; color: var(--text-3); grid-column: 1 / -1; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.pill.gold { background: var(--gold-soft); color: var(--gold); border-color: transparent; }
.status-allumage { color: var(--up); font-weight: 700; } .status-poursuite { color: var(--accent); font-weight: 600; }
.status-essoufflement { color: var(--warn); } .status-chute { color: var(--down); font-weight: 700; } .status-calme { color: var(--text-3); }
.linkish { cursor: pointer; } .linkish:hover { color: var(--accent); }
.hero-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }

/* ---------- notifications ---------- */
.bell { position: relative; }
.bell-count { position: absolute; top: 0; right: 0; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
  background: var(--down); color: #fff; font: 700 10px/16px var(--sans); text-align: center; }
.notif-list { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow-y: auto; }
.notif { display: block; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); }
.notif:hover { text-decoration: none; border-color: var(--accent); }
.notif.unread { border-left: 3px solid var(--gold); background: var(--surface-2); }
.notif.p5 { border-left-color: var(--down); }
.checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 6px 14px; }

/* ---------- administration : réglages de l'agent, intégrations ---------- */
.settings-card h2 { scroll-margin-top: 80px; }
.settings-grid { display: grid; gap: 14px 22px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.param { display: grid; gap: 5px; align-content: start; padding: 10px 12px; border: 1px solid transparent; border-radius: var(--radius-sm); }
.param.overridden { background: var(--gold-soft); border-color: color-mix(in srgb, var(--gold) 35%, transparent); }
.param-label { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.param-label .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); flex: none; }
.param-input { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; }
.param-input input:not([type="checkbox"]), .param-input select { min-width: 0; max-width: 100%; }
.param-input input[type="number"] { width: 110px; }
.param-input .unit { font-size: 12.5px; color: var(--text-3); white-space: nowrap; }
.param-input.changed input, .param-input.changed select { outline: 2px solid var(--gold); outline-offset: 1px; }
input.switch { appearance: none; width: 40px; height: 22px; border-radius: 999px; background: var(--surface-3); position: relative; cursor: pointer; transition: background .15s; flex: none; margin: 0; border: 0; }
input.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform .15s; }
input.switch:checked { background: var(--accent); }
input.switch:checked::after { transform: translateX(18px); }
input.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.save-bar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 16px;
  padding: 12px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.save-bar.dirty { border-color: var(--gold); }
.save-bar .spacer { flex: 1; }
.integ-card { display: flex; flex-direction: column; gap: 6px; }
.integ-card.on { border-color: color-mix(in srgb, var(--up) 45%, var(--border)); }
.integ-card details summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.integ-card details ol { padding-left: 18px; margin: 8px 0; }
.integ-card .tools { word-break: break-word; margin: 6px 0; }
.integ-card > .row:last-child { margin-top: auto; flex-wrap: wrap; }
pre.mono { white-space: pre-wrap; background: var(--surface-2); padding: 10px 12px; border-radius: var(--radius-sm); overflow-x: auto; margin: 0; }
.settings-card .table-wrap { overflow-x: auto; }
.settings-card td select { min-width: 190px; }
.settings-card td .param-input .unit { display: none; }
.strategy-card.on { border-top: 3px solid var(--accent); }
.strategy-card.off { opacity: .82; }
.strategy-card h2 { margin: 0; }
.strategy-card ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------- vision long terme ---------- */
.donut { width: 180px; height: 180px; flex: none; }
.donut .seg { stroke: var(--surface); stroke-width: 1.5; }
.donut .s0, .legend .s0 { fill: #2553c7; background: #2553c7; } .donut .s1, .legend .s1 { fill: #a88532; background: #a88532; }
.donut .s2, .legend .s2 { fill: #0f7a3d; background: #0f7a3d; } .donut .s3, .legend .s3 { fill: #8a4fbf; background: #8a4fbf; }
.donut .s4, .legend .s4 { fill: #c0322b; background: #c0322b; } .donut .s5, .legend .s5 { fill: #0a7f93; background: #0a7f93; }
.donut .s6, .legend .s6 { fill: #946200; background: #946200; } .donut .s7, .legend .s7 { fill: #6b7689; background: #6b7689; }
.donut .d-center { fill: var(--text); font: 700 14px var(--sans); } .donut .d-sub { fill: var(--text-3); font: 10px var(--sans); }
.legend { display: grid; gap: 6px; font-size: 13px; }
.legend .item { display: flex; align-items: center; gap: 8px; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.lt-kpis .kpi .value { font-size: 20px; }
.pick { display: flex; flex-direction: column; gap: 8px; border-left: 3px solid var(--border); }
.pick.below { border-left-color: var(--up); box-shadow: 0 0 0 1px color-mix(in srgb, var(--up) 40%, transparent), var(--shadow); }
.pick .pick-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.pick .price { text-align: right; font-variant-numeric: tabular-nums; }
.pick .price .p { font-size: 18px; font-weight: 700; }
.pillars { display: grid; gap: 3px; font-size: 12.5px; }
.pillars .pl { display: flex; justify-content: space-between; gap: 8px; cursor: help; }
.pillars .dots { letter-spacing: 2px; font-size: 12px; }
.pillars .dots.hi { color: var(--up); } .pillars .dots.lo { color: var(--down); } .pillars .dots.mid { color: var(--warn); }
.scen { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; }
.scen span { padding: 3px 8px; border-radius: 999px; background: var(--surface-2); }
.scen .optimiste { color: var(--up); } .scen .prudent { color: var(--down); }
.trap { border-left: 3px solid var(--down); }
.lt-theme summary { cursor: pointer; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; padding: 4px 0; }
.lt-theme[open] summary { margin-bottom: 10px; }
.tf-switch { margin: 8px 0; }
.line-study { border: 1px solid var(--accent); }
.md-block { white-space: pre-line; }

/* ---------- fiche actif ---------- */
.candles { width: 100%; height: auto; display: block; }
.candles .grid-line { stroke: var(--border); stroke-width: 1; }
.candles .axis { fill: var(--text-3); font: 11px var(--sans); }
.candles .axis.last { fill: var(--accent); font-weight: 700; }
.candles .last-line { stroke: var(--accent); stroke-dasharray: 3 3; stroke-width: 1; }
.candles .candle .wick { stroke-width: 1; }
.candles .candle.up .wick, .candles .candle.up .body { stroke: var(--up); fill: var(--up); }
.candles .candle.down .wick, .candles .candle.down .body { stroke: var(--down); fill: var(--down); }
.candles .candle .vol { opacity: .35; stroke: none; }
.candles .candle:hover .body { opacity: .75; }
.asset-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-end; }
.asset-head .px { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ids td:first-child { color: var(--text-3); white-space: nowrap; }

/* ---------- lecture de l'analyste (Économie & monde) ---------- */
.analyst-card { border-top: 3px solid var(--gold); }
.analyst-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.analyst-head h2 { margin: 2px 0; font-size: 20px; }
.eyebrow { font: 700 11px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }
.regime-scale { display: grid; gap: 4px; justify-items: start; min-width: 130px; }
.regime-scale .scale { display: flex; gap: 3px; }
.regime-scale .step { width: 22px; height: 8px; border-radius: 2px; background: var(--surface-3); }
.regime-scale .step.on.s0, .regime-scale .step.on.s1 { background: var(--down); }
.regime-scale .step.on.s2 { background: var(--warn); }
.regime-scale .step.on.s3, .regime-scale .step.on.s4 { background: var(--up); }
.analyst-sec { background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px 16px; font-size: 14px; }
.analyst-sec h3 { text-transform: none; letter-spacing: 0; font-size: 15px; color: var(--text); margin-bottom: 6px; }
.analyst-sec p { margin: 0 0 8px; color: var(--text); }
.analyst-sec ul { margin: 0 0 8px; padding-left: 18px; }
.idea-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.idea { display: grid; gap: 6px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); background: var(--surface); }
.idea:hover { border-color: var(--accent); text-decoration: none; }
.reco { border-left: 3px solid var(--up); }

/* Rapports : titres de l'archive cliquables */
button.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-align: left; }
button.linklike:hover { text-decoration: underline; }
button.linklike.on { font-weight: 700; color: var(--text); }
.center { text-align: center; }

/* Texte rédigé par l'IA : titres, listes et paragraphes aérés (jamais de Markdown brut) */
.md.rich { display: grid; gap: 8px; line-height: 1.6; white-space: normal; }
.md.rich p { margin: 0; }
.md.rich h4 { margin: 10px 0 0; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.md.rich h4:first-child { margin-top: 0; }
.md.rich ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.md.rich strong { color: var(--text); }
.veto { display: grid; gap: 4px; padding: 10px 12px; border-left: 3px solid var(--warn); background: var(--warn-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.history-list { display: grid; gap: 8px; }
.history-item { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; }
.history-item > summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; cursor: pointer; }
.history-item[open] > summary { margin-bottom: 10px; }
.history-item .analyst-card { box-shadow: none; border: 0; padding: 0; }

/* Notes du moteur expliquées (explain.js) */
.metric-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.metric { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; border-left: 3px solid var(--border); display: grid; gap: 2px; }
.metric.ok { border-left-color: var(--up); }
.metric.warn { border-left-color: var(--warn); }
.metric.bad { border-left-color: var(--down); }
.metric .k { font-size: 12px; color: var(--text-2); }
.metric .v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.verdict { font-size: 12px; font-weight: 600; color: var(--text-2); }
.verdict.ok { color: var(--up); } .verdict.warn { color: var(--warn); } .verdict.bad { color: var(--down); }
.metric-help > summary { list-style: none; cursor: pointer; color: var(--text-3); display: inline-flex; }
.metric-help > summary::-webkit-details-marker { display: none; }
.metric-help[open] > p { font-size: 12px; line-height: 1.5; color: var(--text-2); margin: 6px 0 0; grid-column: 1 / -1; }
.metric-help .icon { width: 15px; height: 15px; }
.metric-help.inline { display: inline-block; vertical-align: middle; }
.metric-help.inline[open] > p { position: absolute; z-index: 20; max-width: 360px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; box-shadow: var(--shadow, 0 6px 24px rgba(0,0,0,.25)); }
ul.reasons { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 14px; line-height: 1.5; }
.pedagogy { background: var(--accent-soft); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 8px; }
.pedagogy h3 { margin: 0; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.glossary dt { font-weight: 700; margin-top: 8px; }
.glossary dd { margin: 2px 0 0; color: var(--text-2); font-size: 14px; line-height: 1.5; }
.opp-score { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; padding: 2px 8px; border-radius: 12px; font-weight: 700; font-variant-numeric: tabular-nums; background: var(--surface-2); }
.opp-score.ok { background: var(--up-soft); color: var(--up); } .opp-score.bad { background: var(--down-soft); color: var(--down); }
.theme-card { display: grid; gap: 10px; }
.theme-card .members { display: grid; gap: 8px; }
.theme-member { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2); }
.theme-member .why { font-size: 12px; color: var(--text-2); line-height: 1.45; }
.cat-chip { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--accent); }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); gap: 16px; }

/* Page portefeuille : diagnostic, lignes, corrélations */
.diag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 10px; }
.diag { border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: 10px 12px; }
.diag.ok { border-left-color: var(--up); } .diag.warn { border-left-color: var(--warn); } .diag.bad { border-left-color: var(--down); }
.diag p { margin: 4px 0 0; color: var(--text-2); }
table.lines td { vertical-align: middle; }
table.lines .weight { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
table.lines .weight progress { width: 60px; height: 6px; }
tr.line-detail > td { background: var(--surface-2); padding: 14px; }
table.heatmap { border-collapse: separate; border-spacing: 3px; font-size: 12px; font-variant-numeric: tabular-nums; }
table.heatmap th { font-weight: 600; color: var(--text-2); padding: 2px 6px; white-space: nowrap; }
table.heatmap td.hm { text-align: center; padding: 6px 8px; border-radius: 4px; min-width: 44px; }
td.hm.hi { background: var(--down-soft); color: var(--down); font-weight: 700; }
td.hm.mid { background: var(--warn-soft); color: var(--warn); }
td.hm.lo { background: var(--surface-2); color: var(--text-2); }
td.hm.neg { background: var(--up-soft); color: var(--up); }
td.hm.na { color: var(--text-3); }
.row.alloc { align-items: center; flex-wrap: wrap; }
.row.alloc .donut { width: 120px; height: 120px; flex: none; }
td.hm.diag { color: var(--text-3); background: transparent; }

/* Carte « Mon compte Fortuneo » */
.steps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 10px; }
.steps-grid .step { display: flex; gap: 10px; background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; }
.steps-grid .num { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.steps-grid p { margin: 2px 0 0; }
.bank-conn { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; display: grid; gap: 8px; }
.wm-panel { border-top: 1px solid var(--border); padding-top: 10px; }
.wm-list { display: grid; gap: 6px; }
.wm-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); }
.wm-val { display: flex; align-items: center; gap: 8px; }
.wm-val progress { width: 80px; }

/* ---------- santé financière (F-Score, Altman, fondamentaux, on-chain) ---------- */
.columns .col.s0 { fill: #2553c7; } .columns .col.s1 { fill: #a88532; } .columns .col.s2 { fill: #0f7a3d; }
.columns .col.neg { opacity: .55; }
.columns .zero-line { stroke: var(--text-3); stroke-width: 1; }
.legend.inline { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.legend .sw.s0 { background: #2553c7; } .legend .sw.s1 { background: #a88532; } .legend .sw.s2 { background: #0f7a3d; }
.fscore { display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; }
.fscore .pt { height: 10px; border-radius: 3px; background: var(--surface-3); }
.fscore .pt.ok { background: var(--up); } .fscore .pt.ko { background: var(--down); opacity: .7; }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; font-size: 13.5px; }
.checks li { display: grid; grid-template-columns: 22px 1fr; gap: 6px; align-items: start; }
.checks .mark { font-weight: 700; text-align: center; }
.checks .ok .mark { color: var(--up); } .checks .ko .mark { color: var(--down); } .checks .na .mark { color: var(--text-3); }
.zscale { display: grid; gap: 4px; }
.zscale progress { width: 100%; height: 10px; }
.zscale .ticks { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-3); }
.health-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.pillar { padding: 6px 12px; border-radius: 999px; font-weight: 700; font-size: 13px; background: var(--surface-2); }
.pillar.ok { color: var(--up); background: var(--up-soft); } .pillar.bad { color: var(--down); background: var(--down-soft); }
.consensus { display: grid; grid-template-columns: 88px minmax(0, 1fr) 28px; gap: 4px 10px; align-items: center; }
.consensus progress { width: 100%; height: 8px; }
.meter.ok::-webkit-progress-value { background: var(--up); } .meter.ok::-moz-progress-bar { background: var(--up); }
.meter.warn::-webkit-progress-value { background: var(--warn); } .meter.warn::-moz-progress-bar { background: var(--warn); }
.meter.bad::-webkit-progress-value { background: var(--down); } .meter.bad::-moz-progress-bar { background: var(--down); }
.zratios { display: grid; gap: 6px; font-size: 13px; }
.zratios .zr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); }
.zratios .zr:last-child { border-bottom: 0; }
.zratios .mono { font-weight: 700; }
.columns .col.loss { fill: var(--down); opacity: .8; } .columns .col.gain { fill: var(--up); opacity: .8; }

/* ---------- qualification, backtest du moteur, calibration ---------- */
.multi .ml { fill: none; stroke-width: 2; } .multi .ml.s0 { stroke: #2553c7; } .multi .ml.s1 { stroke: #a88532; } .multi .ml.s2 { stroke: #0f7a3d; }
.criteria { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.criteria li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 8px; align-items: center; font-size: 14px; }
.criteria li progress { grid-column: 2 / -1; width: 100%; height: 6px; }
.criteria .mark { font-weight: 700; text-align: center; } .criteria .ok .mark { color: var(--up); } .criteria .ko .mark { color: var(--warn); }
.ready { padding: 10px 14px; border-radius: var(--radius-sm); font-weight: 700; }
.ready.ok { background: var(--up-soft); color: var(--up); } .ready.wait { background: var(--warn-soft); color: var(--warn); }
.reliab { display: grid; grid-template-columns: 110px minmax(0, 1fr) 70px; gap: 6px 10px; align-items: center; font-size: 13px; }
.reliab progress { width: 100%; height: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }

/* ---------- discussion avec Claude, mémoire des analyses ---------- */
.chat-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .chat-layout { grid-template-columns: 1fr; } }
.chat-item { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 6px 8px; border-radius: var(--radius-sm); font-size: 13.5px; }
.chat-item.on { background: var(--accent-soft); }
.chat-item a { color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-q { display: flex; justify-content: flex-end; }
.chat-q .bubble { max-width: 80%; background: var(--accent-soft); padding: 10px 14px; border-radius: 14px 14px 4px 14px; font-size: 14.5px; }
.chat-layout textarea { width: 100%; resize: vertical; }
.memory-hit { border-left: 3px solid var(--accent); padding: 6px 12px; }
.row.wrap { flex-wrap: wrap; }
.tax-step { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; }
.tax-step > summary { cursor: pointer; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tax-step .step-no { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; font-size: 13px; }

/* ---------- pages légales publiques (mentions légales, CGU, confidentialité) et acceptation ---------- */
.legal { max-width: 860px; margin: 0 auto; padding: 24px 16px 40px; }
.legal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.legal-brand { display: flex; align-items: center; gap: 11px; color: var(--text); }
.legal-brand:hover { text-decoration: none; }
.legal-brand img { width: 36px; height: 36px; border-radius: 50%; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--gold); }
.legal-brand b { display: block; font: 700 15px/1.1 var(--display); letter-spacing: -.01em; }
.legal-brand small { display: block; font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); font-weight: 600; margin-top: 3px; }
.legal-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.legal-tabs a { border: 1px solid var(--border); background: var(--surface); color: var(--text-2); padding: 5px 12px; border-radius: 999px; font: 600 13px var(--sans); }
.legal-tabs a:hover { text-decoration: none; border-color: var(--accent); }
.legal-tabs a.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.legal-doc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px 32px; box-shadow: var(--shadow); }
.legal-doc h1 { font-size: 26px; margin-bottom: 2px; }
.legal-doc h2 { font: 650 18px/1.3 var(--display); margin: 28px 0 10px; color: var(--text); }
.legal-doc h3 { margin-top: 16px; }
.legal-doc p, .legal-doc li { color: var(--text-2); font-size: 15px; line-height: 1.65; }
.legal-doc ul { padding-left: 22px; margin: 0 0 12px; }
.legal-doc li + li { margin-top: 4px; }
.legal-doc strong { color: var(--text); }
.legal-doc .callout { margin: 14px 0; }
.legal-doc .callout p:last-child { margin-bottom: 0; }
.legal-version { color: var(--text-3); font-size: 13px; margin-bottom: 18px; }
.legal-missing { color: var(--warn); font-style: italic; }
.legal-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 18px; font-size: 12.5px; color: var(--text-3); }
.legal-links { display: inline-flex; gap: 14px; flex-wrap: wrap; }
.legal-links a { color: var(--text-3); }
.legal-links a:hover { color: var(--accent); }
.auth-legal .legal-links, .app-footer .legal-links { display: flex; justify-content: center; margin-top: 6px; }
.app-footer { padding: 8px 24px 20px; text-align: center; font-size: 12px; color: var(--text-3); }
.terms-check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--text-2); }
.terms-check input { margin-top: 3px; flex: none; }
@media (max-width: 600px) { .legal-doc { padding: 20px 16px; } }
@media print { .legal-head .btn, .legal-tabs, .app-footer { display: none !important; } .legal-doc { border: 0; box-shadow: none; } }
