:root, [data-theme="light"] {
  --bg: #ffffff; --panel: #f8f9fd; --border: #e0e3eb; --text: #131722; --muted: #787b86;
  --blue: #2962ff; --green: #089981; --red: #f23645; --hover: #f0f3fa; --grid: #f0f3fa;
}
[data-theme="dark"] {
  --bg: #0b0f19; --panel: #111827; --border: #1e293b; --text: #f1f5f9; --muted: #94a3b8;
  --blue: #2962ff; --green: #089981; --red: #f23645; --hover: #1e293b; --grid: #161e2e;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: 'Inter', system-ui, sans-serif; font-size: 12px; }
.hidden { display: none !important; }
.kf-mono { font-family: 'JetBrains Mono', monospace; }
.kf-muted { color: var(--muted); font-size: 11px; }
.kf-shell { display: flex; flex-direction: column; width: 100%; height: 100vh; }
.kf-topbar { height: 42px; display: flex; align-items: center; justify-content: space-between; padding: 0 8px; border-bottom: 1px solid var(--border); background: var(--bg); gap: 6px; z-index: 30; }
.kf-top-group { display: flex; align-items: center; gap: 3px; white-space: nowrap; }
.kf-logo { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--text); font-weight: 700; padding: 0 4px; }
.kf-logo-mark { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 5px; background: var(--blue); color: #fff; font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 700; }
.kf-div { width: 1px; height: 20px; background: var(--border); margin: 0 3px; }
.kf-tb-btn { height: 28px; padding: 0 7px; border: 0; border-radius: 4px; background: transparent; color: var(--text); font-size: 12px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.kf-tb-btn:hover, .kf-tb-btn.active { background: var(--hover); color: var(--blue); }
.kf-badge-exn { font-size: 9px; font-family: 'JetBrains Mono', monospace; padding: 1px 4px; border-radius: 3px; background: rgba(41,98,255,0.1); color: var(--blue); font-weight: 700; }
.kf-select { height: 28px; border: 1px solid var(--border); border-radius: 4px; background: var(--bg); color: var(--text); padding: 0 6px; font-size: 12px; }
.kf-btn-blue { height: 28px; padding: 0 10px; border: 0; border-radius: 4px; background: var(--blue); color: #fff; font-weight: 600; font-size: 12px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
.kf-workspace { flex: 1; display: flex; min-height: 0; position: relative; }
.kf-leftbar { width: 46px; border-right: 1px solid var(--border); background: var(--bg); display: flex; flex-direction: column; align-items: center; padding: 6px 0; gap: 3px; z-index: 25; }
.kf-tool { width: 32px; height: 32px; border: 0; border-radius: 5px; background: transparent; color: var(--text); cursor: pointer; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; }
.kf-tool:hover, .kf-tool.active { background: rgba(41,98,255,0.12); color: var(--blue); }
.kf-hsep { width: 24px; height: 1px; background: var(--border); margin: 3px 0; }
.kf-pop-wrap { position: relative; }
.kf-popover { position: absolute; top: 32px; left: 0; width: 190px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,0.12); padding: 6px; z-index: 60; }
.kf-flyout { position: absolute; top: 0; left: 38px; width: 210px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,0.14); padding: 6px; z-index: 60; }
.kf-emoji-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; width: 164px; }
.kf-emoji-grid button { height: 32px; border: 0; background: var(--panel); border-radius: 4px; cursor: pointer; font-size: 16px; }
.kf-pop-sec { font-size: 10px; font-weight: 700; color: var(--muted); padding: 4px 6px; }
.kf-pop-item { display: block; width: 100%; text-align: left; border: 0; background: transparent; color: var(--text); padding: 6px 8px; border-radius: 4px; cursor: pointer; font-size: 12px; }
.kf-pop-item:hover { background: var(--hover); color: var(--blue); }
.kf-stage { flex: 1; position: relative; min-width: 0; height: 100%; overflow: hidden; }
.kf-chart-mount { width: 100%; height: 100%; }
.kf-draw-canvas { position: absolute; inset: 0; pointer-events: none; z-index: 12; }
.kf-draw-canvas.drawing { pointer-events: auto; cursor: crosshair; }
.kf-overlay-hud { position: absolute; top: 10px; left: 12px; z-index: 15; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.kf-pair-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; background: rgba(255,255,255,0.78); backdrop-filter: blur(4px); padding: 3px 8px; border-radius: 5px; border: 1px solid var(--border); }
[data-theme="dark"] .kf-pair-line { background: rgba(17,24,39,0.82); }
.kf-kf-pill { background: var(--blue); color: #fff; font-weight: 700; font-size: 10px; padding: 1px 5px; border-radius: 3px; font-family: 'JetBrains Mono', monospace; }
.kf-conn.live { color: var(--green); font-weight: 700; font-size: 11px; }
.kf-conn.warn { color: #f59e0b; font-weight: 700; font-size: 11px; }
.kf-ohlc { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--muted); }
.kf-order-box { display: inline-flex; align-items: center; gap: 5px; pointer-events: auto; }
.kf-ord { border-radius: 5px; padding: 4px 10px; border: 1px solid; background: var(--bg); cursor: pointer; display: flex; flex-direction: column; align-items: flex-start; min-width: 84px; font-family: 'JetBrains Mono', monospace; }
.kf-ord.sell { border-color: var(--red); color: var(--red); }
.kf-ord.buy { border-color: var(--blue); color: var(--blue); }
.kf-ord-side { font-size: 9px; font-weight: 700; font-family: 'Inter', sans-serif; }
.kf-spread-pill { padding: 2px 6px; border-radius: 4px; background: var(--panel); border: 1px solid var(--border); font-family: 'JetBrains Mono', monospace; font-size: 10.5px; color: var(--muted); }
.kf-replay-bar { pointer-events: auto; display: inline-flex; align-items: center; gap: 6px; background: var(--panel); border: 1px solid var(--border); padding: 4px 8px; border-radius: 5px; font-weight: 600; }
.kf-replay-bar button { border: 1px solid var(--border); background: var(--bg); color: var(--text); border-radius: 4px; padding: 2px 7px; cursor: pointer; font-size: 11px; }
.kf-watermark-pill { position: absolute; left: 12px; bottom: 12px; z-index: 15; display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 999px; background: var(--panel); border: 1px solid var(--border); color: var(--text); font-weight: 700; font-size: 11px; text-decoration: none; box-shadow: 0 2px 6px rgba(0,0,0,0.06); }
.kf-rightbar { width: 284px; border-left: 1px solid var(--border); background: var(--bg); display: flex; flex-direction: column; min-height: 0; }
.kf-wl-head { padding: 8px 10px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; font-weight: 600; }
.kf-wl-wrap { flex: 1; overflow-y: auto; }
.kf-wl-table { width: 100%; border-collapse: collapse; font-family: 'JetBrains Mono', monospace; font-size: 11.5px; }
.kf-wl-table th { text-align: left; padding: 6px 8px; color: var(--muted); border-bottom: 1px solid var(--border); font-weight: 500; }
.kf-wl-table td { padding: 7px 8px; border-bottom: 1px solid var(--border); cursor: pointer; }
.kf-wl-table tr:hover, .kf-wl-table tr.active { background: var(--hover); }
.up { color: var(--green); } .dn { color: var(--red); }
.kf-detail-box { border-top: 1px solid var(--border); padding: 10px 12px; background: var(--panel); display: flex; flex-direction: column; gap: 8px; }
.kf-det-top { display: flex; justify-content: space-between; align-items: center; }
.kf-det-price { font-family: 'JetBrains Mono', monospace; font-size: 18px; font-weight: 700; }
.kf-range-lbls { display: flex; justify-content: space-between; font-size: 11px; margin-bottom: 3px; }
.kf-range-track { height: 5px; background: var(--border); border-radius: 99px; overflow: hidden; }
.kf-range-fill { height: 100%; background: var(--blue); }
.kf-bottombar { height: 32px; border-top: 1px solid var(--border); background: var(--bg); display: flex; align-items: center; justify-content: space-between; padding: 0 10px; }
.kf-ranges button, .kf-btm-btn { border: 0; background: transparent; color: var(--muted); padding: 3px 6px; border-radius: 4px; cursor: pointer; font-size: 11.5px; font-weight: 500; }
.kf-ranges button:hover, .kf-btm-btn:hover, .kf-btm-btn.active { color: var(--blue); background: var(--hover); }
.kf-btm-right { display: flex; align-items: center; gap: 6px; }
.kf-modal { position: fixed; inset: 0; background: rgba(15,23,42,0.45); display: flex; align-items: center; justify-content: center; z-index: 80; padding: 16px; }
.kf-modal-card { width: 100%; max-width: 440px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 14px; box-shadow: 0 20px 40px rgba(0,0,0,0.2); }
.kf-modal-wide { max-width: 680px; }
.kf-modal-hd { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 14px; }
.kf-modal-hd button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 15px; }
.kf-inp { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); color: var(--text); margin-bottom: 8px; }
.kf-list { max-height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.kf-sym-row { display: flex; justify-content: space-between; padding: 8px 10px; border-radius: 6px; cursor: pointer; border: 1px solid transparent; }
.kf-sym-row:hover { background: var(--hover); border-color: var(--border); }
.kf-ind-grid { display: grid; grid-template-columns: 160px 1fr; gap: 12px; min-height: 210px; }
.kf-ind-nav { border-right: 1px solid var(--border); padding-right: 8px; display: flex; flex-direction: column; gap: 4px; }
.kf-ind-nav div { padding: 6px 8px; border-radius: 5px; color: var(--muted); }
.kf-ind-nav div.active { background: var(--hover); color: var(--blue); font-weight: 600; }
.kf-ind-row { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 6px; cursor: pointer; }
.kf-ind-row:hover { background: var(--hover); }
.kf-broker-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.kf-bcard { border: 1px solid var(--border); border-radius: 8px; padding: 12px; background: var(--panel); display: flex; flex-direction: column; justify-content: space-between; gap: 8px; }
.kf-bcard p { margin: 4px 0; color: var(--muted); line-height: 1.4; }
.kf-toast-box { position: fixed; right: 16px; bottom: 44px; z-index: 90; display: flex; flex-direction: column; gap: 6px; }
.kf-toast { background: #131722; color: #fff; padding: 8px 12px; border-radius: 6px; font-size: 11.5px; box-shadow: 0 6px 18px rgba(0,0,0,0.2); }
@media (max-width: 900px) { .kf-rightbar, .kf-tf-quick { display: none; } .kf-broker-cards, .kf-ind-grid { grid-template-columns: 1fr; } }
