:root {
  --bg: #0E1116;
  --panel: #161a22;
  --line: #262c38;
  --text: #d7dbe3;
  --muted: #8a93a6;
  --gold: #e8b931;
  --up: #26a69a;
  --down: #ef5350;
  --err: #ff6b6b;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
[hidden] { display: none !important; }
a { color: var(--gold); }
button { font: inherit; cursor: pointer; border-radius: 6px; border: 1px solid var(--gold); background: var(--gold); color: #14171f; padding: 8px 14px; font-weight: 600; }
button.ghost { background: transparent; color: var(--text); border-color: var(--line); font-weight: 500; padding: 5px 10px; }
button.ghost:hover { border-color: var(--gold); }

.brand { display: flex; gap: 10px; align-items: center; }
.brand b { color: var(--gold); letter-spacing: .5px; }
.brand span { display: block; color: var(--muted); font-size: 12px; }
.brand.small span.sym { display: inline; color: var(--text); font-weight: 600; margin-left: 4px; font-size: 14px; }

.login { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 360px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 24px; display: grid; gap: 14px; }
.login-card label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
.login-card input { background: var(--bg); border: 1px solid var(--line); color: var(--text); border-radius: 6px; padding: 9px 10px; font: inherit; }
.login-card input:focus { outline: 2px solid var(--gold); outline-offset: -1px; }
.err { color: var(--err); min-height: 1.2em; margin: 0; }
.hint { color: var(--muted); font-size: 12px; margin: 0; }

.app { height: 100%; display: flex; flex-direction: column; }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--panel); }
.tfs { display: flex; flex-wrap: wrap; gap: 2px; }
.tfs button { background: transparent; border: 0; color: var(--muted); padding: 4px 8px; font-weight: 600; }
.tfs button[aria-selected="true"] { color: var(--gold); background: #e8b93118; }
.quote { display: flex; gap: 8px; align-items: baseline; font-variant-numeric: tabular-nums; }
#price { font-size: 16px; font-weight: 700; }
.up { color: var(--up); } .down { color: var(--down); }
.right { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.src { font-size: 12px; color: var(--muted); }
.src::before { content: "●"; margin-right: 4px; color: var(--muted); }
.src.live::before { color: var(--up); } .src.mock::before { color: var(--gold); } .src.off::before { color: var(--down); }
.who { color: var(--muted); font-size: 12px; }

.ind-panel { position: absolute; z-index: 20; right: 12px; top: 8px; width: 300px; max-width: calc(100vw - 32px); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: grid; gap: 10px; box-shadow: 0 8px 30px #0008; }
.ind-item { border-top: 1px solid var(--line); padding-top: 8px; display: grid; gap: 6px; }
.ind-item:first-child { border-top: 0; padding-top: 0; }
.ind-item header { display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.ind-item .inputs { display: flex; flex-wrap: wrap; gap: 8px; }
.ind-item .inputs label { font-size: 12px; color: var(--muted); display: grid; gap: 2px; }
.ind-item .inputs input { width: 70px; background: var(--bg); border: 1px solid var(--line); color: var(--text); border-radius: 4px; padding: 3px 6px; }
#indPanel { max-height: calc(100% - 16px); overflow-y: auto; width: 340px; }
.ind-item .inputs .grp { width: 100%; margin-top: 6px; font-size: 11px; font-weight: 600; letter-spacing: .4px; color: var(--gold); text-transform: uppercase; }
.ind-item .inputs label.chk { display: flex; align-items: center; gap: 4px; width: 100%; color: var(--text); }
.ind-item .inputs label.chk input { width: auto; }
.ind-item .desc { font-size: 12px; color: var(--muted); }

button.ghost[aria-pressed="true"] { border-color: var(--gold); color: var(--gold); background: #e8b93118; }
.chart.drawing { cursor: crosshair; }
.alert-panel { width: 340px; max-height: calc(100% - 16px); overflow-y: auto; gap: 4px; }
.alert-panel section { border-top: 1px solid var(--line); padding-top: 8px; display: grid; gap: 6px; }
.alert-panel section:first-child { border-top: 0; padding-top: 0; }
.alert-panel h4 { margin: 0; font-size: 13px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.alert-panel h4 small { color: var(--muted); font-weight: 400; }
.alert-panel .row { display: flex; gap: 6px; }
.alert-panel select, .alert-panel input { flex: 1; min-width: 0; background: var(--bg); border: 1px solid var(--line); color: var(--text); border-radius: 4px; padding: 5px 6px; font: inherit; font-size: 12px; }
.alert-panel .row button { padding: 5px 12px; font-size: 12px; }
.lst { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: 12px; }
.lst li { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 3px 4px; border-radius: 4px; }
.lst li:hover { background: #ffffff08; }
.lst.hist li span { line-height: 1.35; }
.muted { color: var(--muted); }
.small { font-size: 11px; margin: 4px 0 0; }
button.x, button.link { background: none; border: 0; color: var(--muted); padding: 0 4px; font-weight: 400; font-size: 14px; }
button.x:hover, button.link:hover { color: var(--text); }
button.link { font-size: 12px; text-decoration: underline; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.sw { display: flex; gap: 4px; }
.swatch { width: 16px; height: 16px; padding: 0; border-radius: 50%; border: 2px solid transparent; }
.swatch.on { border-color: var(--gold); }
.toasts { position: absolute; z-index: 30; left: 50%; transform: translateX(-50%); bottom: 16px; display: grid; gap: 8px; width: min(460px, calc(100% - 32px)); }
.toast { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: 8px; padding: 10px 12px; font-size: 13px; box-shadow: 0 8px 24px #0009; cursor: pointer; }
.toast.err { border-left-color: var(--down); }
.legend { position: absolute; z-index: 5; font-size: 12px; color: var(--muted); pointer-events: none; font-variant-numeric: tabular-nums; }
.legend b { color: var(--text); font-weight: 600; }
.work { flex: 1; min-height: 0; display: flex; }
.grid { position: absolute; inset: 0; display: grid; gap: 2px; background: var(--line); }
.layout-panel { left: 12px; right: auto; width: 320px; }
.layout-panel h4 { margin: 0 0 6px; font-size: 13px; }
.layout-panel .tf-picks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.layout-panel .tf-picks label { display: flex; align-items: center; justify-content: center; padding: 6px 0; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 12px; }
.layout-panel .tf-picks label.on { border-color: var(--gold); color: var(--gold); background: #e8b93118; }
.layout-panel .tf-picks input { position: absolute; opacity: 0; pointer-events: none; }
.layout-panel .modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.layout-panel .modes button { display: grid; justify-items: center; gap: 4px; padding: 8px 4px; background: transparent; border: 1px solid var(--line); color: var(--text); font-weight: 500; font-size: 12px; }
.layout-panel .modes button.on { border-color: var(--gold); color: var(--gold); background: #e8b93118; }
.layout-panel .modes svg, .lay-btn svg { fill: none; stroke: currentColor; stroke-width: 1.5; }
.layout-panel .modes svg { width: 22px; height: 22px; }
.lay-btn { display: inline-flex; align-items: center; gap: 6px; }
.lay-btn svg { width: 16px; height: 16px; }
.layout-panel .quick { display: flex; gap: 6px; flex-wrap: wrap; }
.layout-panel .quick button { padding: 4px 10px; font-size: 12px; }
.cell { position: relative; min-width: 0; min-height: 0; background: var(--bg); outline: 1px solid transparent; outline-offset: -1px; }
.grid.multi .cell.active { outline-color: var(--gold); }
.cell-chart { position: absolute; inset: 0; }
.ind-tables { position: absolute; z-index: 4; top: 28px; right: 72px; pointer-events: none; display: grid; gap: 6px; justify-items: end; }
.ind-table { border-collapse: collapse; border: 2px solid; font-size: 12px; background: #0E1116cc; }
.ind-table td { border: 2px solid; padding: 2px 8px; white-space: nowrap; }
.ind-table caption { caption-side: bottom; text-align: right; color: rgb(237, 241, 15); font-weight: 600; padding-top: 3px; }
.grid.multi .ind-table { font-size: 10px; }
.grid.multi .ind-table td { padding: 1px 5px; }
.cell .legend { top: 6px; left: 8px; right: 70px; }
.layouts { display: flex; gap: 2px; }
.layouts button { background: transparent; border: 0; color: var(--muted); padding: 4px 6px; display: grid; place-items: center; }
.layouts button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.layouts button[aria-pressed="true"] { color: var(--gold); background: #e8b93118; }
@media (max-width: 900px) {
  .grid.multi { position: static; height: 100%; overflow-y: auto; grid-template-columns: 1fr !important; grid-template-rows: none !important; grid-auto-rows: minmax(300px, 50%); }
  .layout-panel { left: 16px; }
}
.chart { flex: 1; min-width: 0; min-height: 0; position: relative; }
.side { width: 48px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0; background: var(--panel); border-right: 1px solid var(--line); }
.side .sep { width: 28px; height: 1px; background: var(--line); margin: 4px 0; }
.side .grow { flex: 1; }
button.tool { position: relative; width: 36px; height: 36px; padding: 0; display: grid; place-items: center; background: transparent; border: 0; border-radius: 6px; color: var(--text); }
button.tool svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
button.tool:hover { background: #ffffff10; }
button.tool.on, button.tool[aria-pressed="true"] { color: var(--gold); background: #e8b93118; }
.badge { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--gold); color: #14171f; font-size: 10px; line-height: 16px; }
.modal-back { position: fixed; inset: 0; z-index: 50; background: #0008; display: grid; place-items: center; padding: 16px; }
.modal { width: min(760px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 20px 60px #000a; }
.modal header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 8px; }
.modal header h3 { margin: 0; font-size: 20px; }
.modal-body { display: flex; min-height: 360px; overflow: hidden; }
.modal nav { width: 210px; flex: none; padding: 8px 12px; display: grid; align-content: start; gap: 2px; }
.modal nav button { display: flex; align-items: center; gap: 10px; background: transparent; border: 0; color: var(--text); font-weight: 500; text-align: left; padding: 9px 12px; border-radius: 8px; }
.modal nav button:hover { background: #ffffff0a; }
.modal nav button.on { background: #ffffff14; color: #fff; font-weight: 600; }
.modal .pane { flex: 1; overflow-y: auto; padding: 4px 20px 16px; display: grid; align-content: start; gap: 12px; }
.modal h5 { margin: 8px 0 0; font-size: 11px; letter-spacing: .5px; color: var(--muted); font-weight: 600; }
.modal .chk { display: flex; align-items: center; gap: 10px; }
.modal .chk input { width: 16px; height: 16px; accent-color: var(--gold); }
.modal .grid3 { display: grid; grid-template-columns: 140px auto; gap: 12px 16px; align-items: center; }
.modal .grid2 { display: grid; grid-template-columns: 180px minmax(0, 220px); gap: 12px 16px; align-items: center; }
.modal select, .modal input[type=number] { background: var(--bg); border: 1px solid var(--line); color: var(--text); border-radius: 6px; padding: 7px 8px; font: inherit; }
.sw-pick { position: relative; display: inline-block; width: 32px; height: 32px; margin-right: 8px; border: 1px solid var(--line); border-radius: 6px; padding: 3px; cursor: pointer; vertical-align: middle; }
.sw-pick span { display: block; width: 100%; height: 100%; border-radius: 4px; }
.sw-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.modal footer { display: flex; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--line); }
.modal footer span { flex: 1; }
button.x.big { font-size: 26px; line-height: 1; }
@media (max-width: 640px) {
  .modal-body { flex-direction: column; }
  .modal nav { width: auto; display: flex; overflow-x: auto; }
  .modal nav button { white-space: nowrap; }
  .modal .grid2, .modal .grid3 { grid-template-columns: 1fr; }
  .side { width: 40px; }
}
.foot { font-size: 11px; color: var(--muted); padding: 4px 12px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; gap: 0 6px; }
.brand-foot { color: var(--gold); font-weight: 600; letter-spacing: .3px; }
.foot-link { margin-left: auto; font-size: 11px; padding: 0; }
.about { display: grid; gap: 10px; font-size: 13px; line-height: 1.5; }
.about .brand { margin-bottom: 4px; }
.about h5 { margin: 6px 0 0; font-size: 11px; letter-spacing: .5px; color: var(--muted); }
.about ul { margin: 0; padding-left: 18px; }

@media (max-width: 640px) {
  .bar { padding: 8px 16px; }
  .right { margin-left: 0; width: 100%; justify-content: flex-end; }
  .who { display: none; }
  .legend { left: 16px; }
  .ind-panel { right: 16px; }
}
