/* ==========================================================================
   Feuille de style autonome — aucun CDN, aucune etape de build.

   Principes de mise en forme :
   - Une seule couleur d'accent. La couleur porte de l'information (verdict
     d'analyse, sens d'une variation), elle ne decore jamais.
   - Chiffres en chasse tabulaire : dans une colonne de cours ou de
     pourcentages, les chiffres doivent s'aligner verticalement, sinon l'oeil
     ne peut plus comparer deux lignes d'un coup.
   - Echelle d'espacement de 4 px et hierarchie typographique explicite : les
     metadonnees s'effacent, le contenu ressort.
   ========================================================================== */

:root {
  --ground: #0a0c10;
  --panel: #10141b;
  --panel-2: #141924;
  --line: #1b2130;
  --line-strong: #262e3f;

  --ink: #e7eaf0;
  --ink-2: #98a1b2;
  --ink-3: #616a7c;

  --accent: #3ddc97;
  --accent-soft: rgba(61, 220, 151, 0.13);
  --amber: #f2b544;
  --amber-soft: rgba(242, 181, 68, 0.13);
  --red: #ef6461;

  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px;

  --r1: 6px; --r2: 10px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 14px/1.55 ui-sans-serif, -apple-system, BlinkMacSystemFont,
        "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Toute donnee chiffree s'aligne verticalement d'une ligne a l'autre. */
.num, td.num, .delta, .price, .countdown, .stat-value {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r1);
}
code {
  font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--panel-2); padding: 1px 5px; border-radius: 4px; color: var(--ink-2);
}

/* ---------- Ossature ------------------------------------------------------ */
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 var(--s5); }
@media (max-width: 640px) { .wrap { padding: 0 var(--s4); } }

.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(10, 12, 16, 0.88);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex; align-items: center; gap: var(--s5);
  height: 56px;
}
.brand { font-size: 15px; font-weight: 650; letter-spacing: -0.015em; }
.brand i { color: var(--accent); font-style: normal; }

.nav { display: flex; gap: var(--s1); margin-left: var(--s2); }
.nav a {
  padding: 6px 11px; border-radius: var(--r1);
  font-size: 13px; color: var(--ink-3); transition: color .12s, background .12s;
}
.nav a:hover { color: var(--ink); background: var(--panel-2); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--panel-2); }

.header-right { margin-left: auto; display: flex; align-items: center; gap: var(--s4); }

/* Etat du marche : une pastille, pas une carte. C'est une metadonnee. */
.market-pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--ink-2); white-space: nowrap;
}
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); flex: none; }
.pulse.live { background: var(--accent); box-shadow: 0 0 0 0 var(--accent-soft); animation: pulse 2.4s ease-out infinite; }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(61, 220, 151, 0.45); }
  70%  { box-shadow: 0 0 0 7px rgba(61, 220, 151, 0); }
  100% { box-shadow: 0 0 0 0 rgba(61, 220, 151, 0); }
}
.logout { font-size: 12px; color: var(--ink-3); }
.logout:hover { color: var(--ink-2); }

/* Sur petit ecran, l'etat du marche se reduit a sa pastille : le libelle
   ferait deborder la barre de navigation horizontalement. */
@media (max-width: 780px) {
  .site-header .wrap { gap: var(--s3); }
  .market-pill .lbl { display: none; }
  .nav a { padding: 6px 9px; }
}
@media (max-width: 560px) {
  .brand { display: none; }
}

main.wrap { padding-top: var(--s6); padding-bottom: var(--s7); }
section + section { margin-top: var(--s6); }

.site-footer {
  border-top: 1px solid var(--line); margin-top: var(--s7);
  padding-top: var(--s4); padding-bottom: var(--s6);
  font-size: 12px; line-height: 1.7; color: var(--ink-3); max-width: 720px;
}

/* ---------- Titres de section -------------------------------------------- */
.head { display: flex; align-items: baseline; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s4); }
.head h1 { margin: 0; font-size: 21px; font-weight: 650; letter-spacing: -0.02em; }
.head h2 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.head .sub { font-size: 13px; color: var(--ink-3); }
.head .actions { margin-left: auto; display: flex; gap: var(--s2); align-items: center; }
.count { color: var(--ink-3); font-weight: 400; }

/* Bandeau de contexte : une ligne, discrete, sous le titre. */
.meta-strip {
  display: flex; flex-wrap: wrap; gap: var(--s4);
  font-size: 12px; color: var(--ink-3);
  padding-bottom: var(--s4); margin-bottom: var(--s5);
  border-bottom: 1px solid var(--line);
}
.meta-strip b { color: var(--ink-2); font-weight: 500; }

/* ---------- Panneaux ------------------------------------------------------ */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r2); }
.empty { padding: var(--s7) var(--s4); text-align: center; color: var(--ink-3); font-size: 13px; }
.empty strong { display: block; color: var(--ink-2); font-weight: 500; margin-bottom: var(--s1); }

.notice { border-radius: var(--r2); padding: var(--s3) var(--s4); font-size: 12.5px; line-height: 1.65; }
.notice.info  { background: rgba(61, 220, 151, 0.05); border: 1px solid rgba(61, 220, 151, 0.18); color: #a9d9c3; }
.notice.warn  { background: var(--amber-soft); border: 1px solid rgba(242, 181, 68, 0.28); color: #f5d9a3; }
.notice.error { background: rgba(239, 100, 97, 0.1); border: 1px solid rgba(239, 100, 97, 0.3); color: #f5b8b7; }
.notice b { color: inherit; }

/* ---------- Liste d'alertes ----------------------------------------------
   Une grille plutot qu'un tableau : elle permet le lisere de verdict a
   gauche et un repli propre sur mobile. Les intitules de colonnes sont
   affiches une seule fois en tete de liste, jamais repetes sur chaque
   ligne : sur vingt alertes, la repetition noie l'information.           */
.alert-head, .alert {
  display: grid;
  grid-template-columns: 3px 148px 132px 84px 92px minmax(0, 1fr) 92px;
  gap: 0 var(--s4);
  padding-right: var(--s4);
}
.alert-head {
  padding-top: var(--s3); padding-bottom: var(--s3);
  border-bottom: 1px solid var(--line);
  font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3);
}
.alert-head > :nth-child(2) { padding-left: var(--s4); }

.alert { align-items: center; padding-top: var(--s3); padding-bottom: var(--s3); border-top: 1px solid var(--line); }
.alert:first-of-type { border-top: 0; }
.alert:hover { background: var(--panel-2); }
.rail { align-self: stretch; border-radius: 3px 0 0 3px; background: #3a4354; }
.rail.vert { background: var(--accent); }
.rail.orange { background: var(--amber); }
.rail.rouge { background: var(--red); }

.alert .who { padding-left: var(--s4); min-width: 0; }
.ticker { font-size: 14px; font-weight: 650; letter-spacing: -0.01em; }
.sub { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.sub.trunc, .trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.delta { font-size: 16px; font-weight: 650; letter-spacing: -0.02em; white-space: nowrap; }
.delta.up { color: var(--accent); }
.delta.down { color: var(--red); }
.price { font-size: 14px; white-space: nowrap; }

/* Barre de volume relatif : un rapport se compare plus vite en longueur
   qu'en chiffre. Le chiffre reste affiche a cote. */
.vol { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); }
.vol .bar { flex: 1; height: 3px; border-radius: 2px; background: var(--line-strong); overflow: hidden; }
.vol .bar i { display: block; height: 100%; background: var(--ink-3); border-radius: 2px; }
.vol .bar i.strong { background: var(--accent); }

.verdict { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--ink-3); }
.verdict .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.verdict.vert { color: var(--accent); }
.verdict.orange { color: var(--amber); }
.verdict.rouge { color: var(--red); }

/* Le resume est borne a deux lignes : une alerte doit se lire d'un coup
   d'oeil, le detail est dans les sources en dessous. */
.analysis {
  font-size: 13px; color: var(--ink-2); line-height: 1.45; margin-top: 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.sources { margin-top: 3px; font-size: 11.5px; color: var(--ink-3); }
.sources.lead { margin-top: 4px; font-size: 13px; color: var(--ink-2); line-height: 1.45; }
.sources div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sources a { border-bottom: 1px solid transparent; }
.sources a:hover { color: var(--ink-2); border-bottom-color: var(--line-strong); }

.alert .act { text-align: right; }

@media (max-width: 1060px) {
  .alert-head { display: none; }
  .alert {
    grid-template-columns: 3px minmax(0, 1fr) auto;
    row-gap: var(--s2); align-items: start;
  }
  .alert .who { grid-column: 2; }
  .alert .act { grid-column: 3; grid-row: 1; }
  .alert .c-delta { grid-column: 2 / -1; grid-row: 2; padding-left: var(--s4); }
  .alert .c-price, .alert .c-vol { display: none; }
  .alert .why { grid-column: 2 / -1; padding-left: var(--s4); }
  .alert .who { padding-left: var(--s4); }
}

/* ---------- Catalyseurs ---------------------------------------------------
   Le compte a rebours est l'ancre visuelle : c'est la seule colonne lue en
   diagonale. Sa couleur porte l'urgence (ambre a sept jours ou moins), ce
   qui evite d'ajouter un indicateur graphique supplementaire dont la
   semantique serait ambigue.                                               */
.cat {
  display: grid;
  grid-template-columns: 78px 104px minmax(0, 1fr) auto;
  align-items: baseline; gap: 0 var(--s4);
  padding: var(--s3) var(--s4);
  border-top: 1px solid var(--line);
}
.cat:first-of-type { border-top: 0; }
.cat:hover { background: var(--panel-2); }

.countdown { font-size: 16px; font-weight: 600; color: var(--ink-2); letter-spacing: -0.02em; }
.countdown.soon { color: var(--amber); }
.countdown.far { color: var(--ink-3); }
.cat .date { font-size: 11px; color: var(--ink-3); margin-top: 2px; }

.cat .who { min-width: 0; }
.cat .kind { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
/* Petite etiquette de qualification, posee a cote d'une valeur : "est."
   pour une date previsionnelle, "3 seances" pour une hausse cumulee. Elle
   doit se lire comme une precision, jamais comme une alerte concurrente. */
.est {
  display: inline-block; font-size: 10px; font-weight: 500; letter-spacing: 0.03em;
  text-transform: uppercase; color: var(--ink-3); vertical-align: 1px;
  border: 1px solid var(--line-strong); border-radius: 4px; padding: 0 4px; margin-left: 5px;
}
.event { font-size: 13px; color: var(--ink); line-height: 1.45; }
.event .src { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.event .src a:hover { color: var(--ink-2); }

@media (max-width: 860px) {
  .cat { grid-template-columns: 72px minmax(0, 1fr) auto; row-gap: 6px; align-items: start; }
  .cat .who { grid-column: 2; }
  .cat .event { grid-column: 2 / -1; }
}

/* ---------- Tableaux (simulation) ---------------------------------------- */
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; padding: var(--s2) var(--s4) var(--s3);
  font-size: 11px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink-3); border-bottom: 1px solid var(--line); white-space: nowrap;
}
tbody td { padding: var(--s3) var(--s4); border-top: 1px solid var(--line); vertical-align: middle; }
tbody tr:first-child td { border-top: 0; }
tbody tr:hover { background: var(--panel-2); }
th.right, td.right { text-align: right; }
td.nowrap, th.nowrap { white-space: nowrap; }

/* ---------- Cartes de synthese (page simulation) -------------------------- */
.stats { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r2); padding: var(--s4); }
.stat-label { font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3); }
.stat-value { font-size: 22px; font-weight: 650; letter-spacing: -0.025em; margin: 6px 0 2px; }
.stat-sub { font-size: 12px; color: var(--ink-3); }

/* ---------- Elements ------------------------------------------------------ */
.btn {
  font: inherit; font-size: 12px; font-weight: 500;
  padding: 6px 12px; border-radius: var(--r1); border: 1px solid var(--line-strong);
  background: transparent; color: var(--ink-2); cursor: pointer; white-space: nowrap;
  transition: background .12s, color .12s, border-color .12s;
}
.btn:hover:not(:disabled) { background: var(--panel-2); color: var(--ink); border-color: #33405a; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { border-color: transparent; background: var(--accent-soft); color: var(--accent); }
.btn.primary:hover:not(:disabled) { background: rgba(61, 220, 151, 0.22); color: var(--accent); }
.btn.quiet { border-color: transparent; color: var(--ink-3); padding: 6px 8px; }
.btn.quiet:hover:not(:disabled) { color: var(--red); background: transparent; }
.btn.done { color: var(--accent); border-color: transparent; background: transparent; }

select, input[type="password"] {
  font: inherit; font-size: 13px; padding: 6px 10px;
  border-radius: var(--r1); background: var(--panel); border: 1px solid var(--line-strong);
  color: var(--ink);
}
select:focus, input:focus { outline: 0; border-color: var(--accent); }

.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 5px; background: var(--panel-2); color: var(--ink-2); border: 1px solid var(--line-strong); }
.badge.open { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.tag { font-size: 11px; color: var(--ink-3); }

.up { color: var(--accent); }
.down { color: var(--red); }
.muted { color: var(--ink-2); }
.dim { color: var(--ink-3); }
.small { font-size: 12px; }

/* ---------- Notification transitoire -------------------------------------- */
#toast {
  position: fixed; left: 50%; bottom: var(--s5); transform: translateX(-50%) translateY(8px);
  padding: 9px 16px; border-radius: var(--r2); font-size: 13px;
  background: var(--panel-2); border: 1px solid var(--line-strong); color: var(--ink);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .45);
  opacity: 0; pointer-events: none; transition: opacity .16s, transform .16s; z-index: 60;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.ok { border-color: rgba(61, 220, 151, 0.4); }
#toast.ko { border-color: rgba(239, 100, 97, 0.5); color: #f5b8b7; }

/* ---------- Connexion ------------------------------------------------------ */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: var(--s4); }
.login .box { width: 100%; max-width: 320px; }
.login h1 { margin: 0 0 2px; font-size: 20px; font-weight: 650; letter-spacing: -0.02em; }
.login .box > p { margin: 0 0 var(--s5); font-size: 13px; color: var(--ink-3); }
.login form { display: flex; flex-direction: column; gap: var(--s2); }
.login input { width: 100%; padding: 9px 12px; }
.login button {
  padding: 9px; border-radius: var(--r1); border: 0; background: var(--accent);
  color: #06120c; font: inherit; font-weight: 600; cursor: pointer;
}
.login button:hover { background: #5ee5ac; }
.login .notice { margin-bottom: var(--s4); }

/* ---------- Recherche de titres ------------------------------------------- */
.search-panel { margin-bottom: var(--s5); }
.search-box { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); }
.search-box input[type="search"] {
  flex: 1; font: inherit; font-size: 14px; padding: 9px 2px;
  background: transparent; border: 0; color: var(--ink);
}
.search-box input[type="search"]:focus { outline: 0; }
.search-box input::placeholder { color: var(--ink-3); }

.hit { display: flex; align-items: center; gap: var(--s4); padding: var(--s3) var(--s4); border-top: 1px solid var(--line); }
/* Pousse l'action a droite de la ligne. */
.hit .grow { flex: 1; min-width: 0; }
.hit:hover { background: var(--panel-2); }
.hit-symbol { width: 92px; flex: none; }
.hit .sub { text-transform: capitalize; }

.warn-text { color: var(--amber); }

/* Etiquette « hors liste » : ambre, pour la distinguer d'une precision
   neutre comme « est. » ou « 3 seances ». Elle signale que le titre n'a pas
   ete verifie chez le courtier. */
.est.off { color: var(--amber); border-color: rgba(242, 181, 68, 0.35); }

/* Les alertes hors liste portent deux actions empilees. */
.alert .act .btn + .btn { display: block; width: 100%; }
