:root {
  --bg: #0b1020;
  --panel: #111930;
  --panel-2: #18223a;
  --panel-3: #1f2b47;
  --line: #24304d;
  --text: #e6ebf5;
  --muted: #8a96b3;
  --accent: #f5b942;
  --on-accent: #1a1300;
  --up: #22c3a6;
  --down: #f2576b;
  --neutral: #8a96b3;
  --radius: 8px;
  --top-h: 46px;
  --bottom-h: 34px;
  --left-w: 46px;
  --strip-w: 46px;
  --panel-w: 340px;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font-size: 13px; overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.ic { display: block; flex: 0 0 auto; }
.up { color: var(--up); } .down { color: var(--down); } .muted { color: var(--muted); }
.grow { flex: 1; }
kbd { font: 11px ui-monospace, monospace; color: var(--muted); margin-left: auto; padding-left: 16px; }

/* ---------- grid ---------- */
.app {
  display: grid; height: 100vh; height: 100dvh;
  grid-template-columns: var(--left-w) minmax(0, 1fr) var(--panel-w) var(--strip-w);
  grid-template-rows: var(--top-h) minmax(0, 1fr) var(--bottom-h);
  grid-template-areas: "top top top top" "left chart panel strip" "left bottom panel strip";
}
.app.panel-closed { grid-template-columns: var(--left-w) minmax(0, 1fr) 0 var(--strip-w); }
.app.panel-closed .rightpanel { display: none; }
.topbar { grid-area: top; }
.lefttools { grid-area: left; }
.chart-wrap { grid-area: chart; }
.bottombar { grid-area: bottom; }
.rightpanel { grid-area: panel; }
.rightstrip { grid-area: strip; }

/* ---------- shared buttons ---------- */
.tb, .icon-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 8px; border: 0; border-radius: 6px;
  background: none; color: var(--text); white-space: nowrap;
}
.tb:hover, .icon-btn:hover { background: var(--panel-2); }
.tb.active, .icon-btn.active { color: var(--accent); }
.tb.icon-only, .icon-btn { padding: 0 7px; }
.icon-btn { height: 28px; color: var(--muted); }
.icon-btn:hover { color: var(--text); }
.sep { width: 1px; height: 22px; background: var(--line); flex: 0 0 auto; }
.link-btn { background: none; border: 0; color: var(--muted); text-decoration: underline; padding: 2px 4px; }
.primary {
  background: var(--accent); color: var(--on-accent); border: 0; border-radius: 6px; padding: 7px 12px; font-weight: 600;
}
.primary:disabled { opacity: .6; cursor: progress; }
.ghost { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 6px; padding: 6px 10px; }
.ghost:hover { color: var(--text); }
input[type="text"], input[type="number"], input[type="search"], input[type="date"], input[type="time"], select, textarea {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; min-width: 0; color: var(--text);
}
input:focus-visible, select:focus-visible, button:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
label.f { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 4px; padding: 0 8px; background: var(--panel); border-bottom: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: none;
}
.topbar::-webkit-scrollbar { display: none; }
.brand { padding-right: 4px; }
.logo { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--on-accent); font-weight: 800; }
.sym-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px 0 10px; border-radius: 16px;
  background: var(--panel-2); border: 1px solid var(--line); min-width: 120px;
}
.sym-btn b { font-weight: 700; letter-spacing: .02em; }
.sym-btn .ic { color: var(--muted); }
.tf-favs { display: flex; gap: 1px; }
.tf-favs button { height: 30px; min-width: 30px; padding: 0 6px; border: 0; border-radius: 6px; background: none; color: var(--muted); font-weight: 500; }
.tf-favs button:hover { background: var(--panel-2); color: var(--text); }
.tf-favs button.active { background: var(--panel-3); color: var(--accent); }
.tf-favs button.dim { opacity: .4; }
.trade-btn { margin-left: 6px; height: 32px; padding: 0 16px; border: 0; border-radius: 16px; background: var(--accent); color: var(--on-accent); font-weight: 700; }

/* ---------- left toolbar ---------- */
.lefttools {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; background: var(--panel);
  border-right: 1px solid var(--line); overflow-y: auto; scrollbar-width: none;
}
.lefttools::-webkit-scrollbar { display: none; }
.lt-group { position: relative; display: flex; }
.lt-btn {
  width: 36px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 6px; background: none; color: var(--text);
}
.lt-btn:hover { background: var(--panel-2); }
.lt-btn.active { background: var(--panel-3); color: var(--accent); }
.lt-btn.on { color: var(--accent); }
.lt-more {
  position: absolute; right: -2px; bottom: 2px; width: 8px; height: 8px; border: 0; padding: 0; background: none;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: scale(.6); opacity: 0;
}
.lt-group:hover .lt-more { opacity: 1; }
.lt-sep { width: 26px; height: 1px; background: var(--line); margin: 5px 0; flex: 0 0 auto; }

/* ---------- menus & dialogs ---------- */
.menu {
  position: fixed; z-index: 50; min-width: 200px; max-height: 70vh; overflow-y: auto; padding: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,.5);
}
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 2px; }
.menu-h { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 6px 8px 4px; }
.menu-i { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border: 0; border-radius: 6px; background: none; text-align: left; }
.menu-i:hover { background: var(--panel-2); }
.menu-i.active { color: var(--accent); }
.mi-ic { display: inline-flex; }
.dlg-wrap { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(4,8,18,.6); padding: 16px; }
.dlg {
  width: min(440px, 100%); max-height: min(720px, 92vh); display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 20px 50px rgba(0,0,0,.5);
}
.dlg.wide { width: min(640px, 100%); }
.dlg-h { display: flex; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.dlg-h h3 { margin: 0; font-size: 15px; flex: 1; }
.dlg-b { padding: 14px; overflow-y: auto; display: grid; gap: 12px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; }
.search-input { width: 100%; font-size: 15px; padding: 9px 12px; }
.res-list { display: grid; gap: 2px; max-height: 52vh; overflow-y: auto; }
.res {
  display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center; padding: 8px; border-radius: 6px;
  background: none; border: 0; text-align: left; width: 100%;
}
.res:hover, .res.kb { background: var(--panel-2); }
.res .t { font-weight: 600; }
.res .d { font-size: 12px; color: var(--muted); }
.res .x { font-size: 11px; color: var(--muted); text-align: right; }
.avatar {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700;
  background: var(--panel-3); color: var(--accent); flex: 0 0 auto;
}
.avatar.crypto { color: #ff9f43; } .avatar.forex { color: #7aa2ff; } .avatar.commodity { color: #f5b942; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: none; color: var(--muted); border-radius: 999px; padding: 4px 10px; }
.chip.active { border-color: var(--accent); color: var(--accent); }
.ind-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 10px; border-radius: 6px;
  background: none; border: 0; width: 100%; text-align: left;
}
.ind-row:hover { background: var(--panel-2); }
.ind-row .tag { font-size: 11px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid .full { grid-column: 1 / -1; }

/* ---------- chart ---------- */
.chart-wrap { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.grid { flex: 1; display: grid; gap: 2px; min-height: 0; background: var(--line); }
.grid[data-layout="1"] { grid-template: minmax(0, 1fr) / minmax(0, 1fr); }
.grid[data-layout="2v"] { grid-template: minmax(0, 1fr) / repeat(2, minmax(0, 1fr)); }
.grid[data-layout="2h"] { grid-template: repeat(2, minmax(0, 1fr)) / minmax(0, 1fr); }
.grid[data-layout="3v"] { grid-template: minmax(0, 1fr) / repeat(3, minmax(0, 1fr)); }
.grid[data-layout="3l"] { grid-template: repeat(2, minmax(0, 1fr)) / minmax(0, 1.5fr) minmax(0, 1fr); }
.grid[data-layout="3l"] .cell:first-child { grid-row: 1 / 3; }
.grid[data-layout="4"] { grid-template: repeat(2, minmax(0, 1fr)) / repeat(2, minmax(0, 1fr)); }
.grid[data-layout="6"] { grid-template: repeat(2, minmax(0, 1fr)) / repeat(3, minmax(0, 1fr)); }
.grid[data-layout="8"] { grid-template: repeat(2, minmax(0, 1fr)) / repeat(4, minmax(0, 1fr)); }
.cell { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); overflow: hidden; }
.grid.multi .cell.active::after { content: ""; position: absolute; inset: 0; border: 1px solid var(--accent); pointer-events: none; z-index: 9; }
.grid.compact .main-pane { min-height: 90px; }
.grid.compact .sub-pane { min-height: 44px; }
.grid.compact .lg-trade, .grid.compact .lg-inds, .grid.compact .mtf { display: none; }
.grid.multi .lg-inds .lg-ind:not(:hover) .vals { display: none; }
.layout-menu .mi-ic { color: var(--muted); }
.layout-menu .menu-i.active .mi-ic { color: var(--accent); }
.panes { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.pane { position: relative; min-height: 0; }
.main-pane { flex: 3; min-height: 200px; }
.sub-pane { flex: 1; min-height: 90px; max-height: 240px; border-top: 1px solid var(--line); }
.chart-host { position: absolute; inset: 0; }
.overlay { position: absolute; left: 0; top: 0; pointer-events: none; overflow: hidden; z-index: 3; }
.overlay .hit { pointer-events: stroke; cursor: move; }
.overlay .hit-fill { pointer-events: all; cursor: move; }
.overlay .handle { pointer-events: all; cursor: grab; }
.overlay.locked .hit, .overlay.locked .hit-fill, .overlay.locked .handle { pointer-events: none; }
.overlay text { font-family: inherit; }
.capture { position: absolute; inset: 0; z-index: 4; display: none; cursor: crosshair; touch-action: none; }
.capture.on { display: block; }
.legend { position: absolute; top: 6px; left: 10px; z-index: 5; pointer-events: none; display: grid; gap: 4px; max-width: calc(100% - 140px); }
.lg-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.lg-main .nm { color: var(--text); font-weight: 600; font-size: 13px; }
.lg-main b { font-weight: 600; }
.lg-trade { display: flex; align-items: stretch; gap: 4px; pointer-events: auto; width: max-content; }
.qt {
  display: grid; justify-items: start; gap: 0; padding: 3px 8px; border-radius: 6px; border: 1px solid; background: rgba(11,16,32,.8);
  font-variant-numeric: tabular-nums; min-width: 86px;
}
.qt b { font-size: 13px; }
.qt span { font-size: 10px; letter-spacing: .08em; }
.qt.sell { color: var(--down); border-color: rgba(242,87,107,.5); }
.qt.buy { color: var(--up); border-color: rgba(34,195,166,.5); }
.qt:hover { background: var(--panel-2); }
.qty { width: 64px; text-align: center; padding: 2px 4px; }
.lg-ind { pointer-events: auto; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); width: max-content; max-width: 100%; }
.lg-ind .nm { color: var(--text); }
.lg-ind .vals { font-variant-numeric: tabular-nums; display: flex; gap: 6px; }
.lg-ind .acts { display: none; gap: 2px; }
.lg-ind:hover .acts, .lg-ind:focus-within .acts { display: inline-flex; }
.lg-ind .acts button { border: 0; background: var(--panel-2); color: var(--muted); border-radius: 4px; padding: 2px; display: grid; place-items: center; }
.lg-ind .acts button:hover { color: var(--text); }
.lg-ind.off .nm, .lg-ind.off .vals { opacity: .45; }
.pane-legend { position: absolute; top: 4px; left: 10px; z-index: 5; }
.status { position: absolute; inset: 0; display: none; place-items: center; color: var(--muted); z-index: 6; pointer-events: none; text-align: center; padding: 20px; }
.status.show { display: grid; }
.mtf {
  position: absolute; top: 8px; right: 86px; z-index: 5; background: rgba(17,25,48,.92); border: 1px solid var(--line);
  border-radius: 8px; overflow: hidden; font-size: 11px; font-variant-numeric: tabular-nums;
}
.mtf table { border-collapse: collapse; }
.mtf th, .mtf td { padding: 3px 10px; text-align: center; }
.mtf th { background: var(--panel-3); color: var(--muted); font-weight: 600; letter-spacing: .05em; }
.mtf td.bias { font-weight: 700; }
.mtf td.BULLISH { background: rgba(34,195,166,.85); color: #04140f; }
.mtf td.BEARISH { background: rgba(242,87,107,.85); color: #1c0408; }
.mtf td.NEUTRAL, .mtf td.N\/A { background: var(--panel-2); color: var(--muted); }

/* floating drawing properties bar */
.draw-bar {
  position: absolute; top: 60px; left: 50%; transform: translateX(-50%); z-index: 8; display: flex; align-items: center; gap: 2px;
  padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 28px rgba(0,0,0,.45);
}
.draw-bar .grip { width: 10px; align-self: stretch; cursor: grab; background: radial-gradient(var(--muted) 1px, transparent 1.5px) 0 0 / 5px 5px; opacity: .5; margin-right: 4px; }
.draw-bar .sw { width: 18px; height: 18px; border-radius: 50%; border: 2px solid transparent; padding: 0; }
.draw-bar .sw.active { border-color: var(--text); }
.draw-bar select { padding: 3px 4px; font-size: 12px; }
.draw-bar input[type="text"] { width: 120px; padding: 3px 6px; }

/* replay controls */
.replay-bar {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); z-index: 8; display: flex; align-items: center; gap: 4px;
  padding: 5px 8px; background: var(--panel); border: 1px solid var(--accent); border-radius: 10px; box-shadow: 0 10px 28px rgba(0,0,0,.45);
}
.replay-bar .rp-info { font-size: 12px; color: var(--muted); padding: 0 6px; font-variant-numeric: tabular-nums; }
.replay-bar select { padding: 3px 4px; }

/* ---------- bottom bar ---------- */
.bottombar { display: flex; align-items: center; gap: 2px; padding: 0 8px; background: var(--panel); border-top: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.bottombar::-webkit-scrollbar { display: none; }
.ranges { display: flex; gap: 1px; }
.ranges button { height: 26px; padding: 0 8px; border: 0; border-radius: 5px; background: none; color: var(--muted); }
.ranges button:hover { background: var(--panel-2); color: var(--text); }
.ranges button.active { color: var(--accent); }
.tb.mini { height: 26px; padding: 0 8px; color: var(--muted); }
.tb.mini.active { color: var(--accent); }
.clock { height: 26px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- right strip ---------- */
.rightstrip { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0; background: var(--panel); border-left: 1px solid var(--line); }
.rightstrip button { position: relative; width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 8px; background: none; color: var(--muted); }
.rightstrip button:hover { color: var(--text); background: var(--panel-2); }
.rightstrip button.active { color: var(--accent); background: var(--panel-3); }
.badge { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--down); color: #fff; font-size: 10px; display: grid; place-items: center; padding: 0 4px; }

/* ---------- right panel ---------- */
.rightpanel { background: var(--panel); border-left: 1px solid var(--line); min-height: 0; overflow: hidden; }
.rp-view { height: 100%; display: flex; flex-direction: column; min-height: 0; }
.rp-head { display: flex; align-items: center; gap: 4px; padding: 8px 10px; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.rp-head h2 { margin: 0; font-size: 14px; }
.rp-body { padding: 12px; overflow-y: auto; display: grid; gap: 12px; align-content: start; flex: 1; }
.engine-tag { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; }
.list-pick { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; font-weight: 700; font-size: 14px; padding: 4px 6px; border-radius: 6px; }
.list-pick:hover { background: var(--panel-2); }

.wl-cols, .wl-row { display: grid; grid-template-columns: minmax(84px, 1fr) 76px 60px 54px; gap: 4px; align-items: center; }
.wl-cols { padding: 6px 12px 6px 30px; font-size: 11px; color: var(--muted); border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.wl-cols span:not(:first-child) { text-align: right; }
.wl { overflow-y: auto; flex: 1 1 45%; min-height: 120px; }
.wl-sec {
  display: flex; align-items: center; gap: 6px; width: 100%; padding: 8px 12px 4px; border: 0; background: none;
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); text-align: left;
}
.wl-sec .ic { transition: transform .15s; }
.wl-sec.collapsed .ic { transform: rotate(-90deg); }
.wl-sec .sx { margin-left: auto; opacity: 0; border: 0; background: none; color: var(--muted); }
.wl-sec:hover .sx { opacity: 1; }
.wl-row { position: relative; padding: 5px 12px 5px 0; cursor: pointer; font-variant-numeric: tabular-nums; font-size: 12.5px; }
.wl-row:hover { background: var(--panel-2); }
.wl-row.active { background: var(--panel-3); }
.wl-row .sym { display: flex; align-items: center; gap: 6px; min-width: 0; }
.wl-row .sym b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wl-row .flag { width: 24px; height: 20px; display: grid; place-items: center; border: 0; background: none; color: transparent; padding: 0; flex: 0 0 auto; }
.wl-row:hover .flag { color: var(--line); }
.wl-row .flag.set { color: var(--flag); }
.wl-row .num { text-align: right; white-space: nowrap; overflow: hidden; }
.wl-row .rm { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); display: none; border: 0; background: var(--panel-3); color: var(--muted); border-radius: 4px; padding: 2px; }
.wl-row:hover .rm { display: grid; }
.flash-up { animation: fu .8s; } .flash-down { animation: fd .8s; }
@keyframes fu { from { background: rgba(34,195,166,.25); } }
@keyframes fd { from { background: rgba(242,87,107,.25); } }

.details { flex: 1 1 55%; overflow-y: auto; border-top: 1px solid var(--line); padding: 12px; display: grid; gap: 12px; align-content: start; min-height: 0; }
.dt-head { display: flex; align-items: center; gap: 10px; }
.dt-head .avatar { width: 32px; height: 32px; font-size: 12px; }
.dt-name { font-weight: 700; }
.dt-sub { font-size: 12px; color: var(--muted); }
.dt-price { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.dt-price .big { font-size: 26px; font-weight: 700; }
.dt-status { font-size: 12px; display: flex; align-items: center; gap: 6px; }
.dt-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.dt-status.open::before { background: var(--up); }
.volbar { height: 4px; border-radius: 2px; background: var(--panel-3); overflow: hidden; }
.volbar i { display: block; height: 100%; background: var(--accent); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 12px; font-variant-numeric: tabular-nums; }
.kv span:nth-child(odd) { color: var(--muted); }
.facts { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 12px; line-height: 1.5; }
.facts h4, .details h4 { margin: 0 0 6px; font-size: 12px; color: var(--accent); }
.facts p { margin: 0 0 4px; }

/* panels: alerts / trade / backtest / tree */
.card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: grid; gap: 8px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.list { display: grid; gap: 6px; }
.li { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--panel-2); border-radius: 6px; padding: 7px 9px; font-size: 12.5px; }
.li.done { opacity: .55; }
.li .acts { display: flex; gap: 2px; }
.empty { color: var(--muted); font-size: 12px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.stat { background: var(--panel-2); border-radius: 6px; padding: 6px 8px; }
.stat .k { font-size: 11px; color: var(--muted); }
.stat .v { font-weight: 600; font-variant-numeric: tabular-nums; }
.equity { height: 120px; background: var(--panel-2); border-radius: 6px; position: relative; }
table.tbl { font-size: 12px; font-variant-numeric: tabular-nums; width: 100%; border-collapse: collapse; }
table.tbl th { text-align: left; color: var(--muted); font-weight: 500; padding: 3px 4px; }
table.tbl td { padding: 4px; border-top: 1px solid var(--line); }
table.tbl td:last-child, table.tbl th:last-child { text-align: right; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { border: 0; padding: 7px; background: none; color: var(--muted); font-weight: 600; }
.seg button.on-buy { background: var(--up); color: #04140f; }
.seg button.on-sell { background: var(--down); color: #1c0408; }
.note { font-size: 11px; color: var(--muted); line-height: 1.5; }
.err { color: var(--down); font-size: 12.5px; }

.toasts { position: fixed; right: 64px; bottom: 44px; display: grid; gap: 8px; z-index: 70; }
.toast { background: var(--panel); border: 1px solid var(--accent); border-radius: 10px; padding: 10px 14px; box-shadow: 0 8px 24px rgba(0,0,0,.45); max-width: 320px; }
.toast.err { border-color: var(--down); }

/* ---------- responsive ---------- */
@media (max-width: 1320px) {
  .topbar .lbl { display: none; }
  .tf-favs button { min-width: 26px; padding: 0 4px; }
}
@media (max-width: 900px) {
  :root { --panel-w: 0px; }
  body { overflow: auto; }
  .app {
    height: auto; min-height: 100vh;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: var(--top-h) 44px 62vh var(--bottom-h) 44px auto;
    grid-template-areas: "top" "left" "chart" "bottom" "strip" "panel";
  }
  .app.panel-closed { grid-template-columns: minmax(0, 1fr); }
  .lefttools { flex-direction: row; padding: 0 8px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .lt-sep { width: 1px; height: 24px; margin: 0 4px; }
  .rightstrip { flex-direction: row; justify-content: center; border-left: 0; border-top: 1px solid var(--line); padding: 4px 16px; }
  .rightpanel { border-left: 0; height: auto; max-height: none; }
  .rp-view { height: auto; }
  .wl { max-height: 50vh; }
  .topbar .lbl { display: none; }
  .legend { max-width: calc(100% - 20px); }
  .mtf { top: auto; bottom: 6px; right: 70px; font-size: 9px; opacity: .9; }
  .mtf th, .mtf td { padding: 1px 6px; }
  .lg-inds { display: none; }
  /* Phones show only the active chart of a layout. */
  .grid { grid-template: minmax(0, 1fr) / minmax(0, 1fr) !important; }
  .grid .cell:not(.active) { display: none; }
  .grid .cell:first-child { grid-row: auto !important; }
  .lg-main { font-size: 11px; }
  .toasts { right: 16px; }
}
