/* ---------- 0.14.0: the three parts (Backtesting / Live / Charts), the Live accounts pages and the live charts ----------
   Colours are app.css's variables only, so every style and accent works; the look-specific touches are at the end. */

/* the switch between the three parts, in every top bar */
.cat-switch { display: inline-flex; align-items: center; gap: 2px; padding: 3px; flex-shrink: 0;
  border-radius: calc(var(--radius-btn) + 3px); background: var(--sunken); border: 1px solid var(--line); }
.cat-switch .cat { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: var(--radius-btn);
  color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 600; white-space: nowrap; line-height: 1.2; transition: background-color .12s, color .12s; }
.cat-switch .cat:hover { color: var(--text); background: var(--hover); }
.cat-switch .cat.on { background: var(--panel2); color: var(--text-hi); box-shadow: inset 0 0 0 1px var(--line2); }
a.brand { color: inherit; text-decoration: none; }
.home-top .cat-switch { margin-left: -8px; }
.ab-lead { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
@media (max-width: 1540px) { .appbar .ab-lead .ab-brand > span:last-child:not(:first-child) { display: none; } }

/* ---------- Live accounts ---------- */
.live-page { display: flex; flex-direction: column; gap: 16px; }
/* a live account's Journal and Trades tabs: wider than the other pages, so the day's trades table fits next to the calendar */
.home .home-body.home-page.live-page.lv-wide { max-width: 1640px; }
.lv-head { align-items: flex-start; gap: 16px; }
.lv-head h1 { margin: 0 0 4px; }
.lv-head p { margin: 0; }
.lv-usage { font-size: 12px; color: var(--muted); padding: 5px 10px; border: 1px solid var(--line); border-radius: var(--radius-btn); white-space: nowrap; }
.lv-found { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--radius); color: var(--text);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line)); background: var(--accent-soft); }
.lv-found > span:not(.icw) { flex: 1; }
.lv-total { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.lv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.lv-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-lg); color: var(--text); text-decoration: none; transition: border-color .12s; min-width: 0; }
.lv-card:hover { border-color: var(--line2); }
.lv-card-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.lv-card-name { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.lv-card-name b, .lv-card-name span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lv-card-big { display: flex; gap: 28px; }
.lv-card-big > div { display: flex; flex-direction: column; gap: 2px; }
.lv-card-big b { font-size: 22px; font-weight: 700; }
.lv-card-row { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--muted); }
.lv-card-row b, .lv-card-big b { color: var(--text); }
.lv-card b.pos, .lv-card-row b.pos { color: var(--green); }
.lv-card b.neg, .lv-card-row b.neg { color: var(--red); }
.lv-card-foot { border-top: 1px solid var(--rowline); padding-top: 10px; }
.lv-add { align-items: center; justify-content: center; border-style: dashed; cursor: pointer; color: var(--muted); min-height: 190px; font: inherit; }
.lv-add:hover { color: var(--text); border-color: var(--accent); }
.lv-kind { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  font: 700 11px var(--font-mono); background: var(--panel2); color: var(--text); border: 1px solid var(--line2); }
.lv-kind.big { width: 44px; height: 44px; font-size: 13px; border-radius: 12px; }
.lv-kind.k-mt5 { background: color-mix(in srgb, var(--accent) 16%, var(--panel2)); color: var(--accent-text); }
.lv-kind.k-ctrader { background: color-mix(in srgb, var(--green) 16%, var(--panel2)); color: var(--up-text); }
.lv-kind.k-projectx { background: color-mix(in srgb, var(--orange) 16%, var(--panel2)); color: var(--warn-text); }
.lv-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.lv-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); flex-shrink: 0; }
.lv-status.ok i { background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 22%, transparent); }
.lv-status.wait i { background: var(--warn); }
.lv-status.bad { color: var(--down-text); } .lv-status.bad i { background: var(--red); }
.lv-empty { display: flex; flex-direction: column; gap: 6px; padding: 28px; }
.lv-empty h2 { margin: 0; }
.lv-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 8px; }
.lv-empty .lv-choices { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.lv-choice { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left; padding: 16px; font: inherit;
  border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel2); color: var(--text); cursor: pointer; transition: border-color .12s; }
.lv-choice:hover:not(:disabled) { border-color: var(--accent); }
.lv-choice:disabled { opacity: .55; cursor: default; }
.lv-note { font-size: 11px; color: var(--warn-text); }
.lv-update { display: flex; align-items: flex-start; gap: 8px; margin-top: 8px; padding: 8px 12px; font-size: 13px; line-height: 1.45; border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); background: color-mix(in srgb, var(--accent) 8%, var(--panel)); }
.lv-update svg { flex: none; margin-top: 2px; color: var(--accent); }
.lv-connect h3 { margin: 6px 0; }
.lv-back { display: inline-block; margin-bottom: 4px; }
.lv-steps li { margin: 7px 0; line-height: 1.5; }
.lv-steps code, .lv-connect code { background: var(--sunken); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.lv-found-list { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.lv-found-row { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(160px, 220px) auto; align-items: center; gap: 12px; padding: 12px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel2); }
.lv-found-row .field { margin: 0; }
.lv-looking { display: flex; align-items: center; }
.spin { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line2); border-top-color: var(--accent);
  margin-right: 8px; flex-shrink: 0; animation: lv-spin .8s linear infinite; }
@keyframes lv-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 2.4s; } }
.lv-map { display: flex; flex-direction: column; gap: 8px; }
.lv-map-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.lv-preview { display: flex; flex-direction: column; gap: 8px; }
.lv-preview .table { font-size: 12px; }
.lv-fmt-hint { margin: 0; }
.lv-acct-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; align-items: center; }
.lv-acct-head .lv-back { grid-column: 1 / -1; justify-self: start; }
.lv-acct-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.lv-acct-title h1 { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lv-acct-btns { grid-column: 2; grid-row: 2 / span 2; }
.lv-tabs { align-self: flex-start; display: inline-flex; }
.lv-tabs .seg { flex: none; padding: 6px 18px; text-decoration: none; }
.lv-view { display: flex; flex-direction: column; gap: 12px; }
.lv-view h3 { margin: 8px 0 0; }
.lv-sub { align-items: center; }
.lv-trades td { white-space: nowrap; }
.lv-view .journal { min-height: 560px; }

/* ---------- Live charts ---------- */
.ws.lc .lc-top { display: flex; align-items: center; gap: 12px; padding: 6px 12px; border-bottom: 1px solid var(--line); background: var(--chrome); min-width: 0; }
.ws.lc .lc-top .grow { flex: 1; }
.lc-brand .logo-svg svg { width: 28px; height: 28px; display: block; }
.lc-syms { display: flex; align-items: center; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.lc-syms::-webkit-scrollbar { display: none; }
.lc-syms.more-right { mask-image: linear-gradient(to right, #000 calc(100% - 22px), transparent); }
.lc-syms.more-left { mask-image: linear-gradient(to left, #000 calc(100% - 22px), transparent); }
.lc-syms.more-left.more-right { mask-image: linear-gradient(to right, transparent, #000 22px, #000 calc(100% - 22px), transparent); }
.lc-sym { background: none; border: 1px solid transparent; color: var(--muted); padding: 4px 10px; border-radius: var(--radius-btn); cursor: pointer;
  font: 600 13px var(--font-mono); white-space: nowrap; }
.lc-sym:hover { color: var(--text); background: var(--hover); }
.lc-sym.on { color: var(--text-hi); background: var(--panel2); border-color: var(--line2); }
.lc-sym.more { font-family: var(--font-body); }
.lc-tfs { display: flex; align-items: center; gap: 1px; }
.lc-tfs .tf.on { color: var(--text-hi); background: var(--panel2); }
.lc-src { display: inline-flex; align-items: center; gap: 8px; background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: var(--radius-btn);
  padding: 5px 12px; cursor: pointer; font: 600 12.5px var(--font-body); white-space: nowrap; }
.lc-src:hover { border-color: var(--line2); }
.lc-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 22%, transparent); }
.lc-dot.demo { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 22%, transparent); }
.lc-tools-r { display: flex; align-items: center; gap: 4px; }
.lc-tools-r .ctl.icon-only { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; }
.lc-main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; position: relative; background: var(--bg); }
.lc-main .lc-cell { min-height: 0; display: flex; flex-direction: column; position: relative; }
.lc-main .lc-chart { flex: 1; min-height: 0; }
/* several charts (0.18.0): the replay's grid (app.css .charts), each chart with a title row; one chart has none */
.lc-main .lc-charts { flex: 1; }
.lc-charts.l-1 .lc-head { display: none; }
.lc-head { gap: 2px; padding: 2px 4px; }
.lc-head .grow { flex: 1; }
.lc-head :is(.lc-h-sym, .lc-h-tf, .lc-h-src) { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; color: var(--text); font: inherit;
  font-size: 12px; padding: 2px 6px; border-radius: var(--radius-btn); cursor: pointer; white-space: nowrap; }
.lc-head :is(.lc-h-sym, .lc-h-tf, .lc-h-src):hover { background: var(--hover); color: var(--text-hi); }
.lc-head .lc-h-sym { font-weight: 650; color: var(--text-hi); }
.lc-head .lc-h-src { color: var(--muted); }
.lc-head .lc-h-src.demo { color: var(--warn-text); }
.lc-head .lc-h-src .lc-dot { width: 6px; height: 6px; box-shadow: none; }
.lc-head .lc-h-status { font-size: 11.5px; min-width: 0; max-width: none; flex: 0 1 auto; margin-left: 4px; }
.lc-head .lc-h-x { opacity: .55; }
.lc-head .lc-h-x:hover { opacity: 1; }
/* the chart the top bar and the keys act on: an accent line under its title */
.lc-charts:not(.l-1) .lc-cell.active .lc-head { box-shadow: inset 0 -2px 0 var(--accent); }
.lc-charts:not(.l-1) .lc-cell.active .lc-head .lc-h-sym { color: var(--accent-text); }
/* a narrow chart keeps its market and timeframe; the source and the status give way first */
@container lchead (max-width: 330px) { .lc-head .lc-h-status { display: none; } }
@container lchead (max-width: 230px) { .lc-head .lc-h-src { display: none; } }
.lc-head { container: lchead / inline-size; }
/* a chart's market menu: a box to find (or, Bridge 1.2, type) a symbol and a list that scrolls */
.lc-find { padding: 4px 6px 6px; }
.lc-find input { width: 100%; min-width: 220px; font-size: 12.5px; padding: 5px 8px; }
.lc-symlist { max-height: min(56vh, 440px); overflow-y: auto; overscroll-behavior: contain; }
.lc-demo { padding: 5px 12px; font-size: 12px; color: var(--warn-text); background: var(--warn-soft); border-bottom: 1px solid var(--line); text-align: center; }
.lc-empty { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
.lc-empty-card { max-width: 520px; text-align: center; }
.lc-foot { display: flex; align-items: center; gap: 8px; padding: 4px 12px; border-top: 1px solid var(--line); background: var(--chrome); font-size: 12px; min-height: 26px; }
.lc-status { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; }
.lc-status .grow { flex: 1; }
.ws.lc .toolbox .tool.on { color: var(--accent-text); }

/* the styled looks: rounder, a little more room */
.ws.lc.styled .lc-top { gap: 14px; padding: 8px 16px; background: var(--bg); }
.ws.lc.styled .cat-switch { background: var(--panel); }
.ws.lc.studio .lc-top { height: 56px; }
.ws.lc.studio .lc-main { margin: 8px 8px 8px 8px; border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.ws.lc.studio .lc-foot, .ws.lc.quest .lc-foot { background: var(--bg); border-top: 0; }
.ws.lc.quest .lc-sym.on { box-shadow: inset 0 -3px 0 var(--accent); border-color: transparent; border-radius: 10px; }
.ws.lc.quest .lc-top { height: 54px; }
.ws.lc.nebula .lc-main { border-color: var(--line2); background: var(--deep, var(--bg)); }
.ws.lc.nebula .lc-dot:not(.demo) { background: var(--accent); box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 60%, transparent); }

/* the styled top bars' switch */
.appbar .cat-switch { background: var(--panel); }
.appbar.studio .cat-switch .cat { padding: 6px 13px; }
.appbar.quest .cat-switch { border-radius: 12px; }
.appbar.quest .cat-switch .cat { border-radius: 9px; }
.appbar.quest .cat-switch .cat.on { box-shadow: inset 0 -2px 0 var(--accent); background: var(--panel2); }
.appbar.nebula .cat-switch .cat.on { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 50%, var(--line2)); }

/* Narrower windows (0.19.1): no top bar is wider than the window (see the note in looks.css). The switch and the
   "New backtest" / "Add account" button shrink here, the Charts bar below. */
@media (max-width: 1240px) {
  .appbar.studio .cat-switch .cat { padding: 6px 10px; }
  .appbar.quest .cat-switch .cat { padding: 5px 9px; }
}
@media (max-width: 1240px) { /* just the +, its name is its tooltip */
  .appbar.studio:not(.clarity) .ab-new:is(.new-backtest-btn, .add-account-btn) { font-size: 0; gap: 0; padding: 0; aspect-ratio: 1; justify-content: center; }
}
@media (max-width: 1100px) { .home-top { gap: 14px; padding-left: 16px; padding-right: 16px; } .home-top .tabs .tab { white-space: nowrap; } .home-right .account-chip { max-width: 200px; } } /* Classic's bar: a long email gets cut short */
@media (max-width: 1000px) { .home-top .brand b { display: none; } } /* the logo alone, like the other looks' bars */
.lc-src > span { max-width: 190px; overflow: hidden; text-overflow: ellipsis; }
/* the Charts bar: the symbols give way first (down to a little room of their own), then the rest tightens; the timeframes
   scroll only when there are very many */
.ws.lc .lc-syms { flex: 0 1 auto; min-width: 96px; }
.lc-tfs { flex-shrink: 0; max-width: 38vw; overflow-x: auto; scrollbar-width: none; }
.lc-tfs::-webkit-scrollbar { display: none; }
@media (max-width: 1240px) {
  .ws.lc .lc-top, .ws.lc.styled .lc-top { gap: 8px; padding-left: 10px; padding-right: 10px; }
  .ws.lc .lc-top .cat-switch .cat { padding-left: 9px; padding-right: 9px; }
}
@media (max-width: 1100px) {
  .lc-src > span { display: none; } /* the dot still shows demo or real; the menu names the source */
  .lc-tools-r { gap: 2px; }
  .lc-tools-r .ctl.icon-only { min-width: 30px; padding-left: 6px; padding-right: 6px; }
  .lc-tfs .tf { padding-left: 5px; padding-right: 5px; min-width: 0; }
}
@media (max-width: 1000px) {
  .ws.lc .lc-top, .ws.lc.styled .lc-top { gap: 6px; }
  .ws.lc .lc-top .cat-switch .cat { padding-left: 7px; padding-right: 7px; }
  .lc-tfs .tf { padding-left: 4px; padding-right: 4px; }
}
:root[data-style="quest"] .lv-card { box-shadow: 0 3px 0 #07081a; }
:root[data-style="nebula"] .lv-card { background: linear-gradient(180deg, var(--panel), var(--deep, var(--panel))); }
/* the styled looks have Add account in the top bar already */
.home.styled:is(.studio, .quest, .nebula, .clarity, .dojo).cat-live .lv-head .btn.primary { display: none; }
/* the live chart's status line has room for "No new prices since Fri 16:59 (the market may be closed)" */
.lc-status .lv-status { max-width: min(680px, 70vw); }
/* an older Bridge: which version it is and how to update it, wrapped in the market menu */
.cmenu-item.lc-update { align-items: flex-start; cursor: default; }
.cmenu-item.lc-update .cmenu-label { white-space: normal; max-width: 340px; line-height: 1.45; padding: 2px 0; }

/* the Replaybook Bridge window (bridgeui.js) */
.br-win h4 { margin: 6px 0 0; }
.br-status { margin: 0; padding: 8px 12px; border-radius: var(--radius); background: var(--panel2); border: 1px solid var(--line); }
.br-status.old { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: color-mix(in srgb, var(--accent) 8%, var(--panel2)); }
.br-get { gap: 8px; flex-wrap: wrap; }
.br-get .btn { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
