:root {
  --bg: #0e1015; --panel: #161921; --panel2: #1c2029; --line: #262a35; --txt: #d5d8e0; --dim: #7c8293;
  --acc: #4f8cff; --up: #22b07d; --down: #e5484d; --warn: #f5a524; --hover: #232835;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--txt); overscroll-behavior: none;
  font: 13px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; overflow: hidden; }
button, input, select { font: inherit; color: var(--txt); }
input, select { background: #1e222c; border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; }
input:focus, select:focus { outline: none; border-color: var(--acc); }
button { background: none; border: 0; border-radius: 6px; padding: 6px 8px; cursor: pointer; white-space: nowrap; }
button:hover { background: var(--hover); }
button.on { color: var(--acc); }
.btn { background: #1e222c; border: 1px solid var(--line); }
.btn.primary { background: var(--acc); border-color: var(--acc); color: #fff; }
svg { display: block; }

/* ---------- structure ---------- */
#app { display: grid; grid-template-rows: 44px 1fr 32px; grid-template-columns: 46px 1fr auto; height: 100%; }
#top { grid-column: 1 / 4; display: flex; align-items: center; gap: 2px; padding: 0 8px; background: var(--panel); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
#top::-webkit-scrollbar { display: none; }
#left { grid-column: 1; grid-row: 2 / 4; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; padding: 4px 0; gap: 1px; overflow-y: auto; scrollbar-width: none; }
#center { grid-column: 2; grid-row: 2; position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
#chartwrap { position: relative; flex: 1; min-height: 0; }
#chart { position: absolute; inset: 0; }
#bottom { grid-column: 2; grid-row: 3; display: flex; align-items: center; gap: 2px; padding: 0 8px; background: var(--panel); border-top: 1px solid var(--line); font-size: 12px; overflow-x: auto; scrollbar-width: none; }
#bottom button { padding: 4px 8px; color: var(--dim); }
#bottom button:hover { color: var(--txt); }
#bottom button.on { color: var(--acc); }
#side { grid-column: 3; grid-row: 2 / 4; width: 280px; background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
#side.closed { display: none; }
.sep { width: 1px; height: 22px; background: var(--line); margin: 0 6px; flex: none; }
.grow { flex: 1; }

/* ---------- barre du haut ---------- */
#symBtn { font-weight: 600; display: flex; align-items: center; gap: 6px; padding: 6px 10px; }
#symBtn .ico { color: var(--dim); }
.tf { font-weight: 500; min-width: 34px; }
.tf.on { background: #1f2633; }
.menuBtn { display: flex; align-items: center; gap: 6px; }
.caret { font-size: 9px; color: var(--dim); }

/* ---------- menus déroulants ---------- */
.dropdown { position: fixed; z-index: 80; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 4px; box-shadow: 0 10px 30px #000a; min-width: 190px; display: none; max-height: 80vh; overflow-y: auto; }
.dropdown.open { display: block; }
.dropdown .it { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 7px 10px; }
.dropdown .it.on { color: var(--acc); background: #1f2633; }
.dropdown .it .k { margin-left: auto; color: var(--dim); font-size: 11px; }
.dropdown .hd { padding: 8px 10px 4px; color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }

/* ---------- barre d'outils gauche ---------- */
.tool { width: 38px; height: 36px; display: flex; align-items: center; justify-content: center; position: relative; color: #b8bdc9; padding: 0; }
.tool.on { color: var(--acc); background: #1f2633; }
.tool .more { position: absolute; right: 2px; bottom: 2px; width: 0; height: 0; border-left: 4px solid transparent; border-bottom: 4px solid var(--dim); }
.lsep { width: 26px; height: 1px; background: var(--line); margin: 4px 0; flex: none; }

/* ---------- légendes ---------- */
.legend { position: absolute; left: 8px; z-index: 5; pointer-events: none; font-size: 12px; line-height: 1.7; max-width: calc(100% - 110px); }
.legend .row { display: flex; align-items: center; gap: 6px; pointer-events: auto; width: max-content; max-width: 100%; border-radius: 4px; padding: 0 4px; flex-wrap: wrap; }
.legend .row:hover { background: #161921cc; }
.legend .main { font-size: 14px; }
.legend .main .sym { font-weight: 600; }
.legend .dim { color: var(--dim); }
.legend .acts { display: none; gap: 0; }
.legend .row:hover .acts { display: inline-flex; }
.legend .acts button { padding: 1px 4px; font-size: 12px; color: var(--dim); }
.legend .acts button:hover { color: var(--txt); }
.legend .off { opacity: .45; }
.legend .ohlc b { font-weight: 500; margin: 0 8px 0 3px; }
.legend .row > span[data-k] { margin-left: 4px; }
.up { color: var(--up); } .down { color: var(--down); }
#countdown { color: var(--dim); }
#status { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); z-index: 6; background: #000b; padding: 4px 12px; border-radius: 6px; font-size: 12px; display: none; }
#toRealtime { position: absolute; right: 90px; bottom: 40px; z-index: 6; background: var(--panel2); border: 1px solid var(--line); display: none; }
#hint { position: absolute; left: 50%; transform: translateX(-50%); bottom: 40px; z-index: 6; background: #000b; padding: 5px 12px; border-radius: 6px; font-size: 12px; color: #cfd3dc; display: none; pointer-events: none; }

/* ---------- barre d'édition d'un dessin ---------- */
#drawbar { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); z-index: 7; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 3px; display: none; align-items: center; gap: 2px; box-shadow: 0 6px 20px #0008; }
#drawbar input[type=color] { width: 30px; height: 28px; padding: 2px; border-radius: 6px; cursor: pointer; }
#drawbar select { padding: 4px; }

/* ---------- panneau latéral ---------- */
#side h3 { margin: 0; padding: 10px 12px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); display: flex; align-items: center; }
#side h3 button { margin-left: auto; padding: 2px 6px; font-size: 14px; }
#watch { overflow-y: auto; flex: 1; min-height: 120px; }
.wrow { display: grid; grid-template-columns: 1fr auto auto 16px; gap: 10px; align-items: center; padding: 6px 12px; cursor: pointer; font-variant-numeric: tabular-nums; }
.wrow:hover { background: #1d2029; }
.wrow.cur { background: #1f2633; }
.wrow .x { color: var(--dim); visibility: hidden; text-align: center; }
.wrow:hover .x { visibility: visible; }
.wrow .c { min-width: 60px; text-align: right; }
.wrow .n span { color: var(--dim); }
#alertsBox { max-height: 38%; overflow-y: auto; border-top: 1px solid var(--line); }
.empty { color: var(--dim); padding: 4px 12px 10px; font-size: 12px; }
#details { border-top: 1px solid var(--line); padding: 10px 12px; font-size: 12px; color: var(--dim); line-height: 1.7; }
#details b { color: var(--txt); font-weight: 600; font-size: 18px; }

/* ---------- fenêtres ---------- */
.modal { position: fixed; inset: 0; background: #000a; z-index: 90; display: none; align-items: flex-start; justify-content: center; padding-top: 7vh; }
.modal.open { display: flex; }
.modal > .box { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; width: min(640px, 94vw); max-height: 82vh; display: flex; flex-direction: column; box-shadow: 0 12px 40px #000a; }
.modal .head { display: flex; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 15px; }
.modal .head .x { margin-left: auto; font-size: 18px; padding: 2px 8px; }
.modal .body { overflow-y: auto; padding: 10px 14px; }
.modal .foot { display: flex; gap: 8px; justify-content: flex-end; padding: 10px 14px; border-top: 1px solid var(--line); }
.modal .search { padding: 10px 14px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.modal .search input { font-size: 15px; padding: 9px 12px; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chips button { padding: 3px 10px; font-size: 12px; border: 1px solid var(--line); border-radius: 12px; }
.chips button.on { background: var(--acc); border-color: var(--acc); color: #fff; }
.list .li { display: flex; align-items: center; gap: 10px; padding: 8px 14px; cursor: pointer; }
.list .li:hover, .list .li.sel { background: #1f2633; }
.list .li .tag { margin-left: auto; color: var(--dim); font-size: 11px; }
.list .hdr { padding: 8px 14px 4px; color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
#symResults .r { display: grid; grid-template-columns: 1fr 110px 80px 90px 28px; gap: 8px; padding: 8px 14px; cursor: pointer; align-items: center; font-variant-numeric: tabular-nums; }
#symResults .r:hover, #symResults .r.sel { background: #1f2633; }
#symResults .r .n span, #symResults .r .vol { color: var(--dim); }
#symResults .r .ch, #symResults .r .pr, #symResults .r .vol { text-align: right; }
#symResults .r .st { text-align: center; color: var(--dim); font-size: 15px; } #symResults .r .st.on { color: var(--warn); }
#symResults .hd { padding: 6px 14px; color: var(--dim); font-size: 11px; display: grid; grid-template-columns: 1fr 110px 80px 90px 28px; gap: 8px; }
#symResults .hd span:not(:first-child) { text-align: right; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; align-items: center; }
.form label { color: var(--dim); }
.form .full { grid-column: 1 / 3; }
.form .plot { display: flex; align-items: center; gap: 8px; }
.form input[type=color] { width: 34px; height: 28px; padding: 2px; }
.form input[type=number] { width: 100%; }
.tabs { display: flex; gap: 2px; padding: 0 14px; border-bottom: 1px solid var(--line); }
.tabs button { border-radius: 0; padding: 9px 12px; border-bottom: 2px solid transparent; color: var(--dim); }
.tabs button.on { color: var(--txt); border-bottom-color: var(--acc); }
#about p { margin: 6px 0; color: #b8bdc9; line-height: 1.55; }
#about h4 { margin: 14px 0 4px; }
#about a { color: var(--acc); }
#about kbd { background: #1e222c; border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; font-size: 11px; }

#embedBody .erow { display: flex; align-items: center; gap: 10px; margin: 6px 0; flex-wrap: wrap; }
#embedBody .erow > label:first-child { width: 80px; color: var(--dim); }
#embedBody .dim { color: var(--dim); font-size: 12px; }
#embedBody .ck { display: flex; align-items: center; gap: 5px; }
#embedCode { width: 100%; height: 64px; resize: vertical; background: #1e222c; color: var(--txt); border: 1px solid var(--line); border-radius: 6px; padding: 8px; font: 12px ui-monospace, Menlo, monospace; }

.dropdown .it.tg { justify-content: space-between; }
.dropdown .it.sub { padding-left: 22px; color: #b8bdc9; }
.sw { width: 28px; height: 16px; border-radius: 8px; background: #3a4050; position: relative; flex: none; margin-left: 12px; transition: background .15s; }
.sw::after { content: ''; position: absolute; left: 2px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; transition: left .15s; }
.sw.on { background: var(--acc); } .sw.on::after { left: 14px; }
table.cmp { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.cmp th { text-align: left; color: var(--dim); font-weight: 500; font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.cmp td { padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.cmp tr.cur td { background: #1f2633; }
table.cmp .btn { padding: 3px 10px; font-size: 12px; }
#cmpBody .dim { color: var(--dim); }

#toast { position: fixed; right: 300px; bottom: 44px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
#toast div { background: var(--panel2); border: 1px solid var(--line); padding: 10px 14px; border-radius: 8px; box-shadow: 0 6px 20px #0008; max-width: 360px; }
#toast div.alert { background: var(--warn); color: #111; font-weight: 600; border: 0; }

@media (max-width: 900px) {
  #app { grid-template-columns: 0 1fr 0; }
  #left, #side { display: none; }
  #toast { right: 10px; }
  .tf.extra { display: none; }
}

/* ---------- compte ---------- */
#accBtn { position: relative; }
#accBtn.on { color: var(--up); }
#accBtn.on::after { content: ''; position: absolute; right: 3px; top: 3px; width: 7px; height: 7px; border-radius: 50%; background: var(--up); }
#accModal .body { display: flex; flex-direction: column; gap: 10px; padding: 14px; }
.acctabs { display: flex; gap: 4px; background: var(--panel2); padding: 3px; border-radius: 8px; }
.acctabs button { flex: 1; padding: 7px; border-radius: 6px; color: var(--dim); }
.acctabs button.on { background: var(--hover); color: var(--txt); }
.accf { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--dim); }
.accf input { font-size: 14px; padding: 9px 11px; }
.accbtns { display: flex; gap: 8px; flex-wrap: wrap; }
.accbtns .btn { padding: 8px 14px; }
.btn.danger { color: var(--down); border-color: #5a2a2d; }
.accerr { color: var(--down); font-size: 13px; min-height: 1em; }
.accerr:empty { display: none; }
.accok { margin: 0; line-height: 1.5; }
.accdim { margin: 0; color: var(--dim); font-size: 13px; line-height: 1.5; }
.accdim.small { font-size: 11.5px; }
.acclink { align-self: flex-start; color: var(--acc); font-size: 12px; padding: 0; }
.accmore summary { cursor: pointer; color: var(--dim); font-size: 12px; margin: 4px 0 8px; }
.accmore .accbtns { margin-bottom: 8px; }
/* logo */
#logoBtn { padding: 4px 6px; display: flex; align-items: center; flex-shrink: 0; }
.brandHead { display: inline-flex; align-items: center; gap: 8px; font-weight: 400; }
.brandHead b { font-weight: 600; } .brandHead .pros { color: var(--acc); }
.gbtn { width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 9px 12px; margin: 4px 0 2px; background: #fff; color: #1f1f1f; border: 1px solid #dadce0; border-radius: 8px; font-weight: 500; cursor: pointer; }
.gbtn:hover { background: #f4f6f9; }
.accor { display: flex; align-items: center; gap: 10px; color: var(--dim); font-size: 12px; margin: 10px 0 4px; }
.accor::before, .accor::after { content: ""; flex: 1; height: 1px; background: var(--line); }
