html, body { margin: 0; height: 100%; overflow: hidden; background: #000; color: #d1d4dc; font: 13px system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { display: flex; flex-direction: row; }
button, input { font: inherit; }
.hidden { display: none !important; }
.mono { font-family: ui-monospace, Consolas, "SF Mono", monospace; font-size: 12px; }

#chart-col { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
#bar { flex: 0 0 44px; display: flex; align-items: center; gap: 18px; padding: 0 0 0 16px; background: #15181e; border-bottom: 1px solid #2a2e39; }
#bar b { color: #ffd166; font-size: 15px; letter-spacing: .3px; white-space: nowrap; text-shadow: 0 0 12px rgba(255,209,102,.35); }
#quote { color: #9aa3b5; }
#q-last { color: #fff; font-weight: 600; font-size: 14px; margin-left: 6px; }
#q-ba { color: #6e7079; font-size: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #f23645; margin-left: auto; }
.dot.on { background: #089981; }
/* In normal flow after the quote, pushed right; nothing overlaps at any width. */
#guide-btn { margin-left: auto; flex: 0 0 auto; white-space: nowrap; background: #0f2452; color: #7fb0ff; border: 1px solid #2962ff; border-radius: 6px; padding: 5px 18px; cursor: pointer; font-size: 13px; font-weight: 600; letter-spacing: .3px; }
#guide-btn:hover { background: #163575; color: #a8c8ff; }
#quote { white-space: nowrap; }
.dot { margin-left: 0; }

/* Write-up glyphs and example figure (same treatment as the indicator description card). */
#guide .glyph { display: inline-block; margin: 0 8px 0 0; font-size: 16px; }
#guide h3 .glyph:last-child { margin: 0 0 0 8px; }
#guide .example { margin: 14px 0; }
#guide figure.shot { margin: 0 0 10px; padding: 8px; display: block; width: fit-content; max-width: 100%; background: #0b0d12; border: 1px solid #3a4152; border-radius: 6px; }
#guide figure.shot img { display: block; max-width: 640px; width: 100%; border-radius: 3px; pointer-events: none; }
#guide figure.shot figcaption { margin-top: 6px; color: #8a93a6; font-size: 12px; font-style: italic; text-align: center; }
#guide .example p { color: #c6ccd8; font-size: 14px; }

/* Guide dialog: centered card over a dimmed chart. One scrollbar (the card's). */
#overlay { position: fixed; inset: 0; display: none; align-items: flex-start; justify-content: center; padding: 48px 16px; background: rgba(0,0,0,.72); backdrop-filter: blur(2px); z-index: 1000; }
#overlay.open { display: flex; }
#card { width: 100%; max-width: 860px; max-height: calc(100vh - 96px); display: flex; flex-direction: column; background: #1e2330; color: #e6e8ee; border: 1px solid #3a4152; border-radius: 10px; box-shadow: 0 24px 64px rgba(0,0,0,.7); overflow: hidden; }
#card header { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; background: #262c3b; border-bottom: 1px solid #3a4152; }
#card header h2 { margin: 0; font-size: 17px; font-weight: 600; color: #fff; }
#card-close { background: transparent; border: 0; color: #9aa3b5; font-size: 22px; line-height: 1; cursor: pointer; padding: 4px 8px; border-radius: 4px; }
#card-close:hover { background: #343b4d; color: #fff; }
#guide { flex: 1 1 auto; overflow: auto; padding: 8px 32px 28px; font-size: 15px; line-height: 1.6; }
#guide h3 { margin: 26px 0 8px; padding-bottom: 6px; border-bottom: 1px solid #3a4152; color: #8ab4ff; font-size: 15px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; }
#guide p { margin: 10px 0; }
#guide p.lead { font-size: 16px; color: #f3f4f7; }
#guide p.lead strong:first-of-type { color: #8ab4ff; font-size: 17px; }
#guide strong { color: #fff; }
#guide li strong { color: #ffd166; }
#guide em { color: #c9e3ff; }
#guide ul { margin: 8px 0 8px 22px; padding: 0; }
#guide li { margin: 6px 0; }
#guide code { background: #141821; border: 1px solid #3a4152; border-radius: 3px; padding: 0 5px; font-size: 13.5px; color: #cfe0ff; }
#guide .swatch { display: inline-block; width: 26px; height: 0; border-top: 2px solid; vertical-align: middle; margin: 0 6px 0 0; }
#guide .swatch.dashed { border-top-style: dashed; }
#guide p.attrib { margin-top: 28px; padding-top: 12px; border-top: 1px solid #3a4152; color: #7b8498; font-size: 12.5px; }
#guide p.attrib a { color: #7b8498; }

/* Panel toggle: a tab flush against the panel edge, full header height, high contrast. */
#panel-toggle { flex: 0 0 34px; margin-left: 12px; height: 44px; border: 0; border-left: 1px solid #3a4152; border-radius: 0; background: #2a2e39; color: #fff; cursor: pointer; font-size: 20px; font-weight: 700; line-height: 1; }
#panel-toggle:hover { background: #2962ff; }
body.panel-closed #panel { display: none; }
#tv_chart_container { flex: 1 1 auto; min-height: 0; }

#panel { flex: 0 0 340px; display: flex; flex-direction: column; overflow-y: auto; background: #15181e; border-left: 1px solid #2a2e39; }
#panel section { padding: 12px 14px; border-bottom: 1px solid #2a2e39; }
#panel h3 { margin: 0 0 8px; font-size: 11px; font-weight: 600; letter-spacing: .8px; text-transform: uppercase; color: #8a93a6; display: flex; align-items: center; gap: 8px; }
#panel h3 button { margin-left: auto; background: transparent; border: 1px solid #3a4152; color: #8a93a6; border-radius: 4px; padding: 1px 8px; font-size: 11px; cursor: pointer; text-transform: none; letter-spacing: 0; }
#panel h3 button:hover { color: #fff; border-color: #6e7079; }
.unit { color: #6e7079; font-weight: 400; text-transform: none; letter-spacing: 0; }

.seg { display: flex; margin-bottom: 10px; border: 1px solid #2a2e39; border-radius: 6px; overflow: hidden; }
.seg button { flex: 1; padding: 8px 0; background: #1e2330; border: 0; color: #9aa3b5; cursor: pointer; font-weight: 600; }
.seg.small button { padding: 5px 0; font-weight: 500; font-size: 12px; }
.seg button.on { color: #fff; background: #2a2e39; }
#side-seg button[data-side="buy"].on { background: #089981; }
#side-seg button[data-side="sell"].on { background: #f23645; }

#ticket label { display: block; margin: 8px 0 0; color: #8a93a6; font-size: 12px; }
#ticket input { display: block; width: 100%; box-sizing: border-box; margin-top: 4px; padding: 7px 9px; background: #0b0d12; border: 1px solid #2a2e39; border-radius: 5px; color: #fff; font-size: 14px; }
#ticket input:focus { outline: none; border-color: #2962ff; }
.row2 { display: flex; gap: 10px; }
.row2 label { flex: 1; }
#notional { margin: 10px 0 8px; color: #6e7079; font-size: 12px; }
#submit { width: 100%; padding: 11px 0; border: 0; border-radius: 6px; color: #fff; font-weight: 700; font-size: 14px; cursor: pointer; }
#submit.buy { background: #089981; }
#submit.sell { background: #f23645; }
#submit:disabled { opacity: .5; cursor: default; }
#ticket-msg { min-height: 16px; margin-top: 6px; font-size: 12px; color: #f23645; }
#ticket-msg.ok { color: #089981; }

.list .empty { color: #6e7079; }
.item { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 7px 0; border-top: 1px solid #22262f; align-items: center; }
.item:first-child { border-top: 0; }
.item .l1 { color: #fff; font-weight: 600; }
.item .l2 { color: #8a93a6; font-size: 12px; grid-column: 1 / -1; }
.item .pnl.up, .up { color: #089981; }
.item .pnl.dn, .dn { color: #f23645; }
.item .buy { color: #089981; }
.item .sell { color: #f23645; }
.item .actions { display: flex; gap: 6px; }
.item .actions button { background: transparent; border: 1px solid #3a4152; color: #c9ccd4; border-radius: 4px; padding: 3px 9px; font-size: 12px; cursor: pointer; }
.item .actions button:hover { border-color: #fff; color: #fff; }

.kv { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; }
.kv span:nth-child(odd) { color: #8a93a6; }
.kv span:nth-child(even) { color: #fff; text-align: right; font-variant-numeric: tabular-nums; }

#fills .line, #gateway .line { padding: 4px 0; border-top: 1px solid #22262f; color: #c9ccd4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#fills .line:first-child, #gateway .line:first-child { border-top: 0; }
#gateway .line .ev { color: #8ab4ff; }
#gateway .line .ok { color: #089981; }
#gateway .line .err { color: #f23645; }
#gateway .line .lat { color: #6e7079; }
#gw-url { font-size: 11px; }
