:root {
  --bg: #0d1b14; --panel: #13261c; --panel2: #183124; --line: #24452f; --text: #e7f2ea; --muted: #8fb09a;
  --accent: #1db954; --accent2: #7be0a0; --warn: #f2c14e; --bad: #ef6461; --info: #6cb4ee;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.45; }
a { color: var(--accent2); }
.muted { color: var(--muted); }
.center { text-align: center; }
.small { font-size: .85rem; }

.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .6rem 1.2rem; background: #0a1510ee; border-bottom: 1px solid var(--line); backdrop-filter: blur(6px); }
.logo { font-weight: 800; font-size: 1.15rem; color: var(--text); text-decoration: none; }
.logo span { font-weight: 500; font-size: .75rem; color: var(--muted); margin-left: .4rem; }
.nav { display: flex; gap: .2rem; flex-wrap: wrap; flex: 1; }
.nav a { color: var(--muted); text-decoration: none; padding: .35rem .7rem; border-radius: 6px; }
.nav a.active, .nav a:hover { color: var(--text); background: var(--panel2); }
.user { display: flex; align-items: center; gap: .5rem; font-size: .85rem; color: var(--muted); }
.user img { width: 28px; height: 28px; border-radius: 50%; }

main { max-width: 1100px; margin: 0 auto; padding: 1.2rem; }
h1 { font-size: 1.4rem; margin: .2rem 0 1rem; }
h2 { font-size: 1.1rem; margin: 1.4rem 0 .6rem; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; margin-bottom: 1rem; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

button, .btn { background: var(--accent); color: #04140a; border: 0; border-radius: 7px; padding: .5rem .9rem;
  font-weight: 650; cursor: pointer; font-size: .9rem; }
button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 7px;
  padding: .5rem .6rem; font: inherit; }
textarea { width: 100%; min-height: 4rem; resize: vertical; }

table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { text-align: left; padding: .38rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
.tablewrap { overflow-x: auto; }

.match { display: grid; grid-template-columns: 7.5rem 1fr auto; gap: .8rem; align-items: center; padding: .6rem .2rem;
  border-bottom: 1px solid var(--line); }
.match:last-child { border-bottom: 0; }
.match .teams { font-weight: 600; }
.match .meta { font-size: .8rem; color: var(--muted); }
.pill { display: inline-block; padding: .1rem .5rem; border-radius: 99px; font-size: .78rem; background: var(--panel2);
  border: 1px solid var(--line); }
.pill.good { color: var(--accent2); border-color: #2c6b45; }
.pill.bad { color: var(--bad); border-color: #6b2c2c; }
.pill.warn { color: var(--warn); border-color: #6b5a2c; }

.form b { display: inline-block; width: 1.25rem; text-align: center; border-radius: 3px; margin-right: 2px; font-size: .75rem;
  color: #04140a; }
.form .V { background: var(--accent); } .form .N { background: var(--warn); } .form .D { background: var(--bad); }

.stream { display: flex; flex-direction: column; gap: .7rem; }
.thinking { border-left: 3px solid var(--line); padding: .3rem .8rem; color: var(--muted); font-style: italic;
  white-space: pre-wrap; font-size: .88rem; max-height: 14rem; overflow-y: auto; }
.thinking::before { content: "Réflexion"; display: block; font-style: normal; font-weight: 600; font-size: .75rem;
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: .2rem; }
.tool { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: .55rem .8rem; font-size: .88rem; }
.tool > .head { display: flex; gap: .5rem; align-items: baseline; }
.tool > .head .name { font-family: ui-monospace, monospace; color: var(--info); }
.tool.error { border-color: #6b2c2c; }
.tool.error .err { color: var(--bad); }
.tool .issues { color: var(--warn); font-size: .8rem; margin-top: .3rem; }
.tool table { margin-top: .4rem; }
.answer { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: .4rem 1.1rem; }
.answer table { margin: .6rem 0; }
.prediction { border: 2px solid var(--accent); background: linear-gradient(160deg, #163d27, var(--panel)); border-radius: 12px;
  padding: 1rem 1.2rem; }
.prediction .score { font-size: 1.6rem; font-weight: 800; margin: .2rem 0 .6rem; }
.bars { display: grid; grid-template-columns: auto 3.2rem 1fr; gap: .25rem .6rem; align-items: center; font-size: .9rem; margin: .6rem 0; }
.bar { height: .7rem; background: var(--accent); border-radius: 4px; }
.bar.N { background: var(--warn); } .bar.A { background: var(--info); }
.calib { color: var(--warn); font-size: .85rem; }
.error-box { background: #2a1414; border: 1px solid #6b2c2c; color: #ffb4b0; border-radius: 8px; padding: .7rem .9rem; }
.spinner { display: inline-block; width: 1rem; height: 1rem; border: 2px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 1s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
pre.summary { white-space: pre-wrap; font: inherit; margin: 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.kpi { font-size: 1.8rem; font-weight: 800; }
.login { max-width: 420px; margin: 12vh auto; text-align: center; }
.login .card { padding: 2rem; }
.chatlog .msg-user { background: var(--panel2); border-radius: 10px; padding: .6rem .9rem; align-self: flex-end; max-width: 85%; }
@media (max-width: 640px) { .match { grid-template-columns: 1fr; } .topbar { gap: .4rem; } }

.grid4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.grid4 .card { margin-bottom: 0; }
.kpi.up, .up { color: var(--accent2); } .kpi.down, .down { color: var(--bad); }
.chartwrap { position: relative; outline: none; }
.chartwrap:focus-visible { box-shadow: 0 0 0 2px var(--accent2); border-radius: 6px; }
.chart { width: 100%; height: auto; display: block; touch-action: pan-y; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .endlabel { fill: var(--text); font-size: 12px; font-weight: 700; }
.tip { position: absolute; pointer-events: none; background: #0a1510; border: 1px solid var(--line); border-radius: 8px;
  padding: .4rem .6rem; min-width: 150px; font-size: .85rem; box-shadow: 0 4px 14px #0008; }
