/* BetaSystem — light theme modelled on the MetaTrader 5 terminal: white work area, grey chrome, compact tables. */
:root {
  --bg: #ffffff; --chrome: #f0f0f0; --chrome2: #e6e6e6; --panel: #ffffff; --panel2: #f5f6f8; --line: #c9ccd1; --line2: #e3e5e8;
  --text: #1b1f24; --muted: #5f6b78; --accent: #1565c0; --accent-bg: #dbe9fb;
  --pos: #1a7f37; --neg: #c62828; --warn: #a36100; --sel: #cce4ff;
  font-family: "Segoe UI", "Assistant", "Rubik", system-ui, -apple-system, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-size: 13px; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
td.ltr { display: table-cell; text-align: right; }
.muted { color: var(--muted); } .small { font-size: 12px; } .hidden { display: none !important; }
.pos { color: var(--pos); } .neg { color: var(--neg); }
.boot, .empty { padding: 60px; text-align: center; color: var(--muted); }
.error { color: #8a1c1c; background: #fdecec; border: 1px solid #f2b8b5; padding: 8px 12px; border-radius: 4px; margin: 8px 0; }
.warn { color: var(--warn); }
.card.warn { border-color: #f0c36d; background: #fff8e6; }
h2 { margin: 14px 0 10px; font-size: 18px; font-weight: 600; } h3 { margin: 0 0 8px; font-size: 14px; font-weight: 600; }
h4 { margin: 12px 0 6px; font-size: 12px; color: var(--muted); text-transform: none; }

/* ---------- top bar (MT5 menu + toolbar look) */
.top { display: flex; align-items: center; gap: 14px; padding: 0 12px; height: 38px; background: var(--chrome); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: baseline; gap: 6px; } .brand b { font-size: 15px; } .brand span { color: var(--accent); font-weight: 600; }
.brand i { font-style: normal; font-size: 10px; background: #fff; border: 1px solid var(--line); padding: 0 6px; border-radius: 3px; color: var(--muted); }
.brand.big b { font-size: 24px; } .brand.big span { font-size: 20px; }
nav { display: flex; gap: 0; flex: 1; height: 100%; }
nav a { color: var(--text); padding: 0 12px; display: flex; align-items: center; border-inline-end: 1px solid transparent; }
nav a:hover { background: var(--chrome2); text-decoration: none; }
nav a.on { background: #fff; border-inline: 1px solid var(--line); border-bottom: 1px solid #fff; margin-bottom: -1px; font-weight: 600; }
.who { display: flex; gap: 10px; align-items: center; color: var(--muted); }
main { padding: 0 14px 30px; max-width: 1900px; margin: 0 auto; }
main.full { max-width: none; padding: 0; }

/* ---------- controls */
.btn { background: linear-gradient(#fdfdfd, #ececec); color: var(--text); border: 1px solid var(--line); padding: 4px 10px; border-radius: 3px; cursor: pointer; font: inherit; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.btn:hover { border-color: #8fa4bd; background: linear-gradient(#fff, #e2ebf6); text-decoration: none; }
.btn.primary { background: linear-gradient(#2f80d6, #1565c0); border-color: #0f4f99; color: #fff; } .btn.primary:hover { background: #1565c0; }
.btn.ghost { background: transparent; border-color: transparent; } .btn:disabled { opacity: .45; cursor: default; }
.btn.on { background: var(--accent-bg); border-color: #7aa7dc; }
.btn.mini, button.mini { padding: 1px 7px; font-size: 12px; border-radius: 3px; background: linear-gradient(#fdfdfd, #ececec); color: var(--text); border: 1px solid var(--line); cursor: pointer; }
input, select, textarea { background: #fff; color: var(--text); border: 1px solid var(--line); border-radius: 3px; padding: 4px 6px; font: inherit; }
input:focus, select:focus, textarea:focus { outline: 1px solid #7aa7dc; border-color: #7aa7dc; }
textarea { width: 100%; resize: vertical; } input[type=checkbox] { accent-color: var(--accent); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; } .row.spread { justify-content: space-between; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 12px 14px; margin-bottom: 12px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 12px; }
.cols.three { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.split { display: grid; grid-template-columns: 260px 1fr; gap: 12px; }
.fields { display: flex; flex-wrap: wrap; gap: 10px; } .fields label { display: flex; flex-direction: column; gap: 3px; min-width: 170px; color: var(--muted); font-size: 12px; }
.tag { font-size: 11px; background: var(--panel2); border: 1px solid var(--line2); padding: 0 6px; border-radius: 3px; margin-inline-start: 6px; color: var(--muted); }
.tag.ok { background: #e6f4ea; color: var(--pos); border-color: #b7dfc2; }

.login { min-height: 100vh; display: grid; place-items: center; background: var(--chrome); }
.login .card { width: min(360px, calc(100% - 24px)); display: flex; flex-direction: column; gap: 12px; padding: 26px; box-shadow: 0 4px 18px #0000001a; }
.google-login { direction: ltr; display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 36px; padding: 0 12px;
  background: #fff; color: #1f1f1f; border: 1px solid #747775; border-radius: 4px; font-weight: 500; }
.google-login:hover { background: #f8faff; text-decoration: none; }
.google-login img { object-fit: contain; }

/* ---------- tab strips (MT5 style: flat, bottom-aligned) */
.tabs { display: flex; gap: 0; margin: 10px 0 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tab { display: flex; align-items: center; gap: 6px; padding: 5px 12px; background: var(--chrome); border: 1px solid var(--line); border-bottom: none; margin-inline-end: -1px; cursor: pointer; color: var(--muted); }
.tab.on { color: var(--text); background: #fff; margin-bottom: -1px; border-bottom: 1px solid #fff; font-weight: 600; } .tab.add { color: var(--accent); font: inherit; }
.tab .x, .modal .x { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 15px; padding: 0 2px; }
.tab-body { padding-top: 8px; }
.run-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }

/* ---------- player */
.player { background: #fff; border: 1px solid var(--line); border-radius: 3px; padding: 6px; }
.player-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; padding: 4px; background: var(--chrome); border: 1px solid var(--line2); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 3px; overflow: hidden; background: #fff; }
.seg-btn { background: linear-gradient(#fdfdfd, #ececec); color: var(--text); border: none; border-inline-start: 1px solid var(--line); padding: 3px 9px; cursor: pointer; font: inherit; }
.seg-btn:first-child { border-inline-start: none; } .seg-btn.on, .seg-btn:hover { background: var(--accent-bg); }
.seg select { border: none; border-radius: 0; }
.chk { color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.counters { display: grid; grid-template-columns: repeat(6, minmax(110px, 1fr)); gap: 4px; margin-bottom: 6px; }
.ctr { background: var(--panel2); border: 1px solid var(--line2); border-radius: 3px; padding: 4px 8px; display: flex; flex-direction: column; }
.ctr .lbl { font-size: 11px; color: var(--muted); } .ctr b { font-size: 14px; direction: ltr; text-align: right; }
.chart-wrap { position: relative; height: 58vh; min-height: 340px; } .chart { display: block; cursor: pointer; }
.chart-tip { position: absolute; display: none; background: #ffffe1; color: #000; border: 1px solid #767676; padding: 4px 7px; font-size: 12px; pointer-events: none; max-width: 280px; direction: rtl; box-shadow: 1px 1px 3px #0003; }
.scrub { width: 100%; margin: 6px 0 2px; direction: ltr; }
.scrub-label { direction: ltr; text-align: center; margin-bottom: 4px; color: var(--muted); font-size: 12px; }
.trade-detail:empty { display: none; }
.trade-detail { margin-top: 6px; background: var(--panel2); border: 1px solid var(--line2); border-radius: 3px; padding: 8px 10px; }
.td-head { display: flex; gap: 10px; align-items: baseline; margin-bottom: 6px; }
.td-rows { display: grid; grid-template-columns: max-content 1fr; gap: 3px 14px; } .td-rows .k { color: var(--muted); }
.td-btns { margin-top: 8px; display: flex; gap: 6px; }

/* ---------- tables (MT5 grid look) */
.journal { margin-top: 10px; } .journal-head { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; } .journal-head h3 { margin: 0; }
.table-wrap { max-height: 46vh; overflow: auto; border: 1px solid var(--line); background: #fff; } .table-wrap.tall { max-height: 75vh; }
.grid-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.grid-table th { position: sticky; top: 0; background: linear-gradient(#fafafa, #ececec); color: var(--text); font-weight: 400; text-align: right; padding: 4px 8px; border-bottom: 1px solid var(--line); border-inline-start: 1px solid var(--line2); z-index: 1; white-space: nowrap; }
.grid-table td { padding: 3px 8px; border-bottom: 1px solid #eef0f2; vertical-align: top; }
.grid-table tbody tr:nth-child(even) { background: #fafbfc; }
.grid-table tbody tr:hover { background: #eef5ff; } .grid-table tr.sel, .grid-table tr.sel:hover { background: var(--sel) !important; }
.grid-table tr.open-end td { background: #fff8e1; }
.grid-table td.actions { white-space: nowrap; } .grid-table td.actions button { margin-inline-start: 3px; }
.grid-table tr.group > td { background: var(--chrome); font-weight: 600; cursor: pointer; border-bottom: 1px solid var(--line); }
.grid-table tr.group > td:first-child::before { content: "▸"; display: inline-block; width: 14px; color: var(--muted); }
.grid-table tr.group.open > td:first-child::before { content: "▾"; }
.grid-table tr.child > td:first-child { padding-inline-start: 22px; }
.grid-table tr.detail > td { background: #fbfcfe; padding: 10px 14px; }

.opt { display: flex; align-items: baseline; gap: 6px; padding: 4px 0; } .opt.disabled { opacity: .5; }
.group-title { margin-top: 10px; font-weight: 600; color: var(--text); }
.run-status { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.run-line { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; } progress { width: 160px; accent-color: var(--accent); }

.side-list { display: flex; flex-direction: column; gap: 0; border: 1px solid var(--line); }
.side-list a { padding: 7px 10px; background: #fff; border-bottom: 1px solid var(--line2); color: var(--text); }
.side-list a.on { background: var(--sel); }
.versions { display: flex; flex-direction: column; gap: 2px; } .ver { padding: 4px 8px; color: var(--text); } .ver.on, .ver:hover { background: var(--panel2); }
.draft { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.chip { padding: 5px 9px; border-radius: 3px; border: 1px solid var(--line); background: #fff; }
.chip.ok { border-color: #8fcf9f; background: #effaf2; } .chip.ask { border-color: #e6c46a; background: #fff8e1; } .chip.warn { border-color: #e6b8a0; color: #8a4b1c; }
.chip button { margin-inline-start: 4px; }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-bottom: 12px; }
.metric { background: #fff; border: 1px solid var(--line); border-radius: 3px; padding: 8px 10px; display: flex; flex-direction: column; gap: 3px; }
.metric span { color: var(--muted); font-size: 12px; } .metric b { font-size: 17px; text-align: right; font-weight: 600; }
.curve { width: 100%; height: 260px; display: block; }
.legend { display: flex; gap: 8px; align-items: center; color: var(--muted); margin-bottom: 6px; } .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; } .dot.a { background: #1565c0; } .dot.b { background: #e08a00; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 16px; margin: 6px 0 10px; }
.kv-i { display: flex; flex-direction: column; } .kv-i span { color: var(--muted); font-size: 12px; } .kv-i b { text-align: right; font-weight: 500; }
details summary { cursor: pointer; color: var(--accent); margin: 6px 0; }

.modal-back { position: fixed; inset: 0; background: #0005; display: grid; place-items: center; z-index: 50; }
.modal { background: #fff; border: 1px solid #8a8f96; border-radius: 3px; padding: 0; width: min(760px, 94vw); max-height: 84vh; overflow: auto; box-shadow: 0 8px 30px #0004; }
.modal > * { margin-inline: 14px; } .modal > *:last-child { margin-bottom: 14px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin: 0 0 10px !important; padding: 6px 10px; background: var(--chrome); border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-weight: 600; }
.pick-list { display: flex; flex-direction: column; gap: 0; margin-bottom: 10px; border: 1px solid var(--line); }
.pick { text-align: right; background: #fff; border: none; border-bottom: 1px solid var(--line2); color: var(--text); padding: 6px 10px; cursor: pointer; font: inherit; }
.pick:hover { background: #eef5ff; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translate(-50%, 20px); background: #1565c0; color: #fff; padding: 8px 14px; border-radius: 3px; opacity: 0; transition: all .3s; z-index: 60; }
.toast.show { opacity: 1; transform: translate(-50%, 0); } .toast.err { background: #b3261e; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } .counters { grid-template-columns: repeat(3, 1fr); } nav a { padding: 0 6px; } }

label.need input { outline: 2px solid #f0b429; }
.card.info { border-inline-start: 4px solid #1565c0; }
.card.doc summary { cursor: pointer; font-size: 1.05em; }
.card.doc p { line-height: 1.6; margin: 6px 0; }
.doc-table td { white-space: normal; vertical-align: top; line-height: 1.5; }

/* ---------- strategy step panel on the chart */
.step-panel { position: absolute; top: 6px; left: 6px; width: 265px; background: #ffffffe6; border: 1px solid var(--line); border-radius: 3px;
  padding: 6px 8px; font-size: 12px; line-height: 1.45; direction: rtl; pointer-events: none; z-index: 3; color: var(--text); box-shadow: 1px 1px 4px #0002; }
.dark-chart .step-panel { background: #0b1016e0; border-color: #2a3644; color: #dbe5ef; }
.step-panel .st-h { font-weight: 700; margin-bottom: 3px; }
.step-panel .st { color: var(--muted); } .step-panel .st.ok { color: var(--pos); } .dark-chart .step-panel .st.ok { color: #7fe0a8; }
.step-panel .st b { display: inline-block; min-width: 34px; }
.step-panel .st span { display: block; margin-right: 34px; color: var(--muted); font-size: 11px; direction: ltr; text-align: right; }
.step-panel .leg { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 6px; padding-top: 5px; border-top: 1px solid var(--line2); color: var(--muted); font-size: 11px; }
.step-panel .leg i { display: inline-block; width: 10px; height: 10px; margin-left: 4px; vertical-align: middle; }

/* ---------- indicators menu */
.ind-menu { position: absolute; z-index: 30; background: #fff; border: 1px solid #8a8f96; box-shadow: 2px 2px 8px #0003; padding: 6px; min-width: 260px; direction: rtl; }
.ind-menu .ind-row { display: flex; gap: 6px; align-items: center; padding: 3px 2px; }
.ind-menu .ind-row input[type=number] { width: 56px; }
.ind-menu h4 { margin: 4px 0; }

/* ---------- terminal (MT5 layout) */
.term { direction: ltr; display: grid; grid-template-columns: 300px 1fr; grid-template-rows: auto 1fr auto 250px; height: calc(100vh - 38px); background: var(--chrome); }
.term .tb { grid-column: 1 / 3; display: flex; align-items: center; gap: 4px; padding: 3px 6px; border-bottom: 1px solid var(--line); flex-wrap: wrap; direction: ltr; }
.term .tb .sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.term .tb .clock { margin-left: auto; font-variant-numeric: tabular-nums; padding: 0 8px; }
.term .tb .tfb { padding: 2px 7px; border: 1px solid transparent; background: none; cursor: pointer; font: inherit; color: var(--accent); }
.term .tb .tfb.on, .term .tb .tfb:hover { border-color: #7aa7dc; background: var(--accent-bg); }
.mw { grid-row: 2 / 4; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.mw-title, .tbx-title { display: flex; justify-content: space-between; align-items: center; padding: 2px 6px; background: var(--chrome); border-bottom: 1px solid var(--line); font-size: 12px; }
.mw table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.mw th { text-align: left; font-weight: 400; background: linear-gradient(#fafafa, #ececec); border-bottom: 1px solid var(--line); padding: 3px 6px; }
.mw td { padding: 3px 6px; border-bottom: 1px solid #f0f0f0; text-align: right; font-variant-numeric: tabular-nums; }
.mw td:first-child { text-align: left; } .mw tr.up td { background: #fff3c4; } .mw tr.down td { background: #ffe0c2; }
.mw tr.sel td { background: var(--sel) !important; } .mw .arrow.u { color: var(--accent); } .mw .arrow.d { color: var(--neg); }
.mw-foot { margin-top: auto; display: flex; border-top: 1px solid var(--line); }
.mw-foot span { padding: 3px 10px; border-right: 1px solid var(--line); font-size: 12px; background: #fff; }
.grid-area { position: relative; background: #ababab; display: grid; gap: 2px; padding: 2px; min-height: 0; }
.win { background: #fff; border: 1px solid #8a8f96; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.win.focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.win-title { display: flex; align-items: center; gap: 6px; padding: 1px 4px; background: linear-gradient(#f7f7f7, #e1e1e1); border-bottom: 1px solid var(--line); font-size: 12px; cursor: default; user-select: none; white-space: nowrap; overflow: hidden; }
.win.focus .win-title { background: linear-gradient(#e8f1fb, #cfe0f5); }
.win-title .wt { overflow: hidden; text-overflow: ellipsis; flex: 1; } .win-title button { background: none; border: none; cursor: pointer; font-size: 12px; padding: 0 3px; color: #333; }
.win-body { position: relative; flex: 1; min-height: 0; }
.win-body .player { border: none; padding: 0; height: 100%; } .win-body .chart-wrap { height: 100%; min-height: 0; }
.win-body .wait { padding: 14px; color: var(--muted); direction: rtl; }
.wtabs { grid-column: 2; display: flex; gap: 0; background: var(--chrome); border-top: 1px solid var(--line); overflow-x: auto; }
.wtabs button { border: 1px solid var(--line); border-top: none; background: var(--chrome); padding: 3px 12px; cursor: pointer; font: inherit; white-space: nowrap; margin-left: -1px; }
.wtabs button.on { background: #fff; font-weight: 600; }
.tbx { grid-column: 1 / 3; background: #fff; border-top: 2px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.tbx-body { flex: 1; overflow: auto; } .tbx .grid-table { font-size: 12.5px; } .tbx .grid-table th { text-align: left; } .tbx .grid-table td { text-align: left; }
.tbx .bal td { background: #eef0f2 !important; font-weight: 600; }
.tbx-tabs { display: flex; border-top: 1px solid var(--line); background: var(--chrome); }
.tbx-tabs button { border: 1px solid var(--line); border-top: none; background: var(--chrome); padding: 3px 14px; cursor: pointer; font: inherit; margin-left: -1px; }
.tbx-tabs button.on { background: #fff; font-weight: 600; }
.tbx-tabs .stat { margin-left: auto; padding: 3px 10px; color: var(--muted); }

/* ---------- run journal as MT5 Toolbox */
.jbox { border: 1px solid var(--line); background: #fff; }
.jbox .table-wrap { max-height: 46vh; border: none; }
.jbox .tbx-tabs { display: flex; border-top: 1px solid var(--line); background: var(--chrome); direction: ltr; }
.jbox .tbx-tabs button { border: 1px solid var(--line); border-top: none; background: var(--chrome); padding: 3px 14px; cursor: pointer; font: inherit; margin-left: -1px; }
.jbox .tbx-tabs button.on { background: #fff; font-weight: 600; }
.jbox .tbx-tabs .stat { margin-left: auto; }
.jbal { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 4px 10px; background: #eef0f2; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.live-dot { color: #c62828; font-weight: 700; margin-inline-start: auto; animation: blink 1.2s steps(2) infinite; }
@keyframes blink { 50% { opacity: .35; } }
.grid-table.mt5 tbody tr { cursor: pointer; }
.grid-table tr.future td { color: #9aa3ad; }

/* ---------- ZT logo */
.brand .logo { width: 28px; height: 28px; border-radius: 5px; display: block; }
.brand { align-items: center; }
.login-logo { width: 96px; height: 96px; border-radius: 14px; align-self: center; box-shadow: 0 2px 10px #0003; }

.chart-wrap canvas.chart { user-select: none; }

/* ---------- edit with Claude, red change marks */
.ai-card textarea { width: 100%; }
.ai-draft { border: 1px solid #e3b3b3; background: #fffafa; padding: 10px 12px; margin-top: 10px; }
.grid-table td.chg, .chg { color: #c62828; font-weight: 700; }
.fields label.changed { outline: 2px solid #e57373; background: #fff3f3; }
.fields label.changed input, .fields label.changed select { border-color: #c62828; color: #c62828; font-weight: 600; }
.fields .was { color: #c62828; }
.chg-dot { display: inline-block; width: 10px; height: 10px; background: #e57373; vertical-align: middle; }
.wdiff { white-space: pre-wrap; line-height: 1.7; border: 1px solid var(--line); background: #fff; padding: 8px 10px; }
.wdiff ins { color: #c62828; background: #ffe5e5; text-decoration: none; font-weight: 600; }
.wdiff del { color: #c62828; opacity: .75; }
.diffbox summary { color: #c62828; cursor: pointer; margin: 4px 0; }

.upd-bar { position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%); z-index: 100; background: #fff8d6; border: 1px solid #d9b84a;
  box-shadow: 0 4px 16px #0003; padding: 8px 14px; display: flex; gap: 10px; align-items: center; font-weight: 600; }

/* ---------- workspace = account: toolbar, Balance strip, note to Claude, Market Watch + charts, window tabs, Toolbox */
.term.acc { grid-template-rows: auto auto auto 1fr auto 240px; }
.term.acc .tb { grid-column: 1 / 3; grid-row: 1; } .term.acc .acct { grid-column: 1 / 3; grid-row: 2; }
.term.acc .noterow { grid-column: 1 / 3; grid-row: 3; }
.term.acc .mw { grid-column: 1; grid-row: 4 / 6; } .term.acc .grid-area { grid-column: 2; grid-row: 4; } .term.acc .wtabs { grid-column: 2; grid-row: 5; }
.term.acc .tbx { grid-column: 1 / 3; grid-row: 6; border-top: 2px solid var(--line); }
.term.acc .tbx .graph-wrap { height: 100%; } .term.acc .acct-graph { min-height: 90px; }
.acct { display: flex; direction: ltr; background: #f7f9fc; border-bottom: 1px solid var(--line); }
.acct > div { padding: 3px 14px; border-right: 1px solid var(--line); display: flex; flex-direction: column; justify-content: center; }
.acct span { font-size: 11px; color: #555; } .acct b { font-size: 15px; font-variant-numeric: tabular-nums; }
.acct .set { margin-left: auto; background: #fff8e1; } .acct .setrow { font-size: 12px; font-weight: 400; display: flex; gap: 4px; align-items: center; }
.noterow { display: flex; gap: 6px; align-items: center; padding: 4px 8px; background: #f5f9ff; border-bottom: 1px solid #9fb9dc; direction: rtl; }
.noterow .note-in { flex: 1; min-width: 0; border: 1px solid #9fb9dc; padding: 4px 8px; }
.nlab { font-size: 12px; color: #1565c0; font-weight: 600; white-space: nowrap; }
.ncount { font-size: 12px; background: #1565c0; color: #fff; border: none; border-radius: 9px; padding: 2px 9px; white-space: nowrap; cursor: pointer; }
.graph-wrap { display: flex; gap: 12px; padding: 8px; height: 100%; box-sizing: border-box; direction: ltr; }
.graph-box { flex: 1; display: flex; flex-direction: column; min-width: 0; } .acct-graph { flex: 1; width: 100%; min-height: 120px; border: 1px solid var(--line); background: #fff; }
.graph-side { width: 260px; display: flex; flex-direction: column; gap: 6px; direction: rtl; }
.note { display: grid; grid-template-columns: 170px 1fr 30px; gap: 10px; border: 1px solid var(--line); background: #fff; padding: 6px; margin-bottom: 6px; align-items: start; }
.note img { width: 170px; border: 1px solid #ccc; } .note .noimg { width: 170px; height: 60px; display: grid; place-items: center; background: #f4f4f4; color: #888; font-size: 12px; }
.nh { font-size: 12px; color: #1565c0; font-weight: 600; margin-bottom: 3px; }

.notes-in { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; } .notes-in .note { grid-template-columns: 130px 1fr 24px; } .notes-in .note img { width: 130px; }

.acc-sel { min-width: 240px; font-weight: 600; } .ext-win { overflow: auto; height: 100%; direction: rtl; } .ext-win .grid-table { font-size: 12px; }

.ai-hist { margin-top: 10px; } .ai-hist summary { cursor: pointer; color: var(--accent); }

/* ---------- side bar (replaces the top bar), home page, Toolbox tabs on top */
.layout { display: grid; grid-template-columns: 190px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--chrome); border-inline-end: 1px solid var(--line); z-index: 20; }
.side-brand { display: flex; align-items: center; gap: 8px; padding: 12px 10px; border-bottom: 1px solid var(--line); color: var(--text); }
.side-brand:hover { text-decoration: none; }
.side-brand .logo { width: 38px; height: 38px; border-radius: 7px; }
.side-brand b { display: block; font-size: 15px; } .side-brand span { color: var(--accent); font-weight: 600; font-size: 13px; }
.side-brand i { font-style: normal; font-size: 10px; background: #fff; border: 1px solid var(--line); padding: 0 5px; border-radius: 3px; color: var(--muted); margin-inline-start: 5px; }
.side-nav { display: flex; flex-direction: column; padding: 8px 0; flex: 1; height: auto; gap: 1px; }
.side-nav a { color: var(--text); padding: 8px 12px; display: flex; align-items: center; gap: 9px; border-inline-start: 3px solid transparent; }
.side-nav a:hover { background: var(--chrome2); text-decoration: none; }
.side-nav a.on { background: #fff; border-inline-start-color: var(--accent); font-weight: 600; }
.side-nav .ic { width: 18px; text-align: center; color: var(--muted); } .side-nav a.on .ic { color: var(--accent); }
.side-who { border-top: 1px solid var(--line); padding: 8px 10px; display: flex; align-items: center; justify-content: space-between; gap: 6px; color: var(--muted); font-size: 12px; }
.side-who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layout > main { min-width: 0; max-width: none; margin: 0; }
.term { height: 100vh; }
.term.acc { grid-template-rows: auto auto auto 1fr auto 260px; }
.tbx-tabs { border-top: none; border-bottom: 1px solid var(--line); }
.tbx-tabs button { border-top: 1px solid var(--line); border-bottom: none; }
.tbx-tabs button.on { margin-bottom: -1px; border-bottom: 1px solid #fff; }
main.home { max-width: 1250px; margin: 0 auto; padding: 0 22px 40px; }
.hero { display: flex; align-items: center; gap: 22px; padding: 28px 0 18px; border-bottom: 1px solid var(--line); }
.hero-logo { width: 104px; height: 104px; border-radius: 18px; box-shadow: 0 2px 10px rgba(0,0,0,.18); }
.hero h1 { margin: 0 0 6px; font-size: 30px; } .hero h1 span { color: var(--accent); }
.hero p { margin: 0; color: var(--muted); font-size: 15px; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; }
.home-card { display: block; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; color: var(--text); }
.home-card:hover { border-color: #7aa7dc; box-shadow: 0 1px 6px rgba(21,101,192,.12); text-decoration: none; }
.home-card h3 { color: var(--accent); font-size: 15px; } .home-card p { margin: 0 0 6px; }
.home-card ul { margin: 0; padding-inline-start: 18px; color: var(--muted); font-size: 12.5px; }
main.home .tag { margin: 1px 2px; display: inline-block; }

/* ---------- strategy chat */
.chat-thread { max-height: 560px; min-height: 120px; overflow: auto; display: flex; flex-direction: column; gap: 8px; padding: 8px; background: #f6f7f9; border: 1px solid var(--line); border-radius: 4px; margin: 6px 0 8px; }
.msg { max-width: 88%; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.msg.user { align-self: flex-start; background: #e8f1fc; border-color: #b8d2f0; }
.msg.claude { align-self: flex-end; }
.msg.system { align-self: center; background: #eef6ee; border-color: #bcdcbc; font-size: 12.5px; max-width: 70%; }
.msg .mh { margin-bottom: 3px; } .msg .mt { white-space: pre-wrap; }
.msg .typing .dots { display: inline-block; animation: blink 1.2s infinite; } @keyframes blink { 50% { opacity: .2; } }
.chat-compose { display: flex; gap: 8px; align-items: flex-end; } .chat-compose textarea { flex: 1; }
.chat-attach .notes-in { margin-top: 4px; }

/* ---------- strategy chip, player note bar */
.strat-chip { display: inline-block; font-size: 12px; padding: 1px 8px; border: 1px solid #b8d2f0; border-radius: 10px; background: #eef5fd; color: var(--accent); white-space: nowrap; margin-top: 2px; }
.strat-chip:hover { background: #dcebfb; text-decoration: none; }
.player-notes { margin: 6px 0; border: 1px solid #9fb9dc; border-radius: 4px; }

/* ---------- image attachment on notes */
.att { display: inline-flex; align-items: center; gap: 4px; }
.att-thumb { display: inline-flex; align-items: center; gap: 2px; } .att-thumb.hidden { display: none; }
.att-thumb img { height: 26px; max-width: 60px; object-fit: cover; border: 1px solid var(--line); border-radius: 3px; }

/* ---------- replies under the player note bar */
.run-replies { border: 1px solid #9fb9dc; border-top: none; border-radius: 0 0 4px 4px; background: #fbfdff; padding: 6px 10px; margin: -6px 0 8px; max-height: 340px; overflow: auto; }
.run-replies.hidden { display: none; }
.rr { border-top: 1px dashed var(--line); padding: 6px 0; } .rr:first-of-type { border-top: none; }
.rr-user { background: #e8f1fc; border-radius: 6px; padding: 4px 8px; display: inline-block; max-width: 95%; }
.rr-img { height: 34px; margin-inline-start: 6px; vertical-align: middle; border: 1px solid var(--line); border-radius: 3px; }
.rr-claude { margin: 5px 0 0 0; padding: 4px 8px; border-inline-start: 3px solid var(--accent); }
.rr-claude.typing .dots { animation: blink 1.2s infinite; }

/* ---------- one screen: note row + replies, window chip, toolbox detail */
.term.acc .noterow-wrap { grid-column: 1 / 3; grid-row: 3; }
.noterow-wrap .noterow { border-bottom: none; }
.replies-host { max-height: 230px; overflow: auto; border-bottom: 1px solid #9fb9dc; direction: rtl; }
.replies-host.hidden { display: none; }
.replies-host .run-replies { margin: 0; border: none; border-radius: 0; }
.win-title .wchip { font-size: 11px; color: var(--accent); cursor: pointer; padding: 0 6px; border: 1px solid #b8d2f0; border-radius: 8px; background: #eef5fd; margin: 0 4px; white-space: nowrap; }
.win-title .wchip:hover { background: #dcebfb; text-decoration: none; }
.win-title .wbtn { font-size: 10.5px; padding: 0 4px; color: var(--muted); text-decoration: none; }
.win-title .wbtn:hover { color: var(--accent); }
.tbx-detail { padding: 6px 10px; direction: rtl; }

/* ---------- engine code changes */
.compose-side { display: flex; flex-direction: column; gap: 4px; align-items: stretch; }
.code-mode { white-space: nowrap; }
.code-msg { border: 1px solid #d6c08a; background: #fffaf0; border-radius: 6px; padding: 6px 8px; margin-top: 4px; }
.code-msg .code-checks { margin: 4px 0; } .code-msg code { font-size: 11.5px; }
pre.diff { max-height: 420px; overflow: auto; background: #fbfbfb; border: 1px solid var(--line); padding: 6px; font-size: 11.5px; line-height: 1.35; white-space: pre; direction: ltr; text-align: left; }
pre.diff .da { color: #1b5e20; background: #e8f5e9; } pre.diff .dd { color: #b71c1c; background: #ffebee; }
pre.diff .dc { color: #6a1b9a; } pre.diff .df, pre.diff .dh { color: #555; font-weight: 600; }

/* balance now: always black */
.metric b.plain { color: #111; }

/* Toolbox: All Deals — past bright, open now highlighted, future faded */
.all-deals tr.deal-past td { color: #111; }
.all-deals tr.deal-now td { background: #fff7d6; font-weight: 600; }
.all-deals tr.deal-future td { color: #9aa3ad; }
.all-deals tr.deal-future td.pos, .all-deals tr.deal-future td.neg { opacity: .55; }
.all-deals tr:hover td { background: #eef4ff; }

/* signal set: Claude rules, saved rule sets */
.rules-ask { width: 100%; font: inherit; padding: 8px; border: 1px solid var(--line, #d0d7de); border-radius: 6px; resize: vertical; }
.rules-out ul { margin: 4px 18px 8px 0; padding: 0; }
.rules-out .warn { color: #8a4b00; }
.adv-rules { margin: 6px 0 4px; } .adv-rules summary { cursor: pointer; font-weight: 600; }
.adv-rules select[multiple] { min-width: 220px; }
.rules-table td { vertical-align: top; }

/* billing */
.billing-page .bill-hero { display: flex; gap: 18px; align-items: center; margin: 8px 0 16px; }
.billing-page .bill-hero h1 { margin: 0 0 6px; }
.plan-card { max-width: 520px; }
.plan-price b { font-size: 40px; } .plan-price span { color: var(--muted); font-size: 18px; }
.plan-card ul { margin: 10px 18px 14px 0; padding: 0; line-height: 1.8; }
.pp-box { min-height: 60px; max-width: 420px; }
.btn.big { font-size: 18px; padding: 12px 22px; }
.step-panel .th { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--line2); color: var(--muted); font-size: 11.5px; }
.step-panel .th b { display: block; font-size: 11px; }
.step-panel .th.now { color: var(--text); font-size: 12.5px; }
.dark-chart .step-panel .th.now { color: #f2f6fa; }
.step-panel .th-d { display: block; font-weight: 400; color: var(--muted); font-size: 11px; }

/* ---------- guided morning ("inside a trader's head") */
.mind { padding-top: 6px; }
.mind-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.mind-head h2 { margin-bottom: 2px; }
.mind-bar { height: 4px; background: var(--line2); border-radius: 2px; margin: 10px 0; overflow: hidden; }
.mind-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.mind-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 430px); gap: 12px; align-items: start; }
.mind-chart { position: relative; height: min(68vh, 620px); min-height: 340px; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; direction: ltr; background: #fff; }
.mind-chart canvas { display: block; }
.mind-pos { position: absolute; top: 8px; left: 8px; direction: rtl; background: rgba(255,255,255,.94); border: 1px solid var(--line); border-radius: 3px; padding: 2px 8px; font-size: 12px; color: var(--muted); }
.mind-pos:empty { display: none; }
.mind-pos.long { color: var(--pos); border-color: #b7dfc2; font-weight: 600; } .mind-pos.short { color: var(--neg); border-color: #f2b8b5; font-weight: 600; }
.mind-card { font-size: 14.5px; line-height: 1.6; margin: 0; max-height: min(68vh, 620px); overflow: auto; }
.mind-card h3 { font-size: 17px; margin: 4px 0 10px; }
.mind-card h4 { margin: 0 0 2px; font-size: 12px; }
.mind-card p { margin: 0 0 10px; }
.mind-card ul { margin: 2px 0; padding-inline-start: 20px; } .mind-card li { margin-bottom: 4px; }
.mind-step { display: flex; align-items: baseline; gap: 4px; font-size: 12px; }
.mind-step .clock { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mind-sec { margin: 0 0 12px; }
.mind-sec.did { border-inline-start: 3px solid var(--accent); padding-inline-start: 10px; font-weight: 600; }
.mind-sec.after { background: var(--panel2); border: 1px solid var(--line2); border-radius: 4px; padding: 8px 10px; }
.mind-q { font-weight: 700; margin: 4px 0 8px; }
.mind-opts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.mind-opts .btn.opt { justify-content: flex-start; white-space: normal; text-align: start; padding: 11px 14px; font-size: 14.5px; min-height: 44px; display: block; }
.mind-opts.done .opt { display: flex; justify-content: space-between; gap: 10px; border: 1px solid var(--line2); border-radius: 3px; padding: 7px 12px; color: var(--muted); }
.mind-opts.done .opt.his { border-color: var(--accent); background: var(--accent-bg); color: var(--text); font-weight: 600; }
.mind-opts.done .opt.mine:not(.his) { border-color: #f0c36d; background: #fff8e6; color: var(--text); }
.mind-opts.done .who { font-size: 12px; white-space: nowrap; }
.mind-verdict { font-weight: 700; margin-bottom: 12px; } .mind-verdict.same { color: var(--pos); } .mind-verdict.diff { color: var(--warn); }
.mind-quote { margin: 0 0 12px; } .mind-quote .q { display: block; text-align: left; font-style: italic; color: var(--muted); margin-bottom: 6px; }
.mind-quote .yt { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 4px; }
.mind-note { font-size: 12.5px; color: var(--warn); background: #fff8e6; border: 1px solid #f0c36d; border-radius: 4px; padding: 8px 10px; line-height: 1.5; }
.mind-score { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; } .mind-score b { font-size: 30px; }
.btn.big { padding: 9px 20px; font-size: 14.5px; min-height: 44px; }
.gterm { border-bottom: 1px dashed var(--accent); cursor: help; }
.term-box { background: var(--accent-bg); border: 1px solid #7aa7dc; border-radius: 4px; padding: 6px 10px; margin: -4px 0 12px; font-size: 13px; font-weight: 400; }
.mind-item h3 { font-size: 16px; }
@media (max-width: 900px) {
  .mind-grid { grid-template-columns: 1fr; }
  .mind-chart { height: 44vh; min-height: 260px; }
  .mind-card { max-height: none; }
}
@media (max-width: 700px) { .layout:has(.mind) .side { display: none; } .layout:has(.mind) { display: block; } .mind-head h2 { font-size: 16px; } }
