:root { --bg:#0b0b0b; --chart:#0f0f0f; --panel:#0b0b0b; --line:#242424; --text:#d1d4dc; --dim:#7d818c; --up:#43baa5; --down:#ee7882; }
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--text); font: 13px/1.35 "Segoe UI", system-ui, sans-serif; overflow: hidden; }
#app { display: grid; grid-template-rows: 38px 1fr auto 28px; height: 100%; }
#top { display: flex; align-items: center; gap: 4px; padding: 0 8px; border-bottom: 1px solid var(--line); white-space: nowrap; overflow-x: auto; }
.logo { width: 24px; height: 24px; border-radius: 50%; background: #e6e6e6; color: #000; font-weight: 800; display: grid; place-items: center; margin-right: 4px; }
.sep { width: 1px; height: 20px; background: var(--line); margin: 0 6px; }
.grow { flex: 1; }
.group { display: flex; gap: 2px; }
button, select, input[type=date], input[type=number], input[type=text] { background: transparent; color: var(--text); border: 0; border-radius: 4px; padding: 5px 8px; font: inherit; }
button { cursor: pointer; }
button:hover { background: #1c1c1c; }
#top .group button { padding: 5px 7px; font-weight: 500; }
#top .group button.on { background: #1f1f1f; color: #fff; }
.pill { border: 1px solid transparent; font-weight: 500; }
.pill.on { background: #fff; color: #000; }
.pill.on:hover { background: #e6e6e6; }
.sym { font-weight: 700; color: #fff; border: 1px solid var(--line); background: #141414; padding: 4px 12px; border-radius: 16px; }
.mini { padding: 2px 8px; font-size: 11px; border: 1px solid var(--line); }
#body { display: grid; grid-template-columns: 44px 1fr 250px; min-height: 0; }
body.no-panel #body { grid-template-columns: 44px 1fr; }
body.no-panel #side { display: none; }
#tools { border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; overflow-y: auto; }
#tools button { width: 34px; height: 34px; padding: 0; display: grid; place-items: center; border-radius: 6px; }
#tools svg { width: 22px; height: 22px; fill: none; stroke: #aeb2bd; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
#tools .supply svg { stroke: var(--down); } #tools .demand svg { stroke: var(--up); }
#tools svg .g { fill: #43baa533; stroke: var(--up); } #tools svg .r { fill: #ee782233; stroke: var(--down); }
#tools button.on { background: #2a2a2a; } #tools button.on svg { stroke: #fff; }
#tools button.armed { background: #5a1f25; }
#tools hr { width: 24px; border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
#chart-wrap { position: relative; min-width: 0; background: var(--chart); }
#chart, #overlay { position: absolute; inset: 0; }
#overlay { pointer-events: none; z-index: 2; }
#chart-wrap.drawing { cursor: crosshair; }
#chart-wrap.picking { cursor: col-resize; }
#legend { position: absolute; left: 10px; top: 8px; z-index: 3; pointer-events: none; font-size: 12px; display: flex; flex-direction: column; gap: 5px; }
#legend button, #legend input { pointer-events: auto; }
#legend .l1 b { font-weight: 600; color: #e6e6e6; margin-right: 8px; }
#legend .l1 span { font-variant-numeric: tabular-nums; }
.trade { display: flex; align-items: stretch; height: 26px; }
.trade button { display: flex; flex-direction: column; justify-content: center; align-items: center; min-width: 64px; padding: 0 10px; color: #fff; font-weight: 700; font-size: 10px; line-height: 1.1; border-radius: 0; }
.trade button small { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.trade .sell { background: #d4414e; border-radius: 4px 0 0 4px; } .trade .sell:hover { background: #e0535f; }
.trade .buy { background: #2f9e8a; border-radius: 0 4px 4px 0; } .trade .buy:hover { background: #3bb09b; }
.trade input { width: 46px; text-align: center; background: #151515; border: 1px solid var(--line); border-left: 0; border-right: 0; border-radius: 0; padding: 0; color: var(--text); }
.l3 { display: flex; align-items: center; gap: 8px; color: #e6e6e6; }
.l3 b { font-weight: 600; } .l3 span { color: #fff; font-variant-numeric: tabular-nums; }
.l3 .icon { padding: 0 4px; opacity: .7; font-size: 12px; } .l3 .icon.off { opacity: .25; }
#side { border-left: 1px solid var(--line); padding: 8px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 0; }
.card { border: 1px solid var(--line); border-radius: 6px; padding: 8px; }
.card.grow { flex: 1; min-height: 120px; overflow: auto; }
.card.row { display: flex; gap: 6px; flex-wrap: wrap; }
.card h4 { margin: 0 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); display: flex; justify-content: space-between; align-items: center; }
.kv { display: flex; justify-content: space-between; padding: 1px 0; } .kv span { color: var(--dim); }
.card label { display: flex; justify-content: space-between; align-items: center; margin: 3px 0; color: var(--dim); }
input[type=number], input[type=date], input[type=text] { border: 1px solid var(--line); background: #121212; }
.card input[type=number] { width: 90px; padding: 3px 6px; }
.pos { color: var(--up); } .neg { color: var(--down); }
#journal .t { display: grid; grid-template-columns: 1fr auto; padding: 4px 0; border-bottom: 1px solid #181818; font-variant-numeric: tabular-nums; }
#journal small { color: var(--dim); grid-column: 1 / -1; }
#replaybar { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 4px; border-top: 1px solid var(--line); }
#replaybar[hidden] { display: none; }
#replaybar .rb { width: 34px; height: 28px; font-size: 14px; padding: 0; }
#replaybar .x { color: var(--dim); font-size: 18px; margin-left: 12px; }
#replaybar select { border: 1px solid var(--line); background: #121212; }
#ranges { display: flex; align-items: center; gap: 8px; padding: 0 8px; border-top: 1px solid var(--line); font-size: 12px; }
#ranges .group button { padding: 3px 7px; color: var(--dim); font-weight: 500; }
#ranges .group button:hover { color: #fff; }
#clock { color: var(--dim); font-variant-numeric: tabular-nums; }
#status { color: #f5c542; }
#menu, #popover { position: absolute; z-index: 5; min-width: 200px; background: #111; border: 1px solid #333; border-radius: 7px; padding: 6px; box-shadow: 0 8px 30px #000a; }
#menu button { display: block; width: 100%; text-align: left; padding: 6px 9px; }
#menu .swatches { display: flex; gap: 6px; padding: 6px 9px; }
#menu .swatches i { width: 18px; height: 18px; border-radius: 50%; border: 1px solid #444; cursor: pointer; }
#menu input[type=text] { width: 100%; margin: 4px 0; }
#popover { left: 8px; top: 8px; min-width: 250px; max-height: calc(100% - 16px); overflow: auto; }
#popover h5 { margin: 6px 4px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); }
#popover label { display: flex; align-items: center; gap: 8px; padding: 4px; cursor: pointer; }
#popover label.row { justify-content: space-between; }
#popover input[type=checkbox] { accent-color: #fff; }
#popover input[type=number], #popover input[type=text], #popover select { width: 100px; padding: 3px 6px; border: 1px solid var(--line); background: #121212; color: var(--text); }
#popover .btn { border: 1px solid var(--line); margin: 4px 2px 0; }
#popover .ds { display: flex; align-items: center; gap: 6px; padding: 5px 4px; border-radius: 4px; cursor: pointer; }
#popover .ds:hover { background: #1b1b1b; } #popover .ds.on { background: #202020; }
#popover .ds .x { margin-left: auto; color: var(--dim); }
#toast { position: absolute; left: 50%; bottom: 36px; transform: translateX(-50%); background: #e6e6e6; color: #000; padding: 7px 14px; border-radius: 6px; z-index: 6; max-width: 70%; }
@media (max-width: 900px) { #body { grid-template-columns: 44px 1fr; } #side { display: none; } }
/* indicator legend (top right) */
#ind-legend { position: absolute; right: 74px; top: 8px; z-index: 3; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; font-size: 12px; pointer-events: none; }
#ind-legend .ir { display: flex; align-items: center; gap: 8px; padding: 2px 4px 2px 8px; border-radius: 4px; pointer-events: auto; cursor: default; background: #0f0f0fcc; }
#ind-legend .ir:hover { background: #1c1c1c; }
#ind-legend .ir.off .nm, #ind-legend .ir.off .val { opacity: .35; }
#ind-legend .nm { font-weight: 600; color: #e6e6e6; }
#ind-legend .val { font-variant-numeric: tabular-nums; display: flex; gap: 8px; }
#ind-legend .ir button { padding: 0 4px; font-size: 12px; opacity: .45; background: transparent; }
#ind-legend .ir:hover button { opacity: 1; }
/* settings dialog */
#dlg { position: fixed; inset: 0; z-index: 20; }
#dlg .back { position: absolute; inset: 0; background: #0006; }
#dlg .panel { position: absolute; right: 90px; top: 60px; bottom: 40px; width: 430px; display: flex; flex-direction: column; background: #131313; border: 1px solid #2c2c2c; border-radius: 10px; box-shadow: 0 20px 60px #000c; }
#dlg .dt { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px 4px; font-size: 18px; }
#dlg .x { font-size: 22px; color: var(--dim); }
#dlg .tabs { display: flex; gap: 6px; padding: 8px 14px 0; border-bottom: 2px solid #242424; }
#dlg .tabs button { border-radius: 0; padding: 8px 10px; font-weight: 600; color: var(--dim); border-bottom: 2px solid transparent; margin-bottom: -2px; }
#dlg .tabs button.on { color: #fff; border-bottom-color: #fff; }
#dlg .db { flex: 1; overflow-y: auto; padding: 8px 18px 16px; }
#dlg .dh { margin: 18px 0 6px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
#dlg .dn { color: var(--dim); font-size: 12px; margin: 4px 0; }
#dlg .dr { display: flex; align-items: center; gap: 10px; padding: 6px 0; cursor: pointer; }
#dlg .dr.sp { justify-content: space-between; }
#dlg .indent { padding-left: 26px; }
#dlg input[type=number], #dlg input[type=text], #dlg input[type=time], #dlg select, #dlg textarea { background: #0c0c0c; color: var(--text); border: 1px solid #333; border-radius: 6px; padding: 6px 8px; font: inherit; width: 170px; }
#dlg input[type=color] { width: 44px; height: 30px; padding: 2px; background: #0c0c0c; border: 1px solid #333; border-radius: 6px; }
#dlg input[type=checkbox] { accent-color: #fff; width: 16px; height: 16px; }
#dlg textarea { width: 100%; resize: vertical; font-family: Consolas, monospace; }
#dlg .dr.box { gap: 6px; } #dlg .dr.box .nm { width: 80px; } #dlg .dr.box input[type=time] { width: 100px; padding: 5px; }
#dlg .df { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid #242424; }
#dlg .df .grow { flex: 1; }
#dlg .df button { border: 1px solid #333; padding: 7px 14px; border-radius: 8px; }
#dlg .df .ok { background: #fff; color: #000; border-color: #fff; font-weight: 600; }
#dlg .pair { display: flex; gap: 6px; } #dlg .pair select { width: 120px; } #dlg .pair input[type=number] { width: 60px; }
#dlg .dr.dwm { gap: 4px; flex-wrap: wrap; justify-content: flex-start; } #dlg .dr.dwm > label:first-child { width: 90px; }
/* indicators live under SELL / BUY (top left) */
#legend #ind-legend { position: static; align-items: flex-start; pointer-events: none; margin-top: 2px; }
#legend #ind-legend .ir { pointer-events: auto; padding-left: 0; background: transparent; }
#legend #ind-legend .ir:hover { background: #ffffff10; }
/* favorites bar */
#favs { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); z-index: 4; display: flex; align-items: center; gap: 2px; background: #151515; border: 1px solid #2c2c2c; border-radius: 8px; padding: 3px; box-shadow: 0 6px 20px #0008; }
#favs .grip { cursor: grab; color: var(--dim); padding: 0 6px; user-select: none; letter-spacing: -2px; }
#favs button { width: 32px; height: 32px; padding: 0; display: grid; place-items: center; border-radius: 6px; }
#favs button.on { background: #2a2a2a; }
#favs svg { width: 21px; height: 21px; fill: none; stroke: #aeb2bd; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
#favs .supply svg { stroke: var(--down); } #favs .demand svg { stroke: var(--up); }
#favs svg .g { fill: #43baa533; stroke: var(--up); } #favs svg .r { fill: #ee782233; stroke: var(--down); }
#tools button.fav::after { content: '\2605'; position: absolute; font-size: 8px; margin: -22px 0 0 22px; color: #f5c542; }
#tools button { position: relative; }
/* right-click chart menu */
#menu.chartmenu { min-width: 300px; padding: 4px 0; }
#menu.chartmenu button { display: flex; justify-content: space-between; gap: 24px; padding: 8px 14px; }
#menu.chartmenu kbd { color: var(--dim); font: inherit; font-size: 12px; }
#menu.chartmenu hr { border: 0; border-top: 1px solid #2a2a2a; margin: 4px 0; }
/* KZP data table */
#kzp-table { position: absolute; z-index: 3; pointer-events: none; background: #0f0f0fd9; border: 1px solid #2a2a2a; border-radius: 4px; padding: 3px 6px; font-variant-numeric: tabular-nums; }
#kzp-table table { border-collapse: collapse; } #kzp-table td, #kzp-table th { padding: 1px 8px; text-align: right; font-weight: 500; } #kzp-table th { color: var(--dim); } #kzp-table td:first-child, #kzp-table th:first-child { text-align: left; }
#kzp-table.small { font-size: 10px; } #kzp-table.normal { font-size: 12px; } #kzp-table.large { font-size: 14px; }
#kzp-table.tr { right: 74px; top: 8px; } #kzp-table.tl { left: 10px; top: 140px; } #kzp-table.br { right: 74px; bottom: 36px; } #kzp-table.bl { left: 10px; bottom: 36px; }
