/* Desktop trading-terminal look: light Windows chrome around a black chart. */
html, body { height: 100%; margin: 0; }
body {
  font: 12px "Segoe UI", Tahoma, Arial, sans-serif;
  color: #000; background: #f0f0f0;
  display: grid; grid-template-rows: auto auto 1fr auto auto;
  overflow: hidden; user-select: none; -webkit-user-select: none;
}
button { font: inherit; color: inherit; }
.hidden { display: none !important; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.buy { color: #0000ff; }
.sell { color: #ff0000; }
.dim { color: #808080; }

/* Menu bar */
#menubar { display: flex; background: #fff; border-bottom: 1px solid #dadada; height: 22px; position: relative; z-index: 40; }
.mtop { position: relative; padding: 3px 8px; cursor: default; }
.mtop:hover, .mtop.open { background: #cce8ff; }
.dd {
  display: none; position: absolute; top: 22px; left: 0; min-width: 250px;
  background: #f2f2f2; border: 1px solid #a0a0a0; box-shadow: 2px 2px 3px rgba(0,0,0,.3); padding: 2px 0;
}
.mtop.open .dd { display: block; }
.mi { display: grid; grid-template-columns: 24px 1fr auto; padding: 3px 18px 3px 2px; white-space: nowrap; }
.mi:hover { background: #91c9f7; }
.mi .ck { text-align: center; }
.mi .sc { color: #444; padding-left: 30px; }
.msep { height: 1px; background: #d7d7d7; margin: 3px 2px 3px 28px; }
.mhead { padding: 3px 8px 1px 28px; color: #6d6d6d; font-size: 11px; }

/* Toolbar */
#toolbar { display: flex; align-items: center; gap: 1px; padding: 2px 4px; background: #f0f0f0; border-bottom: 1px solid #d4d4d4; height: 30px; }
.tbtn {
  height: 24px; min-width: 24px; padding: 0 4px; display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  border: 1px solid transparent; background: none; border-radius: 2px; cursor: default;
}
.tbtn:hover { background: #e5f3ff; border-color: #cce8ff; }
.tbtn.on { background: #cce8ff; border-color: #99d1ff; }
.tbtn svg { width: 16px; height: 16px; display: block; }
.tsep { width: 1px; height: 20px; background: #c9c9c9; margin: 0 5px; }
.tf { font-weight: 600; font-size: 11px; min-width: 32px; }
.verdict-pill { display: inline-flex; align-items: center; gap: 6px; padding: 0 8px; height: 22px;
  border: 1px solid #c9c9c9; background: #fff; border-radius: 2px; }
.verdict-pill i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

/* Workspace */
#workspace { display: grid; grid-template-columns: auto 1fr; min-height: 0; }
#left { width: 380px; display: grid; grid-template-rows: auto 1fr; border-right: 1px solid #a0a0a0; min-height: 0; background: #fff; }
#left.only-nav { grid-template-rows: 1fr; }
.win { display: grid; grid-template-rows: auto 1fr auto; min-height: 0; background: #fff; }
#mw { border-bottom: 1px solid #a0a0a0; max-height: 45vh; }
.win-title { display: flex; justify-content: space-between; align-items: center; height: 20px; padding: 0 2px 0 6px;
  background: #f0f0f0; border-bottom: 1px solid #d4d4d4; }
.x { border: 0; background: none; width: 18px; height: 18px; line-height: 16px; padding: 0; cursor: default; color: #333; }
.x:hover { background: #e81123; color: #fff; }
.win-body { overflow: auto; min-height: 0; }
.win-tabs, #tb-tabs, #charttabs { display: flex; background: #f0f0f0; border-top: 1px solid #d4d4d4; height: 22px; flex: none; }
.wtab, .ttab, .ctab { padding: 3px 12px; cursor: default; border-right: 1px solid #d4d4d4; white-space: nowrap; }
.wtab:hover, .ttab:hover, .ctab:hover { background: #e5f3ff; }
.wtab.on, .ttab.on, .ctab.on { background: #fff; margin-top: -1px; border-top: 1px solid #fff; }
.ctab.on { font-weight: 600; }
.ttab .cnt { color: #808080; margin-left: 4px; }

/* Tables */
table.grid { width: 100%; border-collapse: collapse; }
table.grid th {
  position: sticky; top: 0; z-index: 1; background: #fff; font-weight: normal; text-align: left;
  padding: 2px 6px; border-right: 1px solid #e5e5e5; border-bottom: 1px solid #d4d4d4; white-space: nowrap; color: #333;
}
table.grid th.num { text-align: right; }
table.grid td { padding: 2px 6px; white-space: nowrap; border-bottom: 1px solid #f3f3f3; }
table.grid td.wrap { white-space: normal; }
table.grid tr:hover td { background: #e5f3ff; }
table.grid tr.sel td { background: #3399ff; color: #fff; }
table.grid tr.sel td .buy, table.grid tr.sel td .sell { color: #fff; }
table.grid tr.group td { font-weight: 600; background: #f7f7f7; }
table.grid tr.total td { font-weight: 600; border-top: 1px solid #d4d4d4; background: #fff; }
table.grid tr.past td { color: #a0a0a0; }
table.grid tr.soon td { background: #fff1e6; }
table.grid tr.link { cursor: pointer; }
table.props td:first-child { color: #555; width: 220px; }
.arrow-up { color: #0000ff; }
.arrow-dn { color: #ff0000; }
.imp-bars { display: inline-flex; gap: 2px; vertical-align: middle; }
.imp-bars i { width: 4px; height: 10px; background: #d9d9d9; display: inline-block; }
.imp-bars.High i { background: #ff3b30; }
.imp-bars.Medium i:nth-child(-n+2) { background: #ff9500; }
.imp-bars.Low i:first-child, .imp-bars.Holiday i:first-child { background: #8e8e93; }

/* Navigator tree */
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree { padding: 3px 0; }
.tree ul { padding-left: 16px; }
.tree .node { display: flex; align-items: center; gap: 5px; padding: 1px 4px; white-space: nowrap; cursor: default; }
.tree .node:hover { background: #e5f3ff; }
.tree .tw { width: 10px; color: #555; font-size: 9px; text-align: center; }
.tree .cb { width: 11px; height: 11px; border: 1px solid #7a7a7a; background: #fff; display: inline-grid; place-items: center; font-size: 10px; line-height: 1; }
.tree .ic { width: 14px; height: 14px; display: inline-block; flex: none; }
.tree .meta { color: #808080; margin-left: auto; padding-left: 10px; }
.tree li.closed > ul { display: none; }

/* Charts */
#charts { display: grid; grid-template-rows: 1fr auto; min-width: 0; min-height: 0; }
#chartwin { position: relative; min-height: 0; background: #000; overflow: hidden; }
#cv { position: absolute; inset: 0; outline: none; cursor: crosshair; }
#cv.drag { cursor: grabbing; }
#loading { position: absolute; right: 80px; top: 6px; color: #c0c0c0; font-size: 11px; display: none; }

/* Toolbox */
#toolbox { display: grid; grid-template-columns: 20px 1fr; height: var(--tbh, 230px); border-top: 1px solid #a0a0a0; background: #fff; position: relative; min-height: 0; }
#tb-resize { position: absolute; top: -4px; left: 0; right: 0; height: 7px; cursor: ns-resize; z-index: 5; }
#tb-strip { display: flex; flex-direction: column; align-items: center; background: #f0f0f0; border-right: 1px solid #d4d4d4; }
#tb-strip span { writing-mode: vertical-rl; transform: rotate(180deg); margin-top: auto; margin-bottom: 8px; font-size: 11px; }
#tb-main { display: grid; grid-template-rows: 1fr auto; min-height: 0; min-width: 0; }
#tb-body { overflow: auto; min-height: 0; }
.tb-note { padding: 6px 8px; color: #555; }

/* Status bar */
#statusbar { display: grid; grid-template-columns: 1fr 70px 125px 95px 95px 95px 95px 70px 190px; height: 20px; background: #f0f0f0; border-top: 1px solid #d4d4d4; font-size: 11.5px; }
#statusbar span { padding: 2px 6px; border-left: 1px solid #d4d4d4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#statusbar span:first-child { border-left: 0; }
.conn { display: inline-flex; gap: 1px; align-items: flex-end; height: 10px; margin-right: 6px; vertical-align: -1px; }
.conn i { width: 3px; background: #2fb24c; display: inline-block; }
.conn.err i { background: #e81123; }
.conn.wait i { background: #f0a30a; }

/* Dialog */
#dialog-layer:empty { display: none; }
#dialog-layer { position: fixed; inset: 0; background: rgba(0,0,0,.08); display: grid; place-items: center; z-index: 100; }
.dlg { background: #f0f0f0; border: 1px solid #7a7a7a; box-shadow: 0 6px 24px rgba(0,0,0,.3); width: 460px; }
.dlg-title { display: flex; justify-content: space-between; align-items: center; background: #fff; padding: 0 0 0 10px; height: 30px; }
.dlg-title .x { width: 44px; height: 30px; }
.dlg-body { padding: 16px; line-height: 1.5; user-select: text; }
.dlg-foot { padding: 10px 16px; text-align: right; }
.wbtn { min-width: 76px; height: 24px; background: #e1e1e1; border: 1px solid #adadad; }
.wbtn:hover { background: #e5f1fb; border-color: #0078d7; }

/* One-click trading panel (top-left of the chart) */
#oneclick { position: absolute; top: 36px; left: 6px; z-index: 3; display: grid; grid-template-columns: 96px 64px 96px;
  font-family: Tahoma, "Segoe UI", sans-serif; box-shadow: 0 1px 4px rgba(0,0,0,.6); }
.oc-btn { border: 1px solid #3c3c3c; color: #fff; padding: 2px 6px 3px; cursor: pointer; display: flex; flex-direction: column; }
.oc-btn.sell { background: linear-gradient(#e2463c, #b3241c); align-items: flex-start; }
.oc-btn.buy { background: linear-gradient(#3b8be6, #1d5fb2); align-items: flex-end; }
.oc-btn:hover { filter: brightness(1.12); }
.oc-btn:active { filter: brightness(.88); }
.oc-lbl { font-size: 10px; font-weight: 700; letter-spacing: .04em; }
.oc-px { line-height: 1; white-space: nowrap; }
.oc-px small { font-size: 12px; }
.oc-px b { font-size: 22px; }
.oc-mid { display: grid; grid-template-rows: 1fr auto; background: #fff; border-top: 1px solid #3c3c3c; border-bottom: 1px solid #3c3c3c; }
.oc-vol { display: grid; grid-template-columns: 13px 1fr 13px; }
.oc-vol button { border: 0; background: #e8e8e8; font-size: 7px; padding: 0; cursor: pointer; }
.oc-vol button:hover { background: #cce8ff; }
.oc-vol input { width: 100%; border: 0; text-align: center; font: 12px Tahoma, sans-serif; padding: 0; min-width: 0; }
.oc-spread { font-size: 10px; color: #666; text-align: center; border-top: 1px solid #ddd; }

/* Order dialogs */
.dlg.wide { width: 560px; }
.form { display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; align-items: center; }
.form input, .form select { height: 22px; border: 1px solid #7a7a7a; padding: 0 4px; font: inherit; background: #fff; }
.no-quote { text-align: center; margin: 14px 0 6px; font-family: Tahoma, sans-serif; }
.no-quote small { font-size: 16px; }
.no-quote b { font-size: 28px; }
.no-err { min-height: 18px; text-align: center; }
.no-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.no-actions.pend { grid-template-columns: 1fr; }
.sellbtn, .buybtn { height: 32px; border: 1px solid #555; color: #fff; font-weight: 600; cursor: pointer; }
.sellbtn { background: #d23a30; }
.buybtn { background: #2a73d0; }
.sellbtn:hover, .buybtn:hover { filter: brightness(1.1); }
.wbtn.sm { min-width: 0; height: 18px; padding: 0 8px; font-size: 11px; }
.rowx { border: 0; background: none; width: 16px; height: 16px; line-height: 14px; padding: 0; color: #666; cursor: pointer; }
.rowx:hover { background: #e81123; color: #fff; }
.tb-sub { padding: 6px 8px 2px; color: #555; border-top: 1px solid #d4d4d4; margin-top: 6px; }
table.grid tr[data-pos] { cursor: default; }
.verdict-pill + .verdict-pill { margin-left: 6px; }
