/* Investlytic · terminal graphique plein écran
   Principe : le graphique est la page. Chrome discret en bleu nuit, une seule couleur vive
   pour ce que fait l'utilisateur (bleu électrique) et une seule pour ce que fait l'IA (violet). */

:root {
  --tm-bg: #05081a;
  --tm-chart-bg: #060a1d;
  --tm-surface: #0a1028;
  --tm-surface-2: #10193a;
  --tm-raise: #151f45;
  --tm-hover: rgba(122, 205, 238, .07);
  --tm-line: rgba(122, 205, 238, .12);
  --tm-line-strong: rgba(122, 205, 238, .22);
  --tm-grid: rgba(122, 205, 238, .055);
  --tm-crosshair: rgba(147, 164, 201, .55);
  --tm-ink: #eaf1ff;
  --tm-muted: #93a4c9;
  --tm-faint: #5f6f92;
  --tm-accent: #2f6bff;
  --tm-accent-ink: #8fb0ff;
  --tm-accent-soft: rgba(47, 107, 255, .16);
  --tm-ia: #a855f7;
  --tm-ia-deep: #8a3ab9;
  --tm-ia-soft: rgba(168, 85, 247, .14);
  --tm-up: #22c39a;
  --tm-down: #ff5c72;
  --tm-warn: #ffb74d;
  --tm-shadow: 0 12px 40px rgba(0, 0, 0, .45);
  --tm-r: 8px;
  --tm-top-h: 44px;
  --tm-bottom-h: 32px;
  --tm-tools-w: 46px;
  --tm-rail-w: 44px;
  --tm-side-w: 304px;
  --tm-font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --tm-bg: #eef2f9;
  --tm-chart-bg: #ffffff;
  --tm-surface: #ffffff;
  --tm-surface-2: #f3f6fc;
  --tm-raise: #ffffff;
  --tm-hover: rgba(11, 18, 32, .05);
  --tm-line: rgba(11, 18, 32, .09);
  --tm-line-strong: rgba(11, 18, 32, .18);
  --tm-grid: rgba(11, 18, 32, .045);
  --tm-crosshair: rgba(74, 88, 120, .5);
  --tm-ink: #0b1220;
  --tm-muted: #4a5878;
  --tm-faint: #7a89a8;
  --tm-accent: #0057ff;
  --tm-accent-ink: #0047d1;
  --tm-accent-soft: rgba(0, 87, 255, .1);
  --tm-ia: #8a3ab9;
  --tm-ia-deep: #6f2a98;
  --tm-ia-soft: rgba(138, 58, 185, .1);
  --tm-up: #0f9d6b;
  --tm-down: #e0384d;
  --tm-warn: #b8791f;
  --tm-shadow: 0 12px 36px rgba(11, 18, 32, .16);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body.tm {
  margin: 0; overflow: hidden; background: var(--tm-bg); color: var(--tm-ink);
  font: 13px/1.4 var(--tm-font); -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--tm-accent); outline-offset: 1px; }
.up { color: var(--tm-up); }
.dn { color: var(--tm-down); }
.tm-grow { flex: 1 1 auto; }

/* ===== grille de l'application ===== */
.tm-app {
  height: 100vh; height: 100dvh;
  display: grid;
  grid-template-columns: var(--tm-tools-w) minmax(0, 1fr) var(--tm-side-w) var(--tm-rail-w);
  grid-template-rows: var(--tm-top-h) minmax(0, 1fr) var(--tm-bottom-h);
  grid-template-areas:
    "top top top top"
    "tools stage side rail"
    "tools bottom side rail";
  gap: 1px; background: var(--tm-line);
}
.tm-app[data-right="closed"] { grid-template-columns: var(--tm-tools-w) minmax(0, 1fr) 0 var(--tm-rail-w); }
.tm-app[data-right="closed"] .tm-side { visibility: hidden; }
.tm-top, .tm-tools, .tm-stage, .tm-bottom, .tm-side, .tm-rail { background: var(--tm-surface); min-width: 0; min-height: 0; }

/* ===== boutons ===== */
.tm-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 8px;
  border: 0; border-radius: 6px; background: transparent; color: var(--tm-ink); cursor: pointer; white-space: nowrap;
}
.tm-btn:hover { background: var(--tm-hover); }
.tm-btn[aria-pressed="true"], .tm-btn.is-on { color: var(--tm-accent-ink); background: var(--tm-accent-soft); }
.tm-btn:disabled { opacity: .4; cursor: default; background: transparent; }
.tm-only-ic { width: 32px; justify-content: center; padding: 0; }
.tm-drop { padding: 0 4px 0 6px; }
.tm-btn-solid { background: var(--tm-accent); color: #fff; padding: 0 14px; }
.tm-btn-solid:hover { background: var(--tm-accent); filter: brightness(1.08); }
.tm-btn-ghost { border: 1px solid var(--tm-line-strong); padding: 0 12px; }
.tm-ic { display: inline-grid; place-items: center; width: 20px; height: 20px; border: 0; border-radius: 4px; background: transparent; color: var(--tm-muted); cursor: pointer; padding: 0; }
.tm-ic svg { width: 14px; height: 14px; }
.tm-ic:hover { color: var(--tm-ink); background: var(--tm-hover); }
.tm-sep { width: 1px; height: 20px; background: var(--tm-line); margin: 0 4px; flex: none; }

/* ===== barre du haut ===== */
.tm-top { grid-area: top; display: flex; align-items: center; gap: 2px; padding: 0 6px; overflow-x: auto; scrollbar-width: none; }
.tm-top::-webkit-scrollbar { display: none; }
.tm-brand { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 6px; flex: none; }
.tm-brand img { height: 24px; width: auto; filter: drop-shadow(0 0 8px rgba(122, 205, 238, .25)); }
/* Même traitement que la barre latérale du site : glyphe blanc posé sur la pastille de marque en thème clair. */
:root[data-theme="light"] .tm-brand img { background: linear-gradient(135deg, #0057ff, #8a3ab9); border-radius: 6px; padding: 3px; filter: none; box-sizing: border-box; height: 26px; }
.tm-symbol {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px 0 10px; margin-left: 4px;
  border: 1px solid var(--tm-line); border-radius: 6px; background: var(--tm-surface-2); cursor: pointer; flex: none;
}
.tm-symbol:hover { border-color: var(--tm-line-strong); }
.tm-symbol b { font-size: 14px; font-weight: 650; letter-spacing: .01em; }
.tm-symbol-ic { width: 15px; height: 15px; color: var(--tm-muted); }
.tm-tfs { display: flex; gap: 1px; flex: none; }
.tm-tf { min-width: 30px; justify-content: center; padding: 0 6px; font-weight: 550; color: var(--tm-muted); }
.tm-tf:hover { color: var(--tm-ink); }
.tm-tf[aria-pressed="true"] { color: var(--tm-accent-ink); background: var(--tm-accent-soft); }

/* Le seul élément en couleur de l'IA dans la barre. */
.tm-ai {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 14px 0 11px; margin-right: 6px; flex: none;
  border: 1px solid rgba(168, 85, 247, .45); border-radius: 6px; cursor: pointer; font-weight: 600;
  color: #fff; background: linear-gradient(120deg, #0057ff 0%, #8a3ab9 70%, #a855f7 100%);
  box-shadow: 0 0 0 1px rgba(168, 85, 247, .12), 0 6px 20px rgba(138, 58, 185, .28);
}
.tm-ai:hover { filter: brightness(1.1); }
.tm-ai svg { width: 16px; height: 16px; fill: currentColor; stroke: none; }
.tm-ai.is-busy svg { animation: tm-spin 1.2s linear infinite; }

/* ===== outils de dessin (colonne gauche) ===== */
.tm-tools { grid-area: tools; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; overflow-y: auto; scrollbar-width: none; }
.tm-tools::-webkit-scrollbar { display: none; }
.tm-tool-group { position: relative; display: flex; width: 40px; }
.tm-tool {
  width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 6px;
  background: transparent; color: var(--tm-ink); cursor: pointer;
}
.tm-tool svg { width: 20px; height: 20px; }
.tm-tool:hover { background: var(--tm-hover); }
.tm-tool[aria-pressed="true"] { color: var(--tm-accent-ink); background: var(--tm-accent-soft); }
.tm-tool-more {
  width: 8px; height: 34px; border: 0; padding: 0; background: transparent; color: var(--tm-faint); cursor: pointer; opacity: 0;
}
.tm-tool-group:hover .tm-tool-more { opacity: 1; }
.tm-tool-more svg { width: 8px; height: 8px; }
.tm-tools-sep { width: 24px; height: 1px; background: var(--tm-line); margin: 5px 0; flex: none; }

/* ===== scène ===== */
.tm-stage { grid-area: stage; position: relative; overflow: hidden; background: var(--tm-chart-bg); }
.tm-chart { position: absolute; inset: 0; }

/* Grille de graphiques : 1 à 9 cases. Le graphique actif reçoit les actions de la barre d'outils. */
.tm-grid { position: absolute; inset: 0; display: grid; gap: 1px; background: var(--tm-line); }
.tm-cell { position: relative; min-width: 0; min-height: 0; background: var(--tm-chart-bg); overflow: hidden; }
.tm-grid.is-multi .tm-cell::after {
  content: ""; position: absolute; inset: 0; z-index: 8; pointer-events: none; border: 1px solid transparent; transition: border-color .12s;
}
.tm-grid.is-multi .tm-cell.is-active::after { border-color: var(--tm-accent); }
.tm-grid.is-multi .tm-legend-title { font-size: 12px; }
.tm-state-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.tm-state-actions:empty { display: none; }
.tm-chart.is-drawing { cursor: crosshair; }

.tm-legends { position: absolute; left: 0; top: 0; right: 80px; height: 0; z-index: 3; pointer-events: none; }
.tm-legend { position: absolute; left: 10px; display: flex; flex-direction: column; gap: 1px; overflow: hidden; max-width: calc(100% - 20px); }
.tm-legend-main { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm-legend-title { font-weight: 650; margin-right: 12px; font-size: 13px; }
.tm-legend-main i, .tm-vol i { font-style: normal; color: var(--tm-muted); margin: 0 3px 0 8px; }
.tm-legend-main i:first-child { margin-left: 0; }
.tm-legend-main em, .tm-vol em { font-style: normal; }
.tm-legend-main .tm-ohlc > em:last-child { margin-left: 8px; }
.tm-vol { margin-left: 10px; }
.tm-legend-row {
  display: flex; align-items: center; gap: 6px; height: 22px; padding: 0 6px 0 4px; margin-left: -4px;
  border-radius: 4px; font-size: 12px; white-space: nowrap; pointer-events: auto; width: max-content; max-width: 100%;
}
.tm-legend-row:hover { background: color-mix(in srgb, var(--tm-chart-bg) 80%, var(--tm-hover)); box-shadow: 0 0 0 1px var(--tm-line); }
.tm-legend-row b { font-weight: 550; }
.tm-legend-params { color: var(--tm-muted); }
.tm-legend-vals { display: inline-flex; gap: 6px; }
.tm-legend-actions { display: none; gap: 1px; }
.tm-legend-row:hover .tm-legend-actions, .tm-legend-row:focus-within .tm-legend-actions { display: inline-flex; }
.tm-legend-row.is-hidden { opacity: .5; }
.tm-swatch { width: 10px; height: 2px; border-radius: 1px; }

.tm-lastprice {
  position: absolute; right: 0; z-index: 4; display: none; height: 16px; line-height: 16px;
  font-size: 11px; text-align: center; color: #fff; pointer-events: none;
  background: var(--tm-up); border-radius: 0 0 2px 2px;
}
.tm-lastprice[data-dir="dn"] { background: var(--tm-down); }

.tm-state {
  position: absolute; inset: 0; z-index: 6; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: color-mix(in srgb, var(--tm-chart-bg) 70%, transparent); color: var(--tm-muted); text-align: center; padding: 16px;
}
.tm-state.is-error { background: var(--tm-chart-bg); }
.tm-state.is-error .tm-spinner { display: none; }
.tm-state p { max-width: 42ch; margin: 0; }
.tm-spinner { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--tm-line-strong); border-top-color: var(--tm-accent); animation: tm-spin .8s linear infinite; }
@keyframes tm-spin { to { transform: rotate(360deg); } }

/* ===== barre du bas ===== */
.tm-bottom { grid-area: bottom; display: flex; align-items: center; gap: 2px; padding: 0 6px; overflow-x: auto; scrollbar-width: none; }
.tm-bottom::-webkit-scrollbar { display: none; }
.tm-bottom .tm-btn { height: 26px; }
.tm-ranges { display: flex; gap: 1px; }
.tm-range { padding: 0 7px; color: var(--tm-muted); font-weight: 550; }
.tm-range:hover { color: var(--tm-ink); }
.tm-clock { height: 26px; color: var(--tm-muted); padding: 0 8px; white-space: nowrap; border: 0; border-radius: 5px; background: transparent; cursor: pointer; }
.tm-clock:hover { color: var(--tm-ink); background: var(--tm-hover); }
.tm-market { display: inline-flex; align-items: center; gap: 6px; color: var(--tm-muted); white-space: nowrap; padding-right: 4px; }
.tm-market::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--tm-faint); }
.tm-market[data-open="1"]::before { background: var(--tm-up); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tm-up) 22%, transparent); }
.tm-toggle { height: 24px; min-width: 32px; padding: 0 6px; border: 0; border-radius: 5px; background: transparent; color: var(--tm-muted); cursor: pointer; font-weight: 600; }
.tm-toggle:hover { color: var(--tm-ink); background: var(--tm-hover); }
.tm-toggle[aria-pressed="true"] { color: var(--tm-accent-ink); background: var(--tm-accent-soft); }

/* ===== panneau latéral droit ===== */
.tm-side { grid-area: side; display: flex; flex-direction: column; overflow: hidden; }
.tm-panel { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; overflow: hidden; }
.tm-panel-head { display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 6px 0 12px; border-bottom: 1px solid var(--tm-line); flex: none; }
.tm-panel-head h2 { font-size: 13px; font-weight: 650; margin: 0; flex: 1; }
.tm-panel-head .tm-btn { height: 28px; }
.tm-empty { color: var(--tm-muted); padding: 14px 12px; margin: 0; }

.tm-wl-cols, .tm-wl-row { display: grid; grid-template-columns: minmax(0, 1.2fr) 1fr .8fr .9fr; gap: 6px; align-items: center; }
.tm-wl-cols { padding: 6px 12px; font-size: 11px; color: var(--tm-faint); border-bottom: 1px solid var(--tm-line); }
.tm-wl-cols span:not(:first-child), .tm-wl-row > span:not(:first-child) { text-align: right; }
.tm-wl { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 0 1 auto; max-height: 45%; min-height: 60px; }
.tm-wl-row { position: relative; height: 30px; padding: 0 12px; cursor: pointer; border-left: 2px solid transparent; }
.tm-wl-row:hover { background: var(--tm-hover); }
.tm-wl-row[aria-selected="true"] { background: var(--tm-accent-soft); border-left-color: var(--tm-accent); }
.tm-wl-sym { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-wl-row .tm-wl-x { position: absolute; right: 2px; top: 5px; display: none; }
.tm-wl-row:hover .tm-wl-x { display: inline-grid; }
.tm-wl-row:hover > span:last-of-type { visibility: hidden; }
.tm-flash-up { animation: tm-flash-up .9s ease-out; }
.tm-flash-dn { animation: tm-flash-dn .9s ease-out; }
@keyframes tm-flash-up { from { background: color-mix(in srgb, var(--tm-up) 26%, transparent); } }
@keyframes tm-flash-dn { from { background: color-mix(in srgb, var(--tm-down) 26%, transparent); } }

.tm-details { border-top: 1px solid var(--tm-line); padding: 12px; overflow-y: auto; flex: 1 1 auto; }
.tm-det-name { font-size: 12px; color: var(--tm-muted); margin: 0 0 2px; }
.tm-det-title { font-size: 15px; font-weight: 650; margin: 0 0 8px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.tm-det-title span { font-size: 11px; color: var(--tm-faint); font-weight: 500; }
.tm-det-price { font-size: 26px; font-weight: 650; letter-spacing: -.01em; line-height: 1.1; }
.tm-det-chg { font-size: 13px; margin: 2px 0 12px; }
.tm-det-range { margin: 10px 0 14px; }
.tm-det-range-bar { position: relative; height: 4px; border-radius: 2px; background: var(--tm-line-strong); margin: 6px 0 4px; }
.tm-det-range-bar i { position: absolute; top: -3px; width: 2px; height: 10px; background: var(--tm-ink); border-radius: 1px; }
.tm-det-range-lbl { display: flex; justify-content: space-between; font-size: 11px; color: var(--tm-muted); }
.tm-kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; margin: 0; font-size: 12px; }
.tm-kv dt { color: var(--tm-muted); }
.tm-kv dd { margin: 0; text-align: right; }

/* ===== IA ===== */
.tm-ai-body { overflow-y: auto; padding: 0 0 16px; flex: 1; }
.tm-ai-verdict { margin: 12px; padding: 12px; border-radius: var(--tm-r); border: 1px solid rgba(168, 85, 247, .35); background: var(--tm-ia-soft); }
.tm-ai-verdict-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tm-ai-action { font-size: 18px; font-weight: 700; letter-spacing: .02em; }
.tm-ai-action[data-a="acheteur"] { color: var(--tm-up); }
.tm-ai-action[data-a="vendeur"] { color: var(--tm-down); }
.tm-ai-score { display: inline-flex; gap: 2px; }
.tm-ai-score i { width: 14px; height: 5px; border-radius: 2px; background: var(--tm-line-strong); }
.tm-ai-score i.on { background: var(--tm-ia); }
.tm-ai-plan { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }
.tm-ai-plan div { background: var(--tm-surface); border-radius: 6px; padding: 6px 8px; }
.tm-ai-plan span { display: block; font-size: 10.5px; color: var(--tm-muted); }
.tm-ai-plan b { font-size: 12.5px; font-weight: 600; }
.tm-ai-sec { padding: 10px 12px 0; }
.tm-ai-sec h3 { font-size: 12px; font-weight: 650; color: var(--tm-muted); margin: 6px 0 6px; }
.tm-ai-sec p { margin: 0 0 6px; line-height: 1.5; }
.tm-ai-levels { list-style: none; margin: 0; padding: 0; }
.tm-ai-levels li { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--tm-line); font-size: 12px; cursor: pointer; }
.tm-ai-levels li:hover { color: var(--tm-ia); }
.tm-ai-checks { display: grid; gap: 4px; font-size: 12px; }
.tm-ai-checks div { display: flex; gap: 8px; align-items: center; }
.tm-ai-checks svg { width: 14px; height: 14px; }
.tm-ai-checks .ok { color: var(--tm-up); }
.tm-ai-checks .ko { color: var(--tm-faint); }
.tm-ai-warn { color: var(--tm-warn); font-size: 12px; padding-left: 16px; margin: 0; }
.tm-ai-foot { display: flex; gap: 6px; padding: 12px; flex-wrap: wrap; }
.tm-ai-progress { margin: 14px 12px; }
.tm-ai-progress-bar { height: 3px; border-radius: 2px; background: var(--tm-line); overflow: hidden; }
.tm-ai-progress-bar i { display: block; height: 100%; width: 40%; background: linear-gradient(90deg, transparent, var(--tm-ia), transparent); animation: tm-indet 1.3s ease-in-out infinite; }
@keyframes tm-indet { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
.tm-ai-progress p { color: var(--tm-muted); margin: 8px 0 0; font-size: 12px; }

/* ===== alertes, événements, objets, données ===== */
.tm-alerts, .tm-objects-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
.tm-alert-row, .tm-obj-row { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 8px 6px 12px; border-bottom: 1px solid var(--tm-line); }
.tm-alert-row b, .tm-obj-row b { font-weight: 600; }
.tm-alert-row small, .tm-obj-row small { display: block; color: var(--tm-muted); font-size: 11.5px; }
.tm-alert-row > div, .tm-obj-row > div { flex: 1; min-width: 0; }
.tm-obj-row.is-ia b { color: var(--tm-ia); }
.tm-obj-swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.tm-ev-group { padding: 8px 12px; }
.tm-ev-group h3 { font-size: 12px; color: var(--tm-muted); font-weight: 650; margin: 4px 0 6px; }
.tm-ev-list { list-style: none; margin: 0; padding: 0; font-size: 12px; }
.tm-ev-list li { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--tm-line); }
.tm-ev-next { margin: 10px 12px 2px; padding: 10px; border-radius: var(--tm-r); background: var(--tm-surface-2); }
.tm-datawin { padding: 8px 12px; }
.tm-datawin dl { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; margin: 0 0 10px; font-size: 12px; }
.tm-datawin dt { color: var(--tm-muted); }
.tm-datawin dd { margin: 0; text-align: right; }
.tm-datawin h3 { font-size: 11.5px; color: var(--tm-faint); margin: 10px 0 4px; font-weight: 600; }
.tm-switch { display: inline-flex; align-items: center; gap: 6px; color: var(--tm-muted); font-size: 12px; cursor: pointer; }

/* ===== rail des panneaux ===== */
.tm-rail { grid-area: rail; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; }
.tm-rail button { width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 6px; background: transparent; color: var(--tm-muted); cursor: pointer; }
.tm-rail button:hover { color: var(--tm-ink); background: var(--tm-hover); }
.tm-rail button.is-on { color: var(--tm-accent-ink); background: var(--tm-accent-soft); }
.tm-rail .tm-rail-ai.is-on { color: var(--tm-ia); background: var(--tm-ia-soft); }
.tm-app[data-right="closed"] #tm-side-toggle svg { transform: rotate(180deg); }

/* ===== menus, fenêtres, info-bulles ===== */
.tm-menu {
  position: fixed; z-index: 60; min-width: 190px; max-height: min(70vh, 560px); overflow-y: auto; padding: 4px;
  background: var(--tm-raise); border: 1px solid var(--tm-line-strong); border-radius: var(--tm-r); box-shadow: var(--tm-shadow);
}
.tm-menu h4 { margin: 6px 8px 4px; font-size: 11px; font-weight: 600; color: var(--tm-faint); }
.tm-menu-item { display: flex; align-items: center; gap: 10px; width: 100%; height: 32px; padding: 0 10px; border: 0; border-radius: 5px; background: transparent; cursor: pointer; text-align: left; white-space: nowrap; }
.tm-menu-item:hover, .tm-menu-item:focus-visible { background: var(--tm-hover); outline: none; }
.tm-menu-item[aria-checked="true"] { color: var(--tm-accent-ink); }
.tm-menu-item kbd { margin-left: auto; font: 11px var(--tm-font); color: var(--tm-faint); }
.tm-menu-item .tm-star { margin-left: auto; color: var(--tm-faint); }
.tm-menu-item .tm-star.on { color: var(--tm-warn); }
.tm-menu-sep { height: 1px; background: var(--tm-line); margin: 4px 2px; }
.tm-menu-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; padding: 0 2px 4px; }
.tm-menu-grid .tm-menu-item { justify-content: center; padding: 0 4px; }

.tm-modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: start center; padding: 8vh 16px 16px; background: rgba(2, 4, 14, .55); }
:root[data-theme="light"] .tm-modal { background: rgba(11, 18, 32, .28); }
.tm-modal-box { width: min(640px, 100%); max-height: 84vh; display: flex; flex-direction: column; background: var(--tm-raise); border: 1px solid var(--tm-line-strong); border-radius: 10px; box-shadow: var(--tm-shadow); overflow: hidden; }
.tm-modal-box > header { display: flex; align-items: center; justify-content: space-between; padding: 10px 8px 6px 16px; }
.tm-modal-box > header h2 { font-size: 16px; font-weight: 650; margin: 0; }
.tm-search-field { display: flex; align-items: center; gap: 8px; margin: 4px 16px 8px; padding: 0 10px; height: 40px; border: 1px solid var(--tm-line-strong); border-radius: 7px; background: var(--tm-surface-2); }
.tm-search-field:focus-within { border-color: var(--tm-accent); }
.tm-search-field svg { color: var(--tm-muted); }
.tm-search-field input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 15px; min-width: 0; }
.tm-tabs { display: flex; gap: 2px; padding: 0 12px 6px; border-bottom: 1px solid var(--tm-line); overflow-x: auto; scrollbar-width: none; }
.tm-tab { height: 28px; padding: 0 10px; border: 0; border-radius: 14px; background: transparent; color: var(--tm-muted); cursor: pointer; white-space: nowrap; }
.tm-tab[aria-selected="true"] { background: var(--tm-ink); color: var(--tm-raise); }
.tm-search-list { list-style: none; margin: 0; padding: 4px 0; overflow-y: auto; }
.tm-search-item { display: grid; grid-template-columns: minmax(80px, auto) 1fr auto; gap: 12px; align-items: center; padding: 8px 16px; cursor: pointer; }
.tm-search-item[aria-selected="true"], .tm-search-item:hover { background: var(--tm-hover); }
.tm-search-item b { font-weight: 650; }
.tm-search-item span { color: var(--tm-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-search-item em { font-style: normal; font-size: 11px; color: var(--tm-faint); }

.tm-ind-box { width: min(760px, 100%); height: min(620px, 84vh); }
.tm-ind-cols { display: grid; grid-template-columns: 190px 1fr; min-height: 0; flex: 1; border-top: 1px solid var(--tm-line); }
.tm-ind-cats, .tm-ind-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; }
.tm-ind-cats { border-right: 1px solid var(--tm-line); }
.tm-ind-cats button { width: 100%; height: 32px; padding: 0 10px; border: 0; border-radius: 5px; background: transparent; text-align: left; cursor: pointer; color: var(--tm-muted); }
.tm-ind-cats button[aria-selected="true"] { background: var(--tm-accent-soft); color: var(--tm-accent-ink); }
.tm-ind-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 4px 10px; border: 0; border-radius: 5px; background: transparent; text-align: left; cursor: pointer; }
.tm-ind-item:hover { background: var(--tm-hover); }
.tm-ind-item small { color: var(--tm-faint); margin-left: auto; font-size: 11px; }
.tm-ind-item .tm-ind-count { min-width: 18px; height: 18px; border-radius: 9px; background: var(--tm-accent); color: #fff; font-size: 11px; display: inline-grid; place-items: center; padding: 0 5px; }

.tm-dialog-box { width: min(460px, 100%); }
.tm-dialog-body { padding: 4px 16px 12px; overflow-y: auto; }
.tm-dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 16px 14px; border-top: 1px solid var(--tm-line); }
.tm-form { display: grid; gap: 10px; }
.tm-field { display: grid; grid-template-columns: 1fr 1.2fr; align-items: center; gap: 10px; }
.tm-field > span { color: var(--tm-muted); }
.tm-field input[type="number"], .tm-field input[type="text"], .tm-field input[type="date"], .tm-field input[type="datetime-local"], .tm-field select, .tm-input {
  height: 32px; padding: 0 8px; border: 1px solid var(--tm-line-strong); border-radius: 6px; background: var(--tm-surface-2); width: 100%; min-width: 0;
}
.tm-field input[type="color"] { width: 44px; height: 30px; border: 1px solid var(--tm-line-strong); border-radius: 6px; background: transparent; padding: 2px; justify-self: end; }
.tm-field input:focus, .tm-field select:focus, .tm-input:focus { outline: none; border-color: var(--tm-accent); }
.tm-form-sub { font-size: 11.5px; color: var(--tm-faint); font-weight: 600; margin: 8px 0 -2px; }
.tm-style-row { display: grid; grid-template-columns: 1fr 44px 70px 80px 26px; align-items: center; gap: 8px; }

.tm-tip {
  position: fixed; z-index: 70; max-width: 260px; padding: 7px 9px; border-radius: 6px; pointer-events: none; font-size: 12px;
  background: var(--tm-raise); border: 1px solid var(--tm-line-strong); box-shadow: var(--tm-shadow);
}

.tm-draw-bar {
  position: absolute; z-index: 20; display: flex; align-items: center; gap: 2px; padding: 3px;
  background: var(--tm-raise); border: 1px solid var(--tm-line-strong); border-radius: 8px; box-shadow: var(--tm-shadow);
}
.tm-draw-bar .tm-btn { height: 28px; }
.tm-draw-bar .tm-color-dot { width: 16px; height: 16px; border-radius: 4px; border: 1px solid var(--tm-line-strong); }
.tm-draw-bar input[type="color"] { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }

#tm-toast {
  position: fixed; left: 50%; bottom: 52px; z-index: 80; transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  padding: 9px 14px; border-radius: 8px; background: var(--tm-raise); border: 1px solid var(--tm-line-strong); box-shadow: var(--tm-shadow);
  transition: opacity .18s, transform .18s; max-width: min(520px, calc(100vw - 32px));
}
#tm-toast.show { opacity: 1; transform: translate(-50%, 0); }
#tm-toast[data-kind="error"] { border-color: color-mix(in srgb, var(--tm-down) 60%, transparent); }
#tm-toast[data-kind="ok"] { border-color: color-mix(in srgb, var(--tm-up) 60%, transparent); }

/* ===== replay ===== */
.tm-replay-bar {
  position: absolute; left: 50%; bottom: 36px; transform: translateX(-50%); z-index: 15;
  display: flex; align-items: center; gap: 4px; padding: 4px 6px; border-radius: 8px;
  background: var(--tm-raise); border: 1px solid var(--tm-line-strong); box-shadow: var(--tm-shadow); white-space: nowrap;
}
.tm-replay-tag { font-weight: 700; padding: 0 8px; color: var(--tm-warn); }
.tm-rp-speed { display: inline-flex; align-items: center; gap: 6px; color: var(--tm-muted); padding: 0 6px; }
.tm-rp-speed select { height: 26px; border: 1px solid var(--tm-line-strong); border-radius: 5px; background: var(--tm-surface-2); }
.tm-rp-date { color: var(--tm-muted); padding: 0 8px; min-width: 120px; }

/* ===== menu du site : copie fidèle de la barre latérale de la plateforme (mêmes classes, même rendu) ===== */
.tm-nav-drawer { position: fixed; inset: 0; z-index: 90; }
.tm-nav-backdrop { position: absolute; inset: 0; background: rgba(2, 4, 14, .5); }
.tm-nav-panel.sidebar {
  position: absolute; left: 0; top: 0; bottom: 0; width: min(264px, 86vw); display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(7, 13, 36, .98), rgba(5, 8, 26, .99)); border-right: 1px solid var(--tm-line); box-shadow: var(--tm-shadow);
  font-size: 14px; line-height: 1.5;
}
:root[data-theme="light"] .tm-nav-panel.sidebar { background: #fff; }
.tm-nav-panel .sb-brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 16px; font-weight: 700; letter-spacing: -.03em; font-size: 19px; }
.tm-nav-panel .sb-brand img { height: 32px; width: auto; object-fit: contain; filter: drop-shadow(0 0 9px rgba(122, 205, 238, .28)); }
.tm-nav-panel .sb-brand .word { background: linear-gradient(90deg, #fff, #7acdee); -webkit-background-clip: text; background-clip: text; color: transparent; }
:root[data-theme="light"] .tm-nav-panel .sb-brand .word { background: linear-gradient(90deg, #0b1220, #0c6f9c); -webkit-background-clip: text; background-clip: text; }
.tm-nav-panel .sb-nav { flex: 1; overflow-y: auto; padding: 6px 12px 12px; scrollbar-width: thin; }
.tm-nav-panel .sb-sec { font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--tm-faint); padding: 14px 12px 6px; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.tm-nav-panel .navi { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 11px; color: var(--tm-muted); font-size: 14px; font-weight: 500; position: relative; }
.tm-nav-panel .navi svg { flex: none; width: 18px; height: 18px; color: var(--tm-faint); stroke-width: 1.9; }
.tm-nav-panel .navi:hover { background: rgba(122, 205, 238, .06); color: var(--tm-ink); }
.tm-nav-panel .navi:hover svg { color: #7acdee; }
.tm-nav-panel .navi.active, .tm-nav-panel .navi[aria-current="page"] { background: linear-gradient(90deg, rgba(0, 87, 255, .22), rgba(0, 87, 255, .04)); color: var(--tm-ink); box-shadow: inset 0 0 0 1px rgba(122, 205, 238, .22); }
.tm-nav-panel .navi.active svg, .tm-nav-panel .navi[aria-current="page"] svg { color: #7acdee; }
.tm-nav-panel .navi .tail { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.tm-nav-panel .lvl { font-size: 9.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; padding: 2px 7px; border-radius: 99px; }
.tm-nav-panel .lvl.inv { color: #7acdee; border: 1px solid rgba(122, 205, 238, .32); }
.tm-nav-panel .lvl.pro { color: #fff; background: linear-gradient(135deg, #0057ff, #8a3ab9); }
.tm-nav-panel .lvl.beta { color: #ffd479; border: 1px solid rgba(255, 193, 77, .4); }
.tm-nav-panel .lock { font-size: 11px; line-height: 1; opacity: .7; }
.tm-nav-panel .sb-foot { border-top: 1px solid var(--tm-line); padding: 12px; }
.tm-nav-panel .profile { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 12px; background: rgba(122, 205, 238, .05); border: 1px solid var(--tm-line); margin-bottom: 8px; }
.tm-nav-panel .profile .av { width: 38px; height: 38px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 15px; color: #04121a; background: linear-gradient(135deg, #7acdee, #1b64f6); }
.tm-nav-panel .profile .who { min-width: 0; }
.tm-nav-panel .profile .who b { display: block; font-size: 13.5px; color: var(--tm-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm-nav-panel .profile .who span { font-size: 11px; color: #7acdee; }
.tm-nav-panel .foot-links { display: flex; gap: 6px; flex-wrap: wrap; }
.tm-nav-panel .foot-links a { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px; border-radius: 9px; font-size: 12.5px; color: var(--tm-muted); border: 1px solid var(--tm-line); white-space: nowrap; }
.tm-nav-panel .foot-links a:hover { background: rgba(122, 205, 238, .08); color: var(--tm-ink); }
.tm-nav-panel .foot-links svg { width: 15px; height: 15px; }

/* ===== liste de suivi : sections Portefeuille / Ma liste ===== */
.tm-wl-head { display: flex; align-items: center; gap: 6px; padding: 0 8px 0 4px; height: 30px; border-bottom: 1px solid var(--tm-line); background: var(--tm-surface-2); position: sticky; top: 0; z-index: 1; }
.tm-wl-toggle { display: inline-flex; align-items: center; gap: 6px; flex: 1; height: 28px; border: 0; background: transparent; cursor: pointer; font-weight: 650; font-size: 12px; color: var(--tm-ink); padding: 0 4px; text-align: left; }
.tm-wl-toggle svg { width: 12px; height: 12px; transition: transform .15s; color: var(--tm-muted); }
.tm-wl-toggle[aria-expanded="true"] svg { transform: rotate(90deg); }
.tm-wl-toggle em { font-style: normal; font-weight: 500; color: var(--tm-faint); }
.tm-wl-link { font-size: 11.5px; color: var(--tm-accent-ink); padding: 2px 6px; border-radius: 4px; }
.tm-wl-link:hover { background: var(--tm-accent-soft); }

/* Bouton flottant « Votre avis » du site : masqué, il est déclenché depuis le rail (#tm-feedback-btn). */
body.tm .ilfb-btn { position: fixed !important; width: 1px !important; height: 1px !important; overflow: hidden !important; opacity: 0 !important; pointer-events: none !important; }

/* ===== plein écran : on retire aussi le panneau droit et le rail ===== */
.tm-app.is-zen { grid-template-columns: var(--tm-tools-w) minmax(0, 1fr) 0 0; }
.tm-app.is-zen .tm-side, .tm-app.is-zen .tm-rail { visibility: hidden; }

/* ===== écrans moyens ===== */
@media (max-width: 1180px) {
  :root { --tm-side-w: 272px; }
  .tm-lbl { display: none; }
}

/* ===== téléphone : graphique d'abord, panneaux en feuille du bas ===== */
@media (max-width: 760px) {
  :root { --tm-top-h: 46px; --tm-bottom-h: 34px; }
  .tm-app, .tm-app[data-right="closed"], .tm-app.is-zen {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: var(--tm-top-h) minmax(0, 1fr) var(--tm-bottom-h) 46px;
    grid-template-areas: "top" "stage" "bottom" "rail";
  }
  .tm-brand, #tm-layout-btn, #tm-settings-btn, #tm-undo, #tm-redo, .tm-top .tm-sep { display: none; }
  .tm-ai span { display: none; }
  .tm-ai { padding: 0 10px; margin-right: 0; }
  .tm-tools {
    position: fixed; left: 6px; top: calc(var(--tm-top-h) + 50px); bottom: calc(var(--tm-bottom-h) + 58px); z-index: 25; width: 44px;
    border: 1px solid var(--tm-line-strong); border-radius: 10px; box-shadow: var(--tm-shadow); transform: translateX(-120%); transition: transform .2s;
  }
  .tm-app.tools-open .tm-tools { transform: none; }
  .tm-tool-more { display: none; }
  .tm-rail { flex-direction: row; justify-content: space-around; padding: 0 6px; }
  .tm-rail .tm-grow, #tm-help-btn, #tm-feedback-btn { display: none; }
  .tm-side {
    position: fixed; left: 0; right: 0; bottom: 46px; height: 58dvh; z-index: 30; visibility: visible;
    border-top: 1px solid var(--tm-line-strong); border-radius: 12px 12px 0 0; box-shadow: var(--tm-shadow);
    transform: translateY(0); transition: transform .22s;
  }
  .tm-app[data-right="closed"] .tm-side { transform: translateY(110%); visibility: visible; }
  .tm-wl { max-height: 40%; }
  .tm-grid.is-multi { position: absolute; inset: 0; display: flex !important; flex-direction: column; overflow-y: auto; gap: 1px; }
  .tm-grid.is-multi .tm-cell { flex: 0 0 62dvh; }
  .tm-modal { padding: 0; place-items: stretch; }
  .tm-modal-box, .tm-ind-box { width: 100%; max-height: 100dvh; height: 100dvh; border-radius: 0; }
  .tm-ind-cols { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .tm-ind-cats { display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--tm-line); }
  .tm-ind-cats button { white-space: nowrap; width: auto; }
  .tm-legend-row .tm-legend-actions { display: inline-flex; }
  .tm-replay-bar { bottom: 10px; max-width: calc(100vw - 16px); overflow-x: auto; }
  .tm-rp-date { display: none; }
  #tm-draw-toggle { display: inline-flex !important; }
}
#tm-draw-toggle { display: none; }

@media (pointer: coarse) {
  .tm-btn, .tm-tool, .tm-rail button { min-height: 40px; }
  .tm-only-ic, .tm-tool, .tm-rail button { min-width: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
