/* ==========================================================================
   Terminal — design system « salle de marchés »
   ========================================================================== */
:root {
  --bg: #05070b;
  --bg-2: #090c12;
  --panel: #0c1017;
  --panel-2: #10161f;
  --line: #1a2230;
  --line-2: #243042;
  --text: #d7dee8;
  --muted: #7a8799;
  --dim: #4b5768;
  --amber: #ffab00;
  --amber-2: #ffcc4d;
  --amber-bg: rgba(255, 171, 0, .08);
  --cyan: #3cc8ff;
  --violet: #9b8cff;
  --up: #00d68f;
  --up-bg: rgba(0, 214, 143, .10);
  --down: #ff4d61;
  --down-bg: rgba(255, 77, 97, .10);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 6px;
  --glow: 0 0 0 1px rgba(255, 171, 0, .25), 0 0 24px rgba(255, 171, 0, .08);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { background: var(--bg); }
body {
  margin: 0; color: var(--text); font-family: var(--sans); font-size: 13.5px; line-height: 1.45;
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(60, 200, 255, .05), transparent 60%),
    radial-gradient(900px 400px at 0% 0%, rgba(255, 171, 0, .045), transparent 60%),
    linear-gradient(var(--bg), var(--bg));
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body::before { /* grille fine type écran */
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, #000 0%, transparent 70%);
}
a { color: var(--cyan); text-decoration: none; }
a:hover { color: var(--amber-2); }
.mono, .num, table.t td.num, .tabular { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.up { color: var(--up) !important; }
.down { color: var(--down) !important; }
.flat { color: var(--muted) !important; }
.amber { color: var(--amber) !important; }
.muted { color: var(--muted) !important; }
.dim { color: var(--dim) !important; }
.small-caps { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; }
main { position: relative; z-index: 1; }

/* ---------------------------------------------------------------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 14px;
  height: 52px; padding: 0 16px; background: rgba(5, 7, 11, .88); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-weight: 700;
  letter-spacing: .14em; color: var(--text); white-space: nowrap; font-size: 14px; }
.brand:hover { color: var(--text); }
.brand .logo { width: 26px; height: 26px; border-radius: 5px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--amber), #ff6a00); color: #000; font-size: 13px; box-shadow: var(--glow); }
.brand .env { font-size: 9.5px; padding: 2px 6px; border-radius: 3px; background: var(--violet); color: #000; letter-spacing: .1em; }

.cmd { flex: 1; max-width: 560px; display: flex; align-items: stretch; height: 32px;
  border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--bg-2); overflow: hidden;
  transition: border-color .15s, box-shadow .15s; }
.cmd:focus-within { border-color: var(--amber); box-shadow: var(--glow); }
.cmd .prompt { display: grid; place-items: center; padding: 0 10px; color: var(--amber); font-family: var(--mono); font-weight: 700; }
.cmd input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--text);
  font-family: var(--mono); font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.cmd input::placeholder { color: var(--dim); text-transform: none; letter-spacing: 0; }
.cmd button { border: 0; background: var(--amber); color: #000; font-family: var(--mono); font-weight: 700;
  font-size: 11.5px; padding: 0 14px; letter-spacing: .06em; }
.cmd button:hover { background: var(--amber-2); }

.sessions { display: flex; gap: 6px; }
.sess { display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 11px; color: var(--muted);
  padding: 4px 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); }
.sess .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--dim); }
.sess.open .dot { background: var(--up); box-shadow: 0 0 8px var(--up); animation: pulse 2s infinite; }
.sess .t { color: var(--text); }
.clock { font-family: var(--mono); font-size: 12px; color: var(--amber); white-space: nowrap; }
.userbox { display: flex; gap: 8px; align-items: center; margin-left: auto; white-space: nowrap; }
.badge-sub { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; padding: 3px 7px; border-radius: 3px;
  background: var(--amber-bg); color: var(--amber); border: 1px solid rgba(255,171,0,.35); }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .45 } }

/* ---------------------------------------------------------------- ticker tape */
.tape { position: relative; z-index: 2; height: 30px; overflow: hidden; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #080b10, #06080c); }
.tape-track { display: inline-flex; gap: 28px; white-space: nowrap; height: 30px; align-items: center;
  animation: tape 120s linear infinite; padding-right: 28px; font-family: var(--mono); font-size: 12px; }
.tape:hover .tape-track { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) { .tape-track { animation: none; } }
.tape-item { display: inline-flex; gap: 8px; color: var(--text); }
.tape-item .s { color: var(--amber); font-weight: 600; }
@keyframes tape { from { transform: translateX(0) } to { transform: translateX(-50%) } }

/* ---------------------------------------------------------------- function keys */
.fkeys { display: flex; gap: 6px; padding: 8px 16px; border-bottom: 1px solid var(--line); overflow-x: auto;
  scrollbar-width: none; background: rgba(9, 12, 18, .7); position: relative; z-index: 2; }
.fkeys::-webkit-scrollbar { display: none; }
.fkey { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; padding: 5px 11px 5px 6px;
  border: 1px solid var(--line-2); border-radius: 5px; background: linear-gradient(180deg, #121925, #0c1118);
  color: var(--text); font-family: var(--mono); font-size: 11.5px; letter-spacing: .06em; transition: all .15s; }
.fkey kbd { font-family: var(--mono); font-size: 10px; padding: 1px 5px; border-radius: 3px; background: #000;
  color: var(--amber); border: 1px solid var(--line-2); }
.fkey:hover { color: #fff; border-color: var(--amber); box-shadow: var(--glow); }
.fkey.active { background: var(--amber); color: #000; border-color: var(--amber); }
.fkey.active kbd { background: rgba(0,0,0,.85); }
.fkey.locked { opacity: .75; }
.fkey.locked::after { content: "🔒"; font-size: 10px; }

/* ---------------------------------------------------------------- panels */
.wrap { padding: 14px 16px 40px; max-width: 1800px; margin: 0 auto; }
.grid { display: grid; gap: 12px; }
.panel { background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; min-width: 0; display: flex; flex-direction: column; }
.panel-h { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line);
  background: rgba(0,0,0,.25); min-height: 36px; }
.panel-h .code { font-family: var(--mono); font-size: 10.5px; font-weight: 700; color: #000; background: var(--amber);
  padding: 2px 6px; border-radius: 3px; letter-spacing: .08em; }
.panel-h h2, .panel-h h3 { margin: 0; font-size: 11.5px; font-family: var(--mono); font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase; color: var(--text); }
.panel-h .meta { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.panel-b { padding: 12px; }
.panel-b.flush { padding: 0; }
.scroll-x { overflow-x: auto; }
.scroll-y { overflow-y: auto; }

/* ---------------------------------------------------------------- tables */
table.t { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.t th { font-family: var(--mono); font-weight: 500; font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
  position: sticky; top: 0; background: #0b0f15; z-index: 1; }
table.t td { padding: 6px 10px; border-bottom: 1px solid rgba(26, 34, 48, .6); white-space: nowrap; vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr { transition: background .12s; }
table.t tbody tr:hover { background: rgba(255,171,0,.04); }
table.t .r, table.t th.r { text-align: right; }
table.t td.num { text-align: right; }
table.t td.sym a { color: var(--amber); font-family: var(--mono); font-weight: 600; }
table.t td.name { color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
table.t.wrap td { white-space: normal; }
.chg { display: inline-block; min-width: 66px; text-align: right; padding: 1px 6px; border-radius: 3px; font-family: var(--mono); }
.chg.up { background: var(--up-bg); }
.chg.down { background: var(--down-bg); }
.flash-up { animation: fu 1.2s ease-out; }
.flash-down { animation: fd 1.2s ease-out; }
@keyframes fu { 0% { background: rgba(0,214,143,.45) } 100% { background: transparent } }
@keyframes fd { 0% { background: rgba(255,77,97,.45) } 100% { background: transparent } }
svg.spark { display: block; overflow: visible; }
svg.spark polyline { fill: none; stroke-width: 1.4; vector-effect: non-scaling-stroke; }
svg.spark.up polyline { stroke: var(--up); }
svg.spark.down polyline { stroke: var(--down); }
svg.spark.flat polyline { stroke: var(--muted); }

/* ---------------------------------------------------------------- news */
.news { list-style: none; margin: 0; padding: 0; }
.news li { display: grid; grid-template-columns: 46px 1fr; gap: 10px; padding: 8px 12px; border-bottom: 1px solid rgba(26,34,48,.6); }
.news li:hover { background: rgba(60,200,255,.035); }
.news .time { font-family: var(--mono); font-size: 11px; color: var(--amber); padding-top: 1px; }
.news .title { color: var(--text); font-weight: 500; }
.news .title:hover { color: var(--amber-2); }
.news .src { font-family: var(--mono); font-size: 10px; color: var(--muted); letter-spacing: .05em; margin-top: 2px; }
.news .sum { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.news li.fresh { animation: newin 2.5s ease-out; }
@keyframes newin { 0% { background: rgba(255,171,0,.18) } 100% { background: transparent } }
.tag { display: inline-block; font-family: var(--mono); font-size: 9.5px; letter-spacing: .08em; padding: 1px 5px;
  border-radius: 3px; border: 1px solid var(--line-2); color: var(--cyan); margin-right: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-family: var(--mono); font-size: 11px; padding: 4px 10px; border-radius: 20px; border: 1px solid var(--line-2);
  color: var(--muted); background: var(--panel); }
.chip:hover { color: var(--text); border-color: var(--amber); }
.chip.on { background: var(--amber); color: #000; border-color: var(--amber); }

/* ---------------------------------------------------------------- signaux */
.dir { font-family: var(--mono); font-weight: 700; font-size: 11px; padding: 2px 7px; border-radius: 3px; letter-spacing: .06em; }
.dir.LONG { color: var(--up); background: var(--up-bg); border: 1px solid rgba(0,214,143,.35); }
.dir.SHORT { color: var(--down); background: var(--down-bg); border: 1px solid rgba(255,77,97,.35); }
.st { font-family: var(--mono); font-size: 10.5px; padding: 2px 6px; border-radius: 3px; border: 1px solid var(--line-2); letter-spacing: .05em; }
.st.open { color: var(--cyan); border-color: rgba(60,200,255,.4); }
.st.target { color: var(--up); border-color: rgba(0,214,143,.4); }
.st.stop { color: var(--down); border-color: rgba(255,77,97,.4); }
.st.expired, .st.cancelled { color: var(--muted); }
.sim { font-family: var(--mono); font-size: 9px; padding: 1px 4px; border-radius: 2px; background: var(--violet); color: #000; letter-spacing: .08em; }
.masked { filter: blur(4px); user-select: none; color: var(--muted); }
.lock-cta { display: flex; align-items: center; gap: 12px; padding: 12px; border-top: 1px solid var(--line);
  background: linear-gradient(90deg, var(--amber-bg), transparent); font-size: 12.5px; }

/* ---------------------------------------------------------------- KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1px; background: var(--line); }
.kpi { background: var(--panel); padding: 10px 12px; }
.kpi .l { font-family: var(--mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.kpi .v { font-family: var(--mono); font-size: 20px; font-weight: 600; margin-top: 2px; }
.kpi .s { font-size: 11px; color: var(--muted); }
.quote-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; }
.quote-head .px { font-family: var(--mono); font-size: 34px; font-weight: 600; letter-spacing: -.01em; }
.quote-head .sym { font-family: var(--mono); font-size: 22px; color: var(--amber); font-weight: 700; }
.meter { height: 6px; border-radius: 3px; background: var(--line); position: relative; overflow: hidden; }
.meter > span { position: absolute; top: 0; bottom: 0; left: 0; background: linear-gradient(90deg, var(--down), var(--amber), var(--up)); }
.gauge { position: relative; height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--down), #3a4250 50%, var(--up)); }
.gauge i { position: absolute; top: -4px; width: 2px; height: 16px; background: #fff; box-shadow: 0 0 6px #fff; }

/* ---------------------------------------------------------------- charts */
.chart { width: 100%; height: 460px; }
.chart.sm { height: 160px; }
.chart.xs { height: 120px; }
.tf-btns { display: flex; gap: 4px; }
.tf-btns button { font-family: var(--mono); font-size: 11px; padding: 3px 9px; border-radius: 3px; border: 1px solid var(--line-2);
  background: var(--panel); color: var(--muted); }
.tf-btns button.on, .tf-btns button:hover { color: #000; background: var(--amber); border-color: var(--amber); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-family: var(--mono); font-size: 11px; }
.legend i { display: inline-block; width: 10px; height: 2px; vertical-align: middle; margin-right: 4px; }

/* ---------------------------------------------------------------- forms & buttons */
.form-control, .form-select { background: var(--bg-2) !important; border: 1px solid var(--line-2) !important; color: var(--text) !important;
  font-size: 13px; border-radius: 4px; }
.form-control:focus, .form-select:focus { border-color: var(--amber) !important; box-shadow: var(--glow) !important; }
.form-label { font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.form-text { color: var(--dim); }
.form-check-input { background-color: var(--bg-2); border-color: var(--line-2); }
.form-check-input:checked { background-color: var(--amber); border-color: var(--amber); }
.btn { font-family: var(--mono); font-size: 11.5px; letter-spacing: .06em; border-radius: 4px; }
.btn-amber { background: var(--amber); color: #000; border: 1px solid var(--amber); font-weight: 700; }
.btn-amber:hover { background: var(--amber-2); color: #000; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--line-2); }
.btn-ghost:hover { border-color: var(--amber); color: var(--amber); }
.btn-danger-ghost { background: transparent; color: var(--down); border: 1px solid rgba(255,77,97,.4); }
.btn-danger-ghost:hover { background: var(--down-bg); color: var(--down); }
.flash-msgs { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: grid; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.flash-msg { padding: 10px 14px; border-radius: 5px; background: var(--panel-2); border: 1px solid var(--line-2);
  border-left: 3px solid var(--cyan); font-size: 13px; box-shadow: 0 8px 30px rgba(0,0,0,.5); animation: slidein .3s; }
.flash-msg.success { border-left-color: var(--up); }
.flash-msg.danger { border-left-color: var(--down); }
.flash-msg.warning { border-left-color: var(--amber); }
@keyframes slidein { from { transform: translateY(10px); opacity: 0 } }

/* ---------------------------------------------------------------- pages */
.hero { padding: 26px 0 8px; }
.hero h1 { font-family: var(--mono); font-size: clamp(20px, 3vw, 30px); letter-spacing: .02em; margin: 0 0 6px; }
.hero p { color: var(--muted); max-width: 760px; margin: 0; }
.prose { max-width: 780px; font-size: 15px; line-height: 1.7; }
.prose h2, .prose h3 { font-family: var(--mono); color: var(--amber); margin-top: 1.6em; font-size: 1.05em; letter-spacing: .06em; }
.prose code { color: var(--cyan); }
.prose blockquote { border-left: 3px solid var(--amber); padding-left: 12px; color: var(--muted); }
.prose table { width: 100%; font-size: 13px; }
.prose td, .prose th { border-bottom: 1px solid var(--line); padding: 6px; }
.plan { border: 1px solid var(--line-2); border-radius: 8px; padding: 20px; background: var(--panel); height: 100%; }
.plan.hl { border-color: var(--amber); box-shadow: var(--glow); }
.plan .price { font-family: var(--mono); font-size: 30px; font-weight: 700; }
.plan ul { padding-left: 18px; color: var(--muted); }
.plan li { margin: 6px 0; }
.disclaimer { font-size: 11.5px; color: var(--dim); border-top: 1px solid var(--line); padding: 16px; text-align: center; position: relative; z-index: 1; }
.pager { display: flex; gap: 6px; justify-content: center; padding: 12px; font-family: var(--mono); font-size: 12px; }
.pager a, .pager span { padding: 4px 10px; border: 1px solid var(--line-2); border-radius: 4px; }
.pager span.cur { background: var(--amber); color: #000; border-color: var(--amber); }
.empty { padding: 28px; text-align: center; color: var(--muted); font-family: var(--mono); font-size: 12px; }
.statusdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.statusdot.ok { background: var(--up); } .statusdot.error { background: var(--down); }
.statusdot.stale { background: var(--amber); } .statusdot.new { background: var(--dim); }
.admin-side { display: flex; flex-direction: column; gap: 2px; }
.admin-side a { font-family: var(--mono); font-size: 12px; padding: 7px 10px; border-radius: 4px; color: var(--muted); }
.admin-side a:hover, .admin-side a.on { background: var(--amber-bg); color: var(--amber); }

/* ---------------------------------------------------------------- grilles de page */
.g-home { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1.1fr) minmax(0, .9fr); }
.g-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.g-main-side { grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr); }
.g-admin { grid-template-columns: 200px minmax(0, 1fr); }
.stack { display: grid; gap: 12px; align-content: start; min-width: 0; }
.h-news { max-height: 920px; }

@media (max-width: 1280px) {
  .g-home { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .g-home > .col-news { grid-column: 1 / -1; order: 3; }
  .sessions .sess:nth-child(n+3) { display: none; }
}
@media (max-width: 900px) {
  .g-home, .g-2, .g-main-side, .g-admin { grid-template-columns: minmax(0, 1fr); }
  .sessions, .clock { display: none; }
  .chart { height: 340px; }
  .h-news { max-height: none; }
}
@media (max-width: 560px) {
  .topbar { gap: 8px; padding: 0 10px; }
  .brand .name { display: none; }
  .wrap { padding: 10px 10px 30px; }
  .fkeys { padding: 8px 10px; }
  .cmd button { padding: 0 9px; }
  .quote-head .px { font-size: 26px; }
  table.t td, table.t th { padding: 6px 7px; }
  .hide-sm { display: none !important; }
}
