:root {
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius: 8px;
  --up: #26a69a; --down: #ef5350; --green: #00e676; --orange: #ffa726; --blue: #42a5f5; --red: #ef5350; --purple: #ba68c8;
  --accent: #3b82f6; --accent-2: #a855f7;
}
:root[data-theme="dark"] {
  --bg: #0b0e13; --bg-2: #0f1218; --panel: #13161d; --panel-2: #181c24; --hover: #1f2430; --border: #232733; --border-2: #2c3240;
  --text: #d6d9e0; --text-2: #aeb3bf; --muted: #7d8391; --shadow: 0 12px 40px rgba(0,0,0,.55); --input: #0f1218;
  --up: #26a69a; --down: #ef5350; color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f4f6f9; --bg-2: #ffffff; --panel: #ffffff; --panel-2: #f6f7fa; --hover: #eef1f6; --border: #e3e6ec; --border-2: #d5d9e2;
  --text: #131722; --text-2: #3b4252; --muted: #6b7280; --shadow: 0 12px 40px rgba(20,30,60,.16); --input: #ffffff;
  --up: #089981; --down: #f23645; --accent: #2962ff; color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 13px; -webkit-font-smoothing: antialiased; overflow: hidden; }
button { font-family: inherit; font-size: inherit; color: inherit; }
input, select, textarea { font-family: inherit; }
#root { height: 100%; }
.muted { color: var(--muted); }
.small { font-size: 11.5px; }
.up { color: var(--up) !important; }
.down { color: var(--down) !important; }
.grow { flex: 1; }
.hidden { display: none !important; }
.pad { padding: 10px 14px; }
.mt { margin-top: 14px; }
.right { margin-left: auto; }
.row-flex { display: inline-flex; align-items: center; gap: 6px; }
.ellipsis { max-width: 420px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ic { display: block; flex: none; }

/* ------------------------------------------------------------------ buttons & inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 7px; border: 1px solid var(--border-2); background: var(--panel-2); cursor: pointer; font-weight: 600; transition: .15s; white-space: nowrap; }
.btn:hover { background: var(--hover); }
.btn.primary { background: linear-gradient(135deg, var(--accent), #6366f1); border-color: transparent; color: #fff; box-shadow: 0 4px 14px rgba(59,130,246,.3); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: var(--down); color: #fff; border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn.lg { height: 44px; font-size: 14px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .6; cursor: default; }
.danger-text { color: var(--down) !important; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 7px; border: none; background: transparent; color: var(--text-2); cursor: pointer; transition: .12s; position: relative; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.sm { width: 28px; height: 28px; }
.icon-btn.on { background: var(--hover); color: var(--accent); }
.icon-btn.danger:hover { color: var(--down); }
.input { width: 100%; height: 36px; padding: 0 11px; border: 1px solid var(--border-2); background: var(--input); border-radius: 7px; color: var(--text); outline: none; transition: .15s; font-size: 13px; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,.18); }
.input.sm { height: 30px; width: auto; min-width: 90px; }
.input.lg { height: 44px; font-size: 14px; }
textarea.input { height: auto; padding: 10px; resize: vertical; font-family: ui-monospace, monospace; font-size: 11.5px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field-label { font-weight: 600; font-size: 12px; color: var(--text-2); }
.field-hint { font-size: 11px; color: var(--muted); }
.form-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.form-err { color: var(--down); font-size: 12px; min-height: 16px; }
.color { width: 34px; height: 26px; border: 1px solid var(--border-2); border-radius: 6px; padding: 1px; background: transparent; cursor: pointer; }
.switch { position: relative; display: inline-block; width: 36px; height: 20px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: var(--border-2); border-radius: 20px; transition: .2s; cursor: pointer; }
.slider:before { content: ''; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider:before { transform: translateX(16px); }
.pill { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 10px; font-size: 11px; font-weight: 600; background: var(--hover); color: var(--text-2); white-space: nowrap; }
.pill.ok { background: rgba(38,166,154,.16); color: var(--up); }
.pill.bad { background: rgba(239,83,80,.14); color: var(--down); }
.pill.warn { background: rgba(255,167,38,.16); color: var(--orange); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; flex: none; }
.dot.ok { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.2); }
.dot.bad { background: var(--orange); }

/* ------------------------------------------------------------------ auth */
.auth { position: relative; height: 100%; display: grid; grid-template-columns: 1.2fr 1fr; align-items: center; overflow: hidden;
  background: radial-gradient(1200px 600px at 10% 10%, rgba(59,130,246,.14), transparent 60%), radial-gradient(900px 500px at 90% 90%, rgba(168,85,247,.12), transparent 60%), var(--bg); }
.auth-bg { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .55; pointer-events: none; }
.auth-hero { position: relative; padding: 0 8vw; z-index: 1; }
.auth-hero h2 { font-size: clamp(30px, 4vw, 52px); line-height: 1.08; margin: 18px 0; letter-spacing: -.02em; }
.auth-hero p { font-size: 15px; max-width: 460px; line-height: 1.6; }
.grad { background: linear-gradient(90deg, #3b82f6, #a855f7, #ec4899); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-tag { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 20px; background: var(--panel); border: 1px solid var(--border); font-size: 12px; font-weight: 600; }
.auth-card { position: relative; z-index: 1; justify-self: center; width: min(420px, 92vw); padding: 36px; border-radius: 18px; background: color-mix(in srgb, var(--panel) 88%, transparent); border: 1px solid var(--border); box-shadow: var(--shadow); backdrop-filter: blur(14px); }
.auth-form h1 { font-size: 24px; margin: 22px 0 4px; letter-spacing: -.01em; }
.auth-form > p { margin: 0 0 22px; }
.auth-logo { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .14em; font-size: 15px; }
.auth-err { min-height: 18px; color: var(--down); font-size: 12.5px; margin: 2px 0 12px; }
.auth-foot { text-align: center; margin-top: 18px; }
.theme-float { position: absolute; top: 18px; right: 18px; z-index: 2; }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.pw-meter { height: 4px; background: var(--hover); border-radius: 3px; margin: -6px 0 12px; overflow: hidden; }
.pw-meter span { display: block; height: 100%; width: 0; background: var(--down); transition: .2s; }
.pw-meter[data-s="3"] span { background: var(--orange); } .pw-meter[data-s="4"] span, .pw-meter[data-s="5"] span { background: var(--up); }
@media (max-width: 860px) { .auth { grid-template-columns: 1fr; } .auth-hero { display: none; } }

/* ------------------------------------------------------------------ app layout */
.app { height: 100%; display: grid; grid-template-rows: 48px 1fr auto 26px; background: var(--bg); }
.topbar { display: flex; align-items: center; gap: 4px; padding: 0 8px; background: var(--panel); border-bottom: 1px solid var(--border); min-width: 0; overflow: hidden; }
.brand { display: flex; align-items: center; gap: 8px; padding: 0 10px 0 4px; cursor: pointer; flex: none; }
.brand-name { font-weight: 800; letter-spacing: .14em; font-size: 13px; background: linear-gradient(90deg, var(--text), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo { display: inline-flex; }
.vsep { width: 1px; height: 22px; background: var(--border); margin: 0 6px; flex: none; }
.sym-btn { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel-2); cursor: pointer; flex: none; }
.sym-btn:hover { background: var(--hover); }
.sym-btn b { font-size: 14px; letter-spacing: .02em; }
.sb-price { font-variant-numeric: tabular-nums; font-weight: 600; }
.sb-chg { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tfs { display: flex; gap: 2px; flex: none; }
.tf { height: 30px; min-width: 34px; padding: 0 7px; border: none; background: transparent; border-radius: 6px; cursor: pointer; font-weight: 600; color: var(--text-2); }
.tf:hover { background: var(--hover); color: var(--text); }
.tf.active { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.tf.zoom-tf { color: var(--muted); font-style: italic; }
.tf.zoom-tf.active { color: var(--accent); }
.tb-btn { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border: none; background: transparent; border-radius: 7px; cursor: pointer; color: var(--text-2); font-weight: 600; flex: none; }
.tb-btn:hover { background: var(--hover); color: var(--text); }
.tb-btn.add-trade { color: var(--accent); }
.tb-btn.add-trade:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.conn { display: flex; align-items: center; gap: 6px; padding: 0 10px; font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--muted); flex: none; }
.conn.ok .dot { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.2); animation: pulse 2s infinite; }
.conn.ok { color: #22c55e; }
.conn.bad .dot { background: var(--orange); }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(34,197,94,0); } }
.icon-btn.bell.has::after { content: attr(data-count); position: absolute; top: 2px; right: 1px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--green); color: #04110a; font-size: 10px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.avatar-btn, .avatar { width: 30px; height: 30px; border-radius: 50%; border: none; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; flex: none; margin-left: 4px; }
.main { display: flex; min-height: 0; }
.toolbar { width: 52px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; background: var(--panel); border-right: 1px solid var(--border); overflow-y: auto; overflow-x: hidden; scrollbar-width: none; }
.tool { width: 38px; height: 38px; flex: none; display: flex; align-items: center; justify-content: center; border: none; background: transparent; border-radius: 6px; color: var(--text-2); cursor: pointer; }
.tool:hover { background: var(--hover); color: var(--text); }
.tool.active { background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--accent); }
.tool.on { color: var(--accent); }
.tool.danger:hover { color: var(--down); }
.tsep { width: 30px; height: 1px; background: var(--border); margin: 4px 0; flex: none; }
.tool-fill { flex: 1; min-height: 8px; }
/* a tool group: the button shows the last used tool, the arrow on its right edge opens the group (TradingView) */
.tool-grp { position: relative; flex: none; }
.tool-arrow { position: absolute; top: 0; right: -7px; width: 9px; height: 38px; padding: 0; border: none; border-radius: 0 4px 4px 0; background: transparent; color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .12s; }
.tool-grp:hover .tool-arrow { opacity: 1; }
.tool-arrow:hover { background: var(--hover); color: var(--text); }
@media (hover: none) { .tool-arrow { opacity: .55; } }
.tool-tip { position: fixed; z-index: 130; display: flex; align-items: center; gap: 8px; padding: 6px 9px; border-radius: 6px; background: #1e222d; color: #fff; font-size: 12px; font-weight: 600; white-space: nowrap; pointer-events: none; box-shadow: 0 4px 14px rgba(0,0,0,.35); }
.tool-tip kbd { padding: 1px 5px; border-radius: 4px; background: rgba(255,255,255,.14); font: 600 11px Inter, system-ui, sans-serif; color: #d1d4dc; }
.menu.tool-fly { min-width: 250px; }
.menu.tool-fly .menu-item { padding: 6px 10px; }
.menu.tool-fly .mi-icon { color: inherit; display: flex; }
.tool-fly .menu-item .star-btn { opacity: 0; }
.tool-fly .menu-item:hover .star-btn, .tool-fly .menu-item .star-btn.on { opacity: 1; }
@media (hover: none) { .tool-fly .menu-item .star-btn { opacity: .6; } }
/* favorites toolbar: starred tools, floating over the chart and draggable by its grip */
.fav-bar { position: absolute; z-index: 6; display: flex; align-items: center; gap: 1px; padding: 3px 4px 3px 2px; border-radius: 8px; background: var(--panel); border: 1px solid var(--border-2); box-shadow: var(--shadow); }
.fav-bar .tool { width: 34px; height: 34px; }
.fav-grip { width: 14px; height: 30px; display: flex; align-items: center; justify-content: center; color: var(--muted); cursor: grab; touch-action: none; }
.fav-grip:active { cursor: grabbing; }
/* hidden drawing toolbar + the tab that brings it back */
.tools-collapsed .toolbar { width: 0; padding: 0; border-right: none; }
.tools-expand { display: none; position: absolute; left: 0; bottom: 34px; z-index: 6; width: 16px; height: 40px; padding: 0; border: 1px solid var(--border-2); border-left: none; border-radius: 0 6px 6px 0; background: var(--panel); color: var(--text-2); cursor: pointer; align-items: center; justify-content: center; }
.tools-expand:hover { color: var(--text); background: var(--hover); }
.tools-collapsed .tools-expand { display: flex; }
.charts-wrap { position: relative; flex: 1; min-width: 0; display: flex; }
.charts { flex: 1; display: grid; gap: 1px; background: var(--border); min-width: 0; }
.charts.layout-1 { grid-template: 1fr / 1fr; }
.charts.layout-2v { grid-template: 1fr / 1fr 1fr; }
.charts.layout-2h { grid-template: 1fr 1fr / 1fr; }
.charts.layout-3 { grid-template: 1fr 1fr / 1.6fr 1fr; }
.charts.layout-3 > :first-child { grid-row: 1 / 3; }
.charts.layout-4 { grid-template: 1fr 1fr / 1fr 1fr; }
.cell { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg-2); }
.cell.active::after { content: ''; position: absolute; inset: 0; border: 1px solid var(--accent); pointer-events: none; z-index: 3; }
.cell-head { display: none; align-items: center; gap: 6px; height: 30px; padding: 0 6px; border-bottom: 1px solid var(--border); background: var(--panel); flex: none; overflow: hidden; }
.cell.multi .cell-head { display: flex; }
.chip { height: 22px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--border); background: var(--panel-2); font-weight: 700; cursor: pointer; font-size: 12px; flex: none; }
.cell-tfs { display: flex; gap: 1px; overflow: hidden; }
.tf-mini { height: 22px; padding: 0 5px; border: none; background: transparent; border-radius: 5px; cursor: pointer; font-size: 11px; font-weight: 600; color: var(--muted); }
.tf-mini.active { color: var(--accent); background: color-mix(in srgb, var(--accent) 15%, transparent); }
.cell-chart { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.tzc canvas { position: absolute; left: 0; top: 0; }
.tzc-top { touch-action: none; }
.legend { position: absolute; left: 10px; top: 8px; z-index: 2; pointer-events: none; font-size: 12px; max-width: calc(100% - 100px); }
.lg-row { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.lg-title { font-size: 13px; color: var(--text-2); }
.lg-title b { color: var(--text); font-size: 14px; }
.lg-ohlc, .lg-vals { font-variant-numeric: tabular-nums; color: var(--muted); }
.lg-ohlc i, .lg-vals i { font-style: normal; margin: 0 6px 0 2px; font-weight: 600; color: var(--text-2); }
.lg-inds { margin-top: 4px; display: flex; flex-direction: column; gap: 1px; }
.lg-ind { display: flex; align-items: center; gap: 8px; pointer-events: auto; width: max-content; max-width: 100%; padding: 1px 6px 1px 0; border-radius: 5px; }
.lg-ind.off { opacity: .45; }
.lg-ind { flex-wrap: wrap; row-gap: 0; }
.lg-vals i { white-space: nowrap; }
.lg-name { color: var(--text-2); cursor: pointer; white-space: nowrap; }
.lg-btns { display: none; gap: 2px; }
.lg-ind:hover { background: color-mix(in srgb, var(--panel) 85%, transparent); }
.lg-ind:hover .lg-btns { display: inline-flex; }
.lg-btn { width: 22px; height: 20px; border: none; background: transparent; color: var(--muted); border-radius: 4px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.lg-btn:hover { background: var(--hover); color: var(--text); }
.sel-bar { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 5; display: flex; align-items: center; gap: 4px; padding: 5px 8px; border-radius: 10px; background: var(--panel); border: 1px solid var(--border-2); box-shadow: var(--shadow); }
.swatch-dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--panel); outline: 1px solid var(--border-2); cursor: pointer; }
.swatch-dot.on { outline: 2px solid var(--accent); }
.wbtn { width: 28px; height: 26px; border: none; background: transparent; border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.wbtn span { display: block; width: 16px; background: var(--text-2); border-radius: 2px; }
.wbtn.on, .wbtn:hover { background: var(--hover); }
.wbtn.style-0 span, .wbtn.style-1 span, .wbtn.style-2 span { height: 0; background: none; border-top: 2px solid var(--text-2); border-radius: 0; }
.wbtn.style-1 span { border-top-style: dashed; }
.wbtn.style-2 span { border-top-style: dotted; }
.wbtn.txt { font: 600 11px Inter, system-ui, sans-serif; color: var(--text-2); width: 26px; }
.wbtn.txt.on { color: var(--text); }
.draw-editor { position: absolute; z-index: 6; min-width: 60px; padding: 1px 4px; border: 1px solid var(--accent); border-radius: 4px; outline: none; resize: none; overflow: hidden; font-family: Inter, system-ui, sans-serif; font-weight: 600; white-space: pre; box-shadow: var(--shadow); }
.draw-editor::placeholder { color: inherit; opacity: .45; }

/* sidebar */
.sidebar { width: 340px; flex: none; display: flex; background: var(--panel); border-left: 1px solid var(--border); min-height: 0; }
.side-closed .sidebar { width: 46px; }
.side-closed .side-body { display: none; }
.side-body { flex: 1; overflow-y: auto; min-width: 0; padding-bottom: 20px; }
.side-rail { width: 46px; flex: none; border-left: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; padding-top: 6px; gap: 2px; }
.rail-btn { width: 38px; height: 38px; border-radius: 8px; border: none; background: transparent; color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.rail-btn:hover { background: var(--hover); color: var(--text); }
.rail-btn.active { color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.side-closed .rail-btn.active { background: transparent; color: var(--muted); }
.side-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 14px 8px; font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); }
.wl-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 14px; cursor: pointer; border-left: 2px solid transparent; }
.wl-row:hover { background: var(--hover); }
.wl-row.active { background: color-mix(in srgb, var(--accent) 9%, transparent); border-left-color: var(--accent); }
.wl-sym { display: flex; align-items: center; gap: 10px; }
.wl-name { font-weight: 700; }
.wl-full { font-size: 11px; }
.wl-right { text-align: right; display: flex; flex-direction: column; font-variant-numeric: tabular-nums; }
.wl-price { font-weight: 600; padding: 1px 4px; border-radius: 4px; }
.wl-chg { font-size: 11.5px; font-weight: 600; }
.wl-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-2); }
.wl-rank { margin-left: 6px; font-size: 10px; font-weight: 700; color: var(--muted); padding: 1px 5px; border-radius: 4px; background: var(--hover); vertical-align: 1px; }
.wl-group { display: flex; justify-content: space-between; padding: 12px 14px 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); border-top: 1px solid var(--border); margin-top: 4px; }
.wl-group .muted { font-weight: 500; text-transform: none; letter-spacing: 0; }
.wl-group.first { border-top: none; margin-top: 0; }
.wl-right-wrap { display: flex; align-items: center; gap: 6px; }
.star-btn { border: none; background: transparent; padding: 3px; border-radius: 5px; cursor: pointer; color: var(--muted); display: inline-flex; }
.star-btn:hover { background: var(--hover); color: var(--text); }
.star-btn.on { color: var(--orange); }
.star-btn.on svg { fill: currentColor; }
.wl-star { opacity: 0; transition: opacity .12s; }
.wl-row:hover .wl-star, .wl-star.on { opacity: 1; }
.sym-search { width: calc(100% - 4px); margin: 2px 2px 6px; }
.menu.sym-menu { max-height: min(560px, calc(100vh - 80px)); overflow-y: auto; }
.wl-dot.green { background: var(--green); box-shadow: 0 0 10px var(--green); animation: pulse-g 1.6s infinite; }
.wl-dot.orange { background: var(--orange); box-shadow: 0 0 8px var(--orange); }
@keyframes pulse-g { 50% { box-shadow: 0 0 0 5px rgba(0,230,118,0); } }
.flash-up { animation: flu .8s; } .flash-down { animation: fld .8s; }
@keyframes flu { 0% { background: rgba(38,166,154,.35); } 100% { background: transparent; } }
@keyframes fld { 0% { background: rgba(239,83,80,.35); } 100% { background: transparent; } }
.cond-row { display: flex; align-items: center; gap: 8px; padding: 6px 14px; }
.cond-row b { width: 64px; }
.tcard { margin: 6px 12px; padding: 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel-2); cursor: pointer; transition: .15s; position: relative; overflow: hidden; }
.tcard:hover { border-color: var(--border-2); transform: translateY(-1px); }
.tcard.green { border-color: rgba(0,230,118,.5); box-shadow: 0 0 0 1px rgba(0,230,118,.2), 0 8px 30px -10px rgba(0,230,118,.4); }
.tcard.orange { border-color: rgba(255,167,38,.5); }
.tcard.running { border-color: rgba(66,165,245,.45); }
.tcard.forming { border-color: rgba(186,104,200,.55); box-shadow: 0 0 0 1px rgba(186,104,200,.2), 0 8px 30px -12px rgba(186,104,200,.45); cursor: pointer; }
.tcard.forming.cancelled { border-color: var(--border); box-shadow: none; }
.tcard.cancelled .tcard-grid { opacity: .5; }
.tcard-top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.tcard-x { position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; }
.tcard-foot-row { display: flex; align-items: center; gap: 8px; }
.tcard-foot-row > span { flex: 1; min-width: 0; }
.tcard-eye { display: inline-flex; align-items: center; gap: 4px; flex: none; height: 24px; padding: 0 8px; margin: -4px -6px -4px 0; border: 1px solid var(--border); border-radius: 6px; background: transparent; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; }
.tcard-eye:hover { color: var(--text); border-color: var(--border-2); }
.tcard-eye.off { color: var(--orange); border-color: rgba(255,167,38,.45); }
.tcard.off-chart { opacity: .7; }
.tcard.forming:has(.tcard-x) .tcard-top { padding-right: 16px; }
.tcard-off { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--purple); font-weight: 600; }
.tcard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; font-variant-numeric: tabular-nums; }
.tcard-grid label, .td-grid label, .mini-stats label, .sc-grid label { display: block; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px; }
.tcard-grid span { font-weight: 600; }
.tcard-foot { margin-top: 10px; }
.status-badge { display: inline-flex; align-items: center; flex: none; white-space: nowrap; height: 20px; padding: 0 8px; border-radius: 5px; font-size: 10.5px; font-weight: 800; letter-spacing: .06em; }
.status-badge.green { background: var(--green); color: #04110a; }
.status-badge.orange { background: var(--orange); color: #1a0f00; }
.status-badge.running { background: var(--blue); color: #021226; }
.status-badge.forming { background: var(--purple); color: #1d0624; }
.status-badge.cancelled { background: rgba(158,158,158,.18); color: var(--muted); }
.status-badge.win { background: rgba(38,166,154,.18); color: var(--up); }
.status-badge.loss { background: rgba(239,83,80,.18); color: var(--down); }
.status-badge.be { background: rgba(158,158,158,.18); color: var(--muted); }
.status-badge.sm { height: 18px; font-size: 9.5px; }
.verdict { padding: 8px 10px; border-radius: 7px; font-weight: 600; font-size: 12.5px; margin-bottom: 8px; }
.verdict.ok { background: rgba(38,166,154,.14); color: var(--up); }
.verdict.bad { background: rgba(239,83,80,.12); color: var(--down); }
.side-tag { font-size: 10px; font-weight: 800; padding: 2px 6px; border-radius: 4px; letter-spacing: .04em; }
.side-tag.long { background: rgba(38,166,154,.16); color: var(--up); }
.side-tag.short { background: rgba(239,83,80,.15); color: var(--down); }
.src { font-size: 9.5px; font-weight: 800; padding: 2px 5px; border-radius: 4px; letter-spacing: .05em; }
.src.journal { background: rgba(59,130,246,.15); color: var(--accent); }
.src.engine { background: rgba(168,85,247,.15); color: var(--accent-2); }
.empty { text-align: center; padding: 26px 20px; color: var(--text-2); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty > div:first-child { color: var(--muted); }
.watch-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 8px 14px; cursor: pointer; border-bottom: 1px solid var(--border); }
.watch-row:hover { background: var(--hover); }
.check-list { display: flex; flex-direction: column; gap: 2px; padding: 0 10px; }
.check-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px; border-radius: 8px; }
.check-ico { width: 22px; height: 22px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--hover); color: var(--muted); }
.check-row.ok .check-ico { background: rgba(38,166,154,.18); color: var(--up); }
.check-row.bad .check-ico { background: rgba(239,83,80,.15); color: var(--down); }
.check-row.off { opacity: .55; }
.check-list.compact .check-row { padding: 4px 8px; }
.zone-row { margin: 4px 12px; padding: 8px 10px; border-radius: 8px; border-left: 3px solid; background: var(--panel-2); display: flex; flex-direction: column; gap: 3px; }
.zone-row.long { border-color: #00bfa5; } .zone-row.short { border-color: #ec407a; }
.rules { padding: 0 14px; line-height: 1.55; }
.rules p { margin: 0 0 8px; }
.filters { display: flex; gap: 8px; padding: 0 12px 8px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--hover); border-radius: 7px; padding: 2px; }
.seg button { border: none; background: transparent; padding: 4px 10px; border-radius: 5px; cursor: pointer; font-weight: 600; font-size: 11.5px; color: var(--muted); }
.seg button.active { background: var(--panel); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 4px 14px 10px; }
.mini-stats b { font-size: 15px; }
.hist-row { display: grid; grid-template-columns: 34px 64px 22px 1fr auto 24px; align-items: center; gap: 6px; padding: 7px 14px; cursor: pointer; border-bottom: 1px solid var(--border); }
.hist-row:hover { background: var(--hover); }
.hist-row .r { font-weight: 700; font-variant-numeric: tabular-nums; }
.hist-row .hist-eye { width: 24px; height: 24px; margin: -4px -6px -4px 0; color: var(--muted); opacity: .55; }
.hist-row:hover .hist-eye, .hist-row .hist-eye.off { opacity: 1; }
.hist-row .hist-eye.off { color: var(--orange); }
.hist-row.off-chart > :not(.hist-eye) { opacity: .5; }
.side-title-btns { display: flex; gap: 6px; }
.poi-onchart.tb-btn.sm:disabled { opacity: .4; cursor: default; }
.alert-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 0 14px 10px; }
.alert-row { margin: 6px 12px; padding: 10px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--border); }
.alert-row.setup { border-left: 3px solid var(--green); }
.alert-row.result { border-left: 3px solid var(--blue); }
.alert-row.be { border-left: 3px solid var(--green); }
.alert-row.price { border-left: 3px solid #ffb300; }
.alert-row.price.done { opacity: .6; }
.alert-row.price .icon-btn { width: 24px; height: 24px; }
.alert-head { display: flex; justify-content: space-between; gap: 6px; margin-bottom: 4px; }
.alert-text { white-space: pre-wrap; font-size: 12px; color: var(--text-2); margin-bottom: 4px; }

/* bottom panel */
.bottom { height: 300px; background: var(--panel); border-top: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.bottom-closed .bottom { display: none; }
.bp-head { display: flex; align-items: center; gap: 2px; padding: 0 8px; height: 38px; border-bottom: 1px solid var(--border); flex: none; }
.bp-tab { height: 38px; padding: 0 12px; border: none; background: transparent; cursor: pointer; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; }
.bp-tab.active { color: var(--text); border-bottom-color: var(--accent); }
.bp-body { flex: 1; overflow: auto; min-height: 0; }
.tbl-wrap { overflow: auto; }
.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tbl th { position: sticky; top: 0; background: var(--panel); text-align: left; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--border); z-index: 1; }
.tbl td { padding: 7px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover { background: var(--hover); }
.tbl.compact td { padding: 5px 10px; }
.stats-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 12px; padding: 12px; }
.stats-wrap .tbl-wrap { grid-column: 1 / -1; }
.period-bar { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; }
.period-bar .icon-btn { font-size: 18px; line-height: 1; }
.period-bar .icon-btn:disabled { opacity: .35; cursor: default; }
.month-title { margin: 4px 0 6px; }
.tbl tbody tr.active { background: var(--hover); box-shadow: inset 3px 0 0 var(--accent); }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; padding: 12px; }
.stats-wrap .stat-cards { padding: 0; }
.stat-card { padding: 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel-2); }
.stat-card.journal { border-top: 3px solid var(--accent); } .stat-card.engine { border-top: 3px solid var(--orange); }
.sc-title { font-weight: 700; margin-bottom: 10px; }
.sc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.sc-grid b { font-size: 15px; font-variant-numeric: tabular-nums; }
.stat-card .big { font-size: 26px; font-weight: 800; margin-bottom: 4px; }
.equity-box { position: relative; border-radius: 10px; border: 1px solid var(--border); background: var(--panel-2); min-height: 180px; }
.equity { width: 100%; height: 100%; position: absolute; inset: 0; }
.eq-legend { position: absolute; top: 8px; left: 12px; z-index: 1; display: flex; gap: 14px; font-size: 11px; font-weight: 600; }
.eq-j::before, .eq-e::before { content: ''; display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.eq-j::before { background: #3b82f6; } .eq-e::before { background: #ffa726; }
.calib { padding: 0 0 12px; }

/* status bar */
.statusbar { display: flex; align-items: center; gap: 14px; padding: 0 12px; background: var(--panel); border-top: 1px solid var(--border); font-size: 11px; color: var(--text-2); overflow: hidden; white-space: nowrap; }
.sb-item { display: inline-flex; align-items: center; gap: 6px; }
.sb-item .dot { width: 6px; height: 6px; }

/* modal & menu */
.modal-back { position: fixed; inset: 0; z-index: 100; background: rgba(5,8,14,.55); display: flex; align-items: center; justify-content: center; padding: 16px; opacity: 0; transition: opacity .15s; backdrop-filter: blur(3px); }
.modal-back.show { opacity: 1; }
.modal { width: 560px; max-width: 100%; max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); transform: translateY(8px); transition: transform .15s; }
.modal-back.show .modal { transform: none; }
.modal.wide { width: 980px; height: min(760px, calc(100vh - 32px)); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; }
.modal-title { font-weight: 700; font-size: 15px; }
.modal-body { padding: 4px 18px 16px; overflow: auto; flex: 1; min-height: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.menu { position: fixed; z-index: 120; min-width: 220px; padding: 5px; background: var(--panel); border: 1px solid var(--border-2); border-radius: 10px; box-shadow: var(--shadow); }
.menu.sym-menu { min-width: 340px; }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.menu-item:hover { background: var(--hover); }
.menu-item.active { color: var(--accent); }
.menu-item.danger { color: var(--down); }
.mi-label { flex: 1; }
.mi-hint { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.mi-icon { color: var(--muted); }
.mi-check { width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid var(--border-2); }
.mi-check.on { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 3px var(--panel); }
.menu-sep { height: 1px; background: var(--border); margin: 4px 0; }
.menu-header { padding: 6px 10px 4px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.form-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.form-sub { margin: 16px 0 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.form-grid { display: flex; flex-direction: column; }
.form-inline { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 12px; align-items: end; }
.swatches { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.swatch { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.ind-list { display: flex; flex-direction: column; gap: 4px; }
.ind-item { padding: 10px 12px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; }
.ind-item:hover { background: var(--hover); border-color: var(--border); }
.ind-name { font-weight: 600; }
.ind-desc { font-size: 11.5px; color: var(--muted); }
.tdetail .td-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.td-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.td-sec { margin: 16px 0 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.td-info { margin: 0; padding-left: 18px; line-height: 1.7; color: var(--text-2); }
.td-note { white-space: pre-wrap; background: var(--panel-2); border-radius: 8px; padding: 10px 12px; margin: 6px 0; line-height: 1.5; }
.td-note.refl { border-left: 3px solid var(--accent); }
.q-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.admin { display: flex; gap: 16px; height: 100%; }
.admin-nav { width: 190px; flex: none; display: flex; flex-direction: column; gap: 2px; }
.admin-tab { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border: none; background: transparent; border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--text-2); text-align: left; }
.admin-tab:hover { background: var(--hover); }
.admin-tab.active { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }
.admin-content { flex: 1; min-width: 0; overflow-y: auto; padding-right: 4px; }
.admin-content h3 { margin: 6px 0 10px; font-size: 14px; }
.admin-content h3:not(:first-child) { margin-top: 22px; }
.ulist { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.urow { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--border); flex-wrap: wrap; }
.row-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.wa-status { display: flex; flex-direction: column; gap: 12px; }
.wa-row { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--border); }
.wa-ico { color: #25d366; }
.qr-box { display: flex; gap: 18px; align-items: center; padding: 14px; border-radius: 12px; border: 1px dashed var(--border-2); flex-wrap: wrap; }
.qr-box img { width: 220px; height: 220px; border-radius: 10px; background: #fff; padding: 6px; }
.qr-box ol { line-height: 1.8; margin: 0; padding-left: 18px; flex: 1; min-width: 200px; }
.param-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 8px; }
.param { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 2px 10px; padding: 8px 10px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--border); align-items: center; }
.param .input { grid-row: 1 / 3; grid-column: 2; width: 90px; min-width: 0; }
.feeds { display: flex; flex-wrap: wrap; gap: 8px; }
.bot-venue, .bot-trade { margin: 6px 12px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel-2); display: flex; flex-direction: column; gap: 4px; }
.bot-trade { cursor: pointer; }
.bot-trade:hover { border-color: var(--border-2); }
.bot-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bot-switches { margin: 6px 12px; display: flex; flex-direction: column; gap: 6px; }
.bot-switch { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel-2); }
.bot-switch .row-flex { gap: 8px; }
.bot-switch.on { border-color: rgba(38,166,154,.45); }
.bot-head .big-r { font-size: 16px; font-variant-numeric: tabular-nums; }
.bot-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 4px 0; }
.bot-nums label { display: block; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.bot-nums b { display: block; font-size: 15px; font-variant-numeric: tabular-nums; }
.bot-nums span { display: block; font-size: 11px; color: var(--muted); }
.bot-note { margin: 6px 12px; padding: 8px 10px; border-radius: 8px; font-size: 12px; cursor: pointer; border: 1px solid var(--border); }
.bot-note.warn { border-color: color-mix(in srgb, var(--orange) 50%, transparent); color: var(--orange); }
.bot-note.bad { border-color: color-mix(in srgb, var(--down) 50%, transparent); color: var(--down); }
.notice { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel-2); margin: 6px 0; }
.notice.warn { border-color: color-mix(in srgb, var(--orange) 50%, transparent); background: color-mix(in srgb, var(--orange) 8%, var(--panel-2)); }
.notice.bad { border-color: color-mix(in srgb, var(--down) 50%, transparent); background: color-mix(in srgb, var(--down) 8%, var(--panel-2)); }
.notice .grow { min-width: 220px; display: flex; flex-direction: column; gap: 3px; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 16px; margin-top: 12px; }
.kv span { display: block; font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.kv b { font-variant-numeric: tabular-nums; }
.feed { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--border); }

/* toasts */
#toasts { position: fixed; right: 16px; bottom: 40px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast { padding: 12px 14px; border-radius: 10px; background: var(--panel); border: 1px solid var(--border-2); box-shadow: var(--shadow); transform: translateX(20px); opacity: 0; transition: .25s; cursor: pointer; border-left: 4px solid var(--accent); }
.toast.show { transform: none; opacity: 1; }
.toast-ok { border-left-color: var(--up); } .toast-error { border-left-color: var(--down); }
.toast-green { border-left-color: var(--green); box-shadow: 0 0 0 1px rgba(0,230,118,.3), var(--shadow); }
.toast-orange { border-left-color: var(--orange); }
.toast-forming { border-left-color: var(--purple); }
.toast-running { border-left-color: var(--blue); }
.toast-title { font-weight: 700; margin-bottom: 2px; }
.toast-text { font-size: 12px; color: var(--text-2); }

/* scrollbars */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* responsive */
.mobile-only { display: none; }
.phone-only, .rail-txt { display: none; }
.tf-pick { display: none; align-items: center; gap: 2px; height: 32px; padding: 0 6px 0 9px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-2); color: var(--accent); font-weight: 700; cursor: pointer; flex: none; }
@media (max-width: 1180px) { .tb-label { display: none; } .brand-name { display: none; } }
@media (max-width: 900px) {
  .app { grid-template-rows: 48px 1fr auto 0; }
  .statusbar { display: none; }
  .mobile-only { display: inline-flex; }
  .hide-sm, .conn-txt, .sb-chg { display: none; }
  .topbar { overflow-x: auto; scrollbar-width: none; }
  .toolbar { position: absolute; left: 0; top: 48px; bottom: 0; z-index: 20; transform: translateX(-100%); transition: transform .2s; }
  .tools-open .toolbar { transform: none; box-shadow: var(--shadow); }
  .tools-collapsed .toolbar { width: 52px; padding: 6px 0; }
  .toolbar .collapse-btn, .tools-collapsed .tools-expand { display: none; }
  .main { position: relative; }
  .sidebar { position: absolute; right: 0; top: 0; bottom: 0; z-index: 15; width: min(360px, 100vw); box-shadow: var(--shadow); }
  .side-closed .sidebar { width: 46px; box-shadow: none; }
  .charts-wrap { margin-right: 46px; }
  .charts.layout-2v, .charts.layout-3, .charts.layout-4 { grid-template: repeat(2, 1fr) / 1fr; }
  .charts.layout-3 > :first-child { grid-row: auto; }
  .charts.layout-4 > :nth-child(n+3), .charts.layout-3 > :nth-child(n+3) { display: none; }
  .bottom { height: 45vh; }
  .stats-wrap { grid-template-columns: 1fr; }
  .sc-grid { grid-template-columns: repeat(2, 1fr); }
  .admin { flex-direction: column; }
  .admin-nav { width: auto; flex-direction: row; overflow-x: auto; }
  .td-grid { grid-template-columns: repeat(2, 1fr); }
  .tfs .tf { min-width: 30px; padding: 0 5px; }
  .legend { max-width: calc(100% - 76px); font-size: 11px; }
  .lg-title .muted { display: none; }
  .lg-ind { gap: 0 6px; }
  .lg-ohlc i, .lg-vals i { margin: 0 4px 0 1px; }
}

/* ------------------------------------------------------------------ bot sidebar: wider, account, PnL curve */
.app.side-wide:not(.side-closed) .sidebar { width: 480px; }
.bot-nums.four { grid-template-columns: repeat(4, 1fr); }
.bot-nums.four b { font-size: 14px; }
.bot-kv { display: flex; flex-wrap: wrap; gap: 2px 14px; color: var(--text-2); }
.bot-kv label { color: var(--muted); }
.acct { gap: 8px; }
.acct-total label, .acct-list > label { display: block; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.acct-big { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.acct-fees { display: flex; flex-wrap: wrap; gap: 4px 14px; padding-top: 6px; border-top: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.acct-list { display: flex; flex-direction: column; gap: 4px; padding-top: 6px; border-top: 1px solid var(--border); }
.acct-pos { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; font-size: 12px; font-variant-numeric: tabular-nums; }
.pnl-headline { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.pnl-headline b { font-size: 18px; }
.pnl-plot { position: relative; margin-top: 4px; }
.pnl-svg { display: block; width: 100%; height: auto; touch-action: pan-y; }
.pnl-grid { stroke: var(--border); stroke-width: 1; }
.pnl-zero { stroke: var(--border-2); stroke-width: 1; }
.pnl-cross { stroke: var(--muted); stroke-width: 1; }
.pnl-axis { fill: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.pnl-tip { position: absolute; top: 2px; pointer-events: none; padding: 6px 9px; border-radius: 7px; background: var(--panel); border: 1px solid var(--border-2); box-shadow: var(--shadow); font-size: 11.5px; white-space: nowrap; display: flex; flex-direction: column; gap: 1px; z-index: 5; }
.pnl-empty { padding: 26px 0; text-align: center; }
@media (max-width: 860px) { .app.side-wide:not(.side-closed) .sidebar { width: min(480px, 100vw); } }
@media (hover: none) { .wl-star { opacity: 1; } }

/* today's POIs */
.poi-onchart.tb-btn.sm { text-transform: none; letter-spacing: 0; height: 24px; padding: 0 8px; gap: 4px; font-size: 11px; font-weight: 600; border-radius: 6px; color: var(--muted); }
.poi-onchart.tb-btn.sm.on { color: var(--text); background: var(--hover); }
.poi-tbl td { white-space: normal; vertical-align: top; }
.poi-tbl td.r, .poi-tbl th.r { text-align: right; white-space: nowrap; }
.poi-tbl tr.poi-sym td { background: var(--panel-2); padding-top: 8px; padding-bottom: 8px; }
.poi-tbl tr.poi-sym td > * { margin-right: 8px; }
.poi-tbl tr.poi-none, .poi-tbl tr.poi-price { cursor: default; }
.poi-tbl tr.poi-price:hover, .poi-tbl tr.poi-none:hover { background: none; }
.poi-tbl tr.poi-price td { padding: 0 10px; height: 18px; border-bottom: none; }
.poi-tbl tr.poi-price span { display: block; border-top: 1px dashed var(--muted); font-size: 10px; color: var(--muted); text-align: right; line-height: 14px; }
.poi-tbl tr.poi-row td:first-child { border-left: 3px solid transparent; }
.poi-tbl tr.poi-row.long td:first-child { border-left-color: var(--up); }
.poi-tbl tr.poi-row.short td:first-child { border-left-color: var(--down); }
.poi-tbl tr.poi-row.user td:first-child { border-left-color: #ffc107; }
.poi-tbl tr.poi-row.focus { background: var(--hover); }
.poi-zone { display: flex; align-items: center; gap: 6px; }
.poi-items { margin-top: 2px; line-height: 1.35; }
.poi-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.pill.sm { height: 17px; padding: 0 6px; font-size: 10px; }
.pill.user { background: rgba(255,193,7,.16); color: #b28704; }
:root[data-theme="dark"] .pill.user { color: #ffd54f; }

/* ------------------------------------------------------------------ phones */
@media (max-width: 640px) {
  .app { grid-template-rows: calc(48px + env(safe-area-inset-top)) 1fr auto 0; }
  .topbar { overflow: visible; gap: 2px; padding: env(safe-area-inset-top) 6px 0; }
  .brand, .tfs, .topbar > .vsep, .topbar > .tb-btn, .topbar > .icon-btn:not(.mobile-only):not(.phone-only):not(.bell), .avatar-btn { display: none !important; }
  .phone-only { display: inline-flex; }
  .tf-pick.phone-only { display: inline-flex; }
  .sym-btn { padding: 0 9px; gap: 6px; min-width: 0; flex: 0 1 auto; overflow: hidden; }
  .sym-btn b { font-size: 13.5px; }
  .sym-btn .sb-price { font-size: 12.5px; }
  .icon-btn { width: 38px; height: 38px; }
  /* the sidebar rail becomes a tab bar at the bottom; an open panel fills the screen above it */
  .main { padding-bottom: calc(54px + env(safe-area-inset-bottom)); }
  .charts-wrap { margin-right: 0; }
  .sidebar, .side-closed .sidebar, .app.side-wide:not(.side-closed) .sidebar { position: absolute; inset: 0 0 calc(54px + env(safe-area-inset-bottom)) 0; width: 100%; border-left: none; box-shadow: none; z-index: 15; }
  .side-closed .sidebar { width: 0; overflow: visible; }
  .side-rail { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; width: auto; height: calc(54px + env(safe-area-inset-bottom)); padding: 0 2px env(safe-area-inset-bottom); flex-direction: row; justify-content: space-around; align-items: stretch; gap: 0; border-left: none; border-top: 1px solid var(--border); background: var(--panel); }
  .rail-btn { flex: 1; width: auto; height: auto; min-width: 0; border-radius: 0; flex-direction: column; gap: 2px; padding-top: 4px; }
  .rail-btn.active, .rail-btn:hover { background: transparent; }
  .rail-txt { display: block; font-size: 9px; font-weight: 600; letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .side-closed .rail-btn.active { color: var(--muted); }
  .side-closed .rail-chart, .rail-chart:hover { color: var(--accent); }
  .toolbar { top: 0; bottom: calc(54px + env(safe-area-inset-bottom)); }
  /* the logboek & performance panel opens full screen over the chart */
  .bottom { position: fixed; inset: calc(48px + env(safe-area-inset-top)) 0 calc(54px + env(safe-area-inset-bottom)) 0; height: auto; z-index: 30; border-top: none; }
  .bp-head { overflow-x: auto; scrollbar-width: none; }
  .bp-tab { white-space: nowrap; flex: none; }
  .bp-head > .icon-btn:last-child { position: sticky; right: -8px; flex: none; background: var(--panel); box-shadow: -8px 0 8px var(--panel); border-radius: 0; }
  .bp-head .btn { flex: none; white-space: nowrap; }
  /* menus and dialogs: never taller than the screen, inputs 16px so iOS does not zoom in */
  .menu { max-height: calc(100vh - 70px); overflow-y: auto; max-width: calc(100vw - 16px); }
  .menu.sym-menu { min-width: 0; width: calc(100vw - 16px); }
  .menu-item { padding: 10px 10px; }
  .modal-back { padding: 8px; align-items: flex-end; }
  .modal { max-height: calc(100vh - 16px); border-radius: 14px; }
  .modal.wide { height: calc(100vh - 16px); }
  input, select, textarea { font-size: 16px !important; }
  .sel-bar { left: 8px !important; right: 8px; transform: none !important; max-width: none; overflow-x: auto; scrollbar-width: none; justify-content: flex-start; }
  .sel-bar > * { flex: none; }
  #toasts { right: 8px; left: 8px; bottom: calc(62px + env(safe-area-inset-bottom)); max-width: none; }
  .conn { padding: 0 6px; }
}

/* object tree */
.tree-bar { display: flex; align-items: center; gap: 6px; margin: 0 12px 8px; padding: 6px 8px; min-height: 36px; border-radius: 8px; background: var(--panel-2); font-size: 12px; font-weight: 600; }
.tree-bar.on { background: color-mix(in srgb, var(--accent) 12%, var(--panel-2)); }
.tree-bar .btn { height: 26px; }
.tree { display: flex; flex-direction: column; padding: 0 6px 10px; }
.tree-row { display: flex; align-items: center; gap: 6px; padding: 5px 4px 5px 6px; border-radius: 7px; cursor: pointer; min-height: 40px; }
.tree-row:hover { background: var(--hover); }
.tree-row.sel { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.tree-row.in { margin-left: 22px; }
.tree-row.group { font-weight: 600; margin-top: 4px; }
.tree-row.drop, .tree-sep.drop { outline: 2px dashed var(--accent); outline-offset: -2px; }
.tree-row.dim .tree-ic, .tree-row.dim .tree-txt { opacity: .45; }
.tree-check { width: 15px; height: 15px; margin: 0; flex: none; accent-color: var(--accent); cursor: pointer; }
.tree-caret { display: flex; width: 15px; flex: none; color: var(--muted); transition: transform .12s; }
.tree-caret.open { transform: rotate(90deg); }
.tree-ic { display: flex; flex: none; color: var(--text-2); }
.tree-row.group .tree-ic { color: #ffb74d; }
.tree-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.tree-txt > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-name { font-size: 12.5px; }
.tree-act { flex: none; color: var(--muted); opacity: 0; }
.tree-act.off { opacity: 1; color: var(--orange); }
.tree-row:hover .tree-act, .tree-row.sel .tree-act { opacity: 1; }
@media (hover: none) { .tree-act { opacity: .8; } }
.tree-input { flex: 1; min-width: 0; height: 24px; padding: 0 6px; border: 1px solid var(--accent); border-radius: 5px; background: var(--panel); color: var(--text); font-size: 12.5px; }
.tree-empty { margin-left: 44px; padding: 4px 0 8px; }
.tree-sep { padding: 12px 8px 4px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; font-size: 10.5px; border-radius: 6px; }
.ind-group { padding: 10px 4px 4px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.ind-tpl { display: flex; flex-direction: column; gap: 4px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.ind-tpl-item { display: flex; align-items: center; gap: 8px; padding: 7px 12px; }
.ind-tpl-item .grow { flex: 1; min-width: 0; }
.ind-tpl-save { display: flex; gap: 8px; padding: 4px 0; }
.ind-tpl-save .input { flex: 1; min-width: 0; width: auto; }

/* indicator pane buttons (top right of each pane, left of the price axis) */
.pane-bars { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.pane-bar { position: absolute; right: 80px; display: flex; align-items: center; gap: 1px; padding: 1px 2px 1px 8px; border-radius: 6px; pointer-events: auto; background: color-mix(in srgb, var(--panel) 80%, transparent); opacity: .55; transition: opacity .12s; }
.pane-bar:hover { opacity: 1; }
.pane-bar.off .pb-name { text-decoration: line-through; }
.pb-name { font-size: 11px; font-weight: 600; color: var(--text-2); margin-right: 4px; white-space: nowrap; }
.pb-btn { width: 22px; height: 20px; border: none; background: transparent; color: var(--muted); border-radius: 4px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.pb-btn:hover { background: var(--hover); color: var(--text); }
.pb-btn.danger:hover { color: var(--down); }
.pb-btn.up svg { transform: rotate(180deg); }
@media (hover: none) { .pane-bar { opacity: .9; } .pb-btn { width: 28px; height: 26px; } .lg-btns { display: inline-flex; } }
@media (max-width: 640px) { .pb-name { display: none; } .pane-bar { right: 78px; } }

/* position size calculator (long / short drawings) */
.pos-calc-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.pos-calc-out { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 6px; }
.pos-calc-cell { display: flex; flex-direction: column; gap: 3px; padding: 9px 10px; border: 1px solid var(--border); border-radius: 7px; background: var(--input); min-width: 0; }
.pos-calc-cell span { font-size: 11px; color: var(--muted); }
.pos-calc-cell b { font-size: 14px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
@media (max-width: 640px) { .pos-calc-grid, .pos-calc-out { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* monthly R bars (performance tab) */
.month-bars { grid-column: 1 / -1; position: relative; border-radius: 10px; border: 1px solid var(--border); background: var(--panel-2); padding: 4px 4px 0; }
.mb-legend { fill: var(--text); font-size: 11px; font-weight: 600; }
.mb-sel { fill: var(--accent); fill-opacity: .1; }
.mb-hover { fill: var(--text); fill-opacity: .05; }
.mb-tip-row { display: flex; align-items: center; gap: 5px; }
.mb-key { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

/* bottom panel: drag the top edge to resize */
@media (min-width: 641px) { .bottom { position: relative; } }
.bp-resize { position: absolute; top: -4px; left: 0; right: 0; height: 8px; cursor: ns-resize; z-index: 4; touch-action: none; }
.bp-resize::after { content: ''; position: absolute; left: 50%; top: 2px; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: var(--border-2); opacity: 0; transition: opacity .15s; }
.bp-resize:hover::after, .resizing-v .bp-resize::after { opacity: 1; }
.resizing-v, .resizing-v * { cursor: ns-resize !important; user-select: none; }
@media (max-width: 640px) { .bp-resize { display: none; } .bottom { height: auto !important; } }
/* engine grade filter (Trades list, Performance, Engine history) */
.grade-seg button.active.g-green { color: var(--green); }
.grade-seg button.active.g-orange { color: var(--orange); }
.period-bar .grade-lbl { margin-left: 12px; }
.grade-bar { padding: 8px 12px 4px; }
