:root {
  --bg: #0d1117; --panel: #141a23; --panel2: #1a212c; --line: #263040; --text: #dbe2ea; --muted: #8492a6;
  --up: #2fbf8f; --down: #ef5b6b; --accent: #5aa2ff; --warn: #e6b450;
  font-family: system-ui, "Segoe UI", Roboto, Arial, sans-serif; font-size: 14px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--text); }
body { display: flex; flex-direction: column; }
button, input { font: inherit; color: inherit; }
b, td, th, input, .num { font-variant-numeric: tabular-nums; }

header { display: flex; align-items: center; gap: 24px; padding: 8px 14px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 600; white-space: nowrap; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-left: 6px; background: var(--down); }
.dot.on { background: var(--up); }
.acct { display: flex; gap: 22px; flex: 1; flex-wrap: wrap; }
.acct div { display: flex; flex-direction: column; }
.acct span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.who { color: var(--muted); white-space: nowrap; }

main { flex: 1; min-height: 0; display: grid; grid-template-columns: 250px minmax(0, 1fr) 270px; grid-template-rows: minmax(260px, 1fr) 230px; gap: 1px; background: var(--line); }
#symbols { grid-row: 1 / 3; background: var(--panel); overflow-y: auto; }
.sym { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; padding: 7px 12px; cursor: pointer; border-bottom: 1px solid var(--line); align-items: baseline; }
.sym:hover { background: var(--panel2); }
.sym.on { background: var(--panel2); box-shadow: inset 3px 0 0 var(--accent); }
.sym .n { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sym .p { text-align: right; }
.sym.stale .p { color: var(--muted); }
.up { color: var(--up); }
.down { color: var(--down); }

.chartbox { background: var(--bg); display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.charthead { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; gap: 12px; }
.tfs { display: flex; gap: 4px; }
.tfs button, .tab, .ghost { background: transparent; border: 1px solid var(--line); border-radius: 5px; padding: 3px 9px; cursor: pointer; color: var(--muted); }
.tfs button.on, .tab.on { color: var(--text); border-color: var(--accent); }
.canvaswrap { flex: 1; min-height: 0; position: relative; }
canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }

.ticket { background: var(--panel); padding: 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.ticket h2 { margin: 0; font-size: 16px; }
label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12px; }
select { background: var(--bg); border: 1px solid var(--line); border-radius: 5px; padding: 7px 9px; color: var(--text); width: 100%; font: inherit; }
input { background: var(--bg); border: 1px solid var(--line); border-radius: 5px; padding: 7px 9px; color: var(--text); width: 100%; min-width: 0; }
input:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.stepper { display: grid; grid-template-columns: 34px 1fr 34px; gap: 4px; }
.stepper button { background: var(--panel2); border: 1px solid var(--line); border-radius: 5px; cursor: pointer; }
.buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.buttons button { border: 0; border-radius: 6px; padding: 9px 4px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; color: #fff; font-weight: 600; }
.buttons small { font-weight: 400; opacity: .9; }
.sell { background: #b8404e; }
.buy { background: #1f8f6a; }
.buttons button:disabled { background: var(--panel2); color: var(--muted); cursor: not-allowed; }
.msg { min-height: 18px; font-size: 13px; }
.msg.bad { color: var(--down); }
.msg.good { color: var(--up); }
.muted { color: var(--muted); }
.small { font-size: 12px; margin: 0; }

.bottom { background: var(--panel); display: flex; flex-direction: column; min-height: 0; min-width: 0; grid-column: 2 / 4; }
.tabs { display: flex; gap: 6px; padding: 8px 12px; }
.tablewrap { flex: 1; overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 5px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; font-size: 12px; position: sticky; top: 0; background: var(--panel); }
th:first-child, td:first-child, th.l, td.l { text-align: left; }
td input { width: 92px; padding: 3px 6px; text-align: right; }
td button { background: var(--panel2); border: 1px solid var(--line); border-radius: 4px; padding: 2px 8px; cursor: pointer; }
td.empty { text-align: center; color: var(--muted); padding: 22px; }

.overlay { position: fixed; inset: 0; background: rgba(8, 11, 16, .92); display: flex; align-items: center; justify-content: center; padding: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 22px; width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 12px; }
.card h1 { margin: 0; font-size: 20px; }
.card .tabs { padding: 0; }
.primary { background: var(--accent); color: #06121f; border: 0; border-radius: 6px; padding: 9px; font-weight: 600; cursor: pointer; }
.hide { display: none !important; }

@media (max-width: 900px) {
  main { grid-template-columns: 1fr; grid-template-rows: 150px 300px auto 240px; overflow-y: auto; }
  #symbols { grid-row: auto; }
  .bottom { grid-column: auto; }
}
