/* Tradeline : Liquid Glass sobre. Le verre habille cartes, menus et fenêtres ;
   les tableaux et graphiques gardent un fond calme, presque uni, pour la lecture. */
:root {
  --bg: #0a0d16;
  --glow-1: rgba(70, 120, 255, .26); --glow-2: rgba(140, 90, 255, .2); --glow-3: rgba(60, 170, 255, .1);
  --glass: rgba(255, 255, 255, .06);          /* cartes */
  --glass-bar: rgba(18, 22, 34, .72);         /* barres : plus opaques */
  --glass-pop: rgba(24, 29, 44, .9);          /* menus, infobulles */
  --glass-edge: rgba(255, 255, 255, .12);
  --glass-hi: rgba(255, 255, 255, .10);       /* reflet du haut */
  --calm: rgba(9, 11, 19, .62);               /* fond des tableaux et graphiques */
  --hover: rgba(255, 255, 255, .05);
  --line: rgba(255, 255, 255, .08); --line-strong: rgba(255, 255, 255, .16);
  --text: #f2f4f8; --text-2: #b4bccb; --text-3: #8a93a6;
  --accent: #7cb4ff; --accent-soft: rgba(124, 180, 255, .14); --on-accent: #08111f;
  --up: #3ecf8e; --down: #ff6b6b; --up-bg: rgba(62, 207, 142, .13); --down-bg: rgba(255, 107, 107, .13);
  --warn: #e3b341;
  --blur: blur(18px) saturate(150%);
  --r-lg: 18px; --r-md: 12px; --r-sm: 8px;
  --shadow: 0 8px 28px rgba(0, 0, 0, .28);
  --sans: "Inter", ui-sans-serif, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --side: 220px; --top: 60px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #eef1f7;
  --glow-1: rgba(90, 140, 255, .22); --glow-2: rgba(160, 120, 255, .16); --glow-3: rgba(80, 190, 255, .12);
  --glass: rgba(255, 255, 255, .55);
  --glass-bar: rgba(255, 255, 255, .78);
  --glass-pop: rgba(255, 255, 255, .94);
  --glass-edge: rgba(255, 255, 255, .9);
  --glass-hi: rgba(255, 255, 255, .7);
  --calm: rgba(255, 255, 255, .86);
  --hover: rgba(20, 40, 80, .05);
  --line: rgba(20, 30, 50, .09); --line-strong: rgba(20, 30, 50, .18);
  --text: #0f1420; --text-2: #4a5365; --text-3: #6b7486;
  --accent: #1f6feb; --accent-soft: rgba(31, 111, 235, .1); --on-accent: #ffffff;
  --up: #12805c; --down: #c93a3a; --up-bg: rgba(18, 128, 92, .1); --down-bg: rgba(201, 58, 58, .1);
  --warn: #9a6b00;
  --shadow: 0 8px 26px rgba(30, 45, 80, .1);
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font: 14.5px/1.55 var(--sans); }
/* Lueurs d'arrière-plan : fixes, très douces, sans animation */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(42vmax 42vmax at 8% -6%, var(--glow-1), transparent 70%),
    radial-gradient(38vmax 38vmax at 100% 12%, var(--glow-2), transparent 70%),
    radial-gradient(50vmax 34vmax at 50% 112%, var(--glow-3), transparent 70%);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.015em; line-height: 1.25; }
h1 { font-size: 24px; }
h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 600; }
h3 { font-size: 16px; }
p { margin: 0 0 8px; }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.num { letter-spacing: -0.02em; }
.muted { color: var(--text-2); }
.faint, .tiny { color: var(--text-3); font-size: 12.5px; }
.small { font-size: 13.5px; }
.up { color: var(--up); } .down { color: var(--down); } .flat { color: var(--text-2); }
.r { text-align: right; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
button { font: inherit; color: inherit; }

/* Verre : un seul mélange réutilisé, avec reflet en haut */
.panel, .topbar, .sidebar, .bottomnav, .drawer nav, .results, .tip-pop, .toast, .notice {
  background: var(--glass); border: 1px solid var(--glass-edge);
  box-shadow: inset 0 1px 0 var(--glass-hi), var(--shadow);
}

/* ---------- Structure ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--top); display: flex; align-items: center; gap: 14px;
  padding: 0 20px; background: var(--glass-bar); border-width: 0 0 1px; border-radius: 0;
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: var(--text); width: calc(var(--side) - 20px); flex: none; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--glass); border: 1px solid var(--glass-edge); box-shadow: inset 0 1px 0 var(--glass-hi); flex: none; }
.brand-mark .logo { width: 24px; height: 24px; display: block; }
.brand-name { letter-spacing: -0.01em; }
.brand.home { width: auto; }
.brand-tag { font-weight: 400; font-size: 13.5px; color: var(--text-2); white-space: nowrap; }
.mobile-tag { display: none; }
.search { position: relative; flex: 1; max-width: 480px; }
.search input { width: 100%; height: 38px; padding: 0 38px 0 14px; border-radius: 999px; }
.search kbd { position: absolute; right: 12px; top: 10px; }
kbd { font: 11px var(--mono); color: var(--text-3); border: 1px solid var(--line-strong); border-radius: 5px; padding: 0 6px; line-height: 17px; }
.results {
  position: absolute; top: 44px; left: 0; right: 0; background: var(--glass-pop); border-radius: var(--r-md);
  max-height: 380px; overflow: auto; z-index: 40; padding: 4px;
  opacity: 0; transform: translateY(-4px); visibility: hidden; transition: opacity .15s var(--ease), transform .15s var(--ease), visibility .15s;
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
.results.open { opacity: 1; transform: none; visibility: visible; }
.results a { display: flex; gap: 12px; padding: 9px 10px; color: var(--text); border-radius: var(--r-sm); }
.results a[aria-selected="true"], .results a:hover { background: var(--accent-soft); text-decoration: none; }
.results .sym { width: 64px; flex: none; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.disclaimer { padding: 6px 20px; font-size: 12px; color: var(--text-3); text-align: center; }

.layout { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); gap: 0; min-height: calc(100vh - var(--top)); }
.sidebar {
  margin: 12px 0 12px 12px; padding: 10px 8px; border-radius: var(--r-lg); background: var(--glass-bar);
  position: sticky; top: calc(var(--top) + 12px); height: calc(100vh - var(--top) - 24px); overflow: auto;
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
.sidebar .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); padding: 14px 12px 6px; }
.sidebar a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; color: var(--text-2); font-size: 14px; transition: background .15s, color .15s; }
.sidebar a:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.sidebar a[aria-current="page"] { background: var(--accent-soft); color: var(--text); }
.sidebar a[aria-current="page"] svg { color: var(--accent); }
.sidebar svg { width: 17px; height: 17px; flex: none; }
main { padding: 22px 28px 48px; min-width: 0; max-width: 1320px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head p { color: var(--text-2); margin: 6px 0 0; max-width: 720px; }

.bottomnav { display: none; }
@media (max-width: 900px) {
  :root { --top: 56px; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .topbar { padding: 0 12px; gap: 10px; }
  .brand { width: auto; }
  .brand-name, .brand-tag, .search kbd, .top-right .checks, #acct-link { display: none; }
  .mobile-tag { display: block; margin: 0 0 6px; font-size: 13px; color: var(--text-2); }
  main { padding: 16px 14px calc(96px + env(safe-area-inset-bottom)); }
  .bottomnav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 30;
    background: var(--glass-bar); border-radius: 20px; padding: 4px;
    backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  }
  .bottomnav a, .bottomnav button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 0 6px; font-size: 11px; color: var(--text-2); background: none; border: 0; border-radius: 15px; cursor: pointer; }
  .bottomnav a[aria-current="page"] { color: var(--text); background: var(--accent-soft); }
  .bottomnav a[aria-current="page"] svg { color: var(--accent); }
  .bottomnav a:hover { text-decoration: none; }
  .bottomnav svg { width: 21px; height: 21px; }
}
/* Menu complet (mobile) */
.drawer { position: fixed; inset: 0; z-index: 50; visibility: hidden; transition: visibility .25s; }
.drawer.open { visibility: visible; }
.drawer .shade { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); opacity: 0; transition: opacity .25s var(--ease); }
.drawer.open .shade { opacity: 1; }
.drawer nav {
  position: absolute; left: 8px; right: 8px; bottom: 8px; max-height: 78vh; overflow: auto; background: var(--glass-pop);
  border-radius: 22px; padding: 8px 8px calc(10px + env(safe-area-inset-bottom));
  transform: translateY(105%); transition: transform .28s var(--ease);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
.drawer.open nav { transform: none; }
.drawer nav a { display: block; padding: 12px 14px; color: var(--text); border-radius: 12px; }
.drawer nav a:hover { background: var(--hover); text-decoration: none; }

/* ---------- Cartes en verre ---------- */
.panel { border-radius: var(--r-lg); overflow: hidden; }
/* Le flou des cartes est réservé aux grands écrans (fluidité sur téléphone) */
@media (min-width: 901px) { .panel { backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%); } }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); min-height: 50px; flex-wrap: wrap; }
.panel-b { padding: 18px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .g2, .g3 { grid-template-columns: minmax(0, 1fr); } .grid { gap: 12px; } }
section + section, .grid + section, section + .grid { margin-top: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack > * + * { margin-top: 16px; }

/* Zones de lecture : fond calme, sans verre, derrière les chiffres et graphiques */
.table-wrap, .heatmap, .panel-b:has(> .chart) { background: var(--calm); }
.panel > .table-wrap:last-child, .panel > div > .table-wrap:only-child { border-radius: 0 0 var(--r-lg) var(--r-lg); }

/* Résumé du marché en une ligne */
.summary { display: flex; flex-wrap: wrap; gap: 6px 22px; align-items: center; padding: 14px 18px; font-size: 14px; }
.summary b { font-weight: 600; }

/* Cartes d'indice */
.idx { display: block; padding: 16px 18px; color: var(--text); transition: transform .18s var(--ease), border-color .18s; }
.idx:hover { text-decoration: none; transform: translateY(-2px); border-color: var(--line-strong); }
.idx .lbl { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-2); }
.idx .val { font-size: 21px; font-weight: 600; margin: 4px 0 2px; }
.spark { display: block; width: 100%; height: 34px; margin-top: 8px; }

/* Variation : couleur + flèche + signe */
.chg { white-space: nowrap; }
.chg.up::before { content: "▲ "; font-size: .78em; }
.chg.down::before { content: "▼ "; font-size: .78em; }

/* ---------- Tableaux (fond calme) ---------- */
.table-wrap { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 10px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; text-align: left; }
tbody tr:last-child td { border-bottom: 0; }
th { font-weight: 500; font-size: 12px; color: var(--text-3); }
th.r, td.r { text-align: right; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--hover); }
td a.sym { font-family: var(--mono); font-weight: 600; color: var(--text); }
td .name, td.name { color: var(--text-2); }
td.wrap { white-space: normal; min-width: 200px; }
.kv { width: 100%; }
.kv td { padding: 8px 0; }
.kv td:first-child { color: var(--text-2); }
.panel-b > .kv, .panel-b > table.kv { background: none; }

/* ---------- Contrôles ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 16px;
  border: 1px solid var(--glass-edge); border-radius: 999px; background: var(--glass); color: var(--text);
  font-size: 13.5px; font-weight: 500; cursor: pointer; white-space: nowrap;
  box-shadow: inset 0 1px 0 var(--glass-hi); transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { background: var(--hover); border-color: var(--line-strong); text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--on-accent); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.sm { height: 30px; padding: 0 12px; font-size: 12.5px; }
.btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
input, select {
  font: inherit; color: var(--text); background: var(--calm); border: 1px solid var(--line-strong); border-radius: 10px;
  height: 40px; padding: 0 12px; width: 100%; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }
select option, select optgroup { background: var(--bg); color: var(--text); }
input[type="range"] { padding: 0; height: 22px; accent-color: var(--accent); background: none; border: 0; box-shadow: none; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }
@media (max-width: 900px) { input, select { font-size: 16px; } }
label { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 6px; }
.field { margin-bottom: 16px; }
.seg { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--calm); }
.seg button { border: 0; background: transparent; color: var(--text-2); font: 500 12.5px var(--mono); padding: 0 12px; height: 28px; border-radius: 999px; cursor: pointer; transition: background .15s, color .15s; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1px rgba(124, 180, 255, .25); }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.checks label { display: inline-flex; gap: 7px; align-items: center; margin: 0; font-size: 13.5px; color: var(--text); cursor: pointer; }

/* Infobulle « i » */
.i { display: inline-grid; place-items: center; width: 16px; height: 16px; margin-left: 4px; border: 1px solid var(--line-strong); border-radius: 50%;
  font: italic 600 10px/1 Georgia, serif; color: var(--text-3); background: transparent; cursor: help; vertical-align: 1px; padding: 0; transition: color .15s, border-color .15s; }
.i:hover, .i[aria-expanded="true"] { color: var(--accent); border-color: var(--accent); }
body.gloss-off .gl { display: none; }
.tip-pop {
  position: fixed; z-index: 60; left: 12px; right: 12px; margin: 0 auto; max-width: 310px; background: var(--glass-pop);
  border-radius: var(--r-md); padding: 12px 14px; font-size: 13px; animation: fade .16s var(--ease);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
.tip-pop b { display: block; margin-bottom: 4px; font-size: 13.5px; }
.tip-pop p { margin: 0 0 4px; color: var(--text-2); }

/* ---------- Graphiques (fond calme) ---------- */
.chart { position: relative; width: 100%; height: 340px; }
@media (max-width: 720px) { .chart { height: 250px; } }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.axis { fill: var(--text-3); font: 11px var(--mono); }
.grid-l { stroke: var(--line); }
.chart .tip { position: absolute; top: 4px; pointer-events: none; background: var(--glass-pop); border: 1px solid var(--glass-edge); border-radius: var(--r-sm); padding: 6px 9px; font: 12px var(--mono); white-space: nowrap; transform: translateX(-50%); visibility: hidden; box-shadow: var(--shadow); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; }

/* Page d'une action : zone centrale + panneau de droite */
.quote-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.quote-head .price { font: 600 34px var(--mono); letter-spacing: -0.03em; }
.quote-head .chg, .quote-head .chg-plain { font: 500 15px var(--mono); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .split { grid-template-columns: minmax(0, 1fr); } }

/* Carte de chaleur (fond calme) */
.heatmap { position: relative; width: 100%; height: 66vh; min-height: 380px; overflow: hidden; }
.tile { position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: #f4f6f9; border: 2px solid transparent; background-clip: padding-box; border-radius: 6px; overflow: hidden; padding: 2px; transition: filter .15s; }
.tile:hover { filter: brightness(1.15); text-decoration: none; }
.tile b { font: 600 clamp(10px, 1.3vw, 14px) var(--mono); }
.tile span { font: clamp(9px, 1.1vw, 12px) var(--mono); opacity: .92; }
.scale { display: flex; align-items: center; font: 11px var(--mono); color: var(--text-3); }
.scale i { width: 24px; height: 10px; display: inline-block; }
.scale i:nth-of-type(1) { border-radius: 4px 0 0 4px; } .scale i:nth-of-type(5) { border-radius: 0 4px 4px 0; }

/* Bandeaux d'état */
.status { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-3); }
.status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.status .dot.live { background: var(--up); }
.notice { border-radius: var(--r-md); border-left: 3px solid var(--warn); padding: 10px 14px; font-size: 13.5px; color: var(--text-2); }
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 70; background: var(--glass-pop);
  border-radius: 999px; padding: 10px 18px; font-size: 13.5px; animation: fade .18s var(--ease);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
@media (max-width: 900px) { .toast { bottom: calc(92px + env(safe-area-inset-bottom)); } }

/* Pubs : emplacements prévus, masqués par défaut */
.ad-slot { display: none; }
body.ads-on .ad-slot { display: grid; place-items: center; min-height: 90px; border: 1px dashed var(--line-strong); border-radius: var(--r-md); color: var(--text-3); font-size: 11px; margin: 16px 0; }

.big { font: 600 28px var(--mono); letter-spacing: -0.03em; }
.prose { max-width: 780px; }
.prose h1 { margin-bottom: 6px; }
.prose h2 { margin: 26px 0 8px; }
.prose p, .prose li { color: var(--text-2); }
dl.gloss dt { font-weight: 600; margin-top: 16px; scroll-margin-top: 80px; }
dl.gloss dd { margin: 3px 0 0; color: var(--text-2); }
.letters a { font-family: var(--mono); }

footer.foot { border-top: 1px solid var(--line); margin-top: 36px; padding-top: 20px; font-size: 13px; color: var(--text-2); }
footer.foot .cols { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 24px; }
@media (max-width: 720px) { footer.foot .cols { grid-template-columns: 1fr; } }
footer.foot a { color: var(--text-2); }
footer.foot h3 { font-size: 13px; color: var(--text); margin-bottom: 8px; }
.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; }
.skeleton { background: var(--hover); border-radius: 6px; color: transparent !important; }

@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }
.toast { animation-name: fade-toast; }
@keyframes fade-toast { from { opacity: 0; transform: translate(-50%, 4px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* Navigateurs sans flou : fonds unis et propres */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root { --glass: #151a27; --glass-bar: #121724; --glass-pop: #1a2030; }
  :root[data-theme="light"] { --glass: #ffffff; --glass-bar: #ffffff; --glass-pop: #ffffff; }
}
/* Téléphone : cartes sans flou mais un peu plus opaques pour la lisibilité */
@media (max-width: 900px) {
  :root:not([data-theme="light"]) .panel { background: rgba(20, 25, 38, .78); }
  :root[data-theme="light"] .panel { background: rgba(255, 255, 255, .82); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
