:root {
  color-scheme: light;
  --paper: #f5f4fa;
  --surface: #fff;
  --ink: #211b35;
  --muted: #635b76;
  --rule: #e9e5f1;
  --violet: #5635ce;
  --violet-dark: #4426b5;
  --violet-wash: #f0ecff;
  --up: #087b65;
  --down: #b34059;
  --sans: "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --display: "Avenir Next", "Trebuchet MS", system-ui, sans-serif;
  --mono: "SFMono-Regular", "Menlo", Consolas, monospace;
  font: 500 14px/1.45 var(--sans);
  color: var(--ink);
  background: var(--paper);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .53; cursor: default; }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 3px; }
h1, h2, p, dl, dd { margin: 0; }
h2 { font: 700 16px/1.2 var(--display); letter-spacing: -.025em; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--rule); }
.topbar-inner, .workspace { width: min(100% - 64px, 1540px); margin-inline: auto; }
.topbar-inner { display: flex; align-items: center; min-height: 64px; gap: 17px; }
.brand { display: inline-flex; align-items: center; text-decoration: none; color: var(--ink); font: 750 25px/1 var(--display); letter-spacing: -.08em; }
.brand-period { color: var(--violet); }
.brand-mark { width: 29px; height: 29px; border-radius: 8px; background: var(--violet); display: flex; align-items: center; justify-content: center; gap: 2.5px; margin-right: 8px; }
.brand-mark i { width: 2.5px; border-radius: 5px; background: #fff; height: 9px; transform: translateY(3px); }
.brand-mark i:nth-child(2) { height: 15px; transform: none; }
.brand-mark i:nth-child(3) { height: 10px; transform: translateY(-3px); }
.topbar-divider { width: 1px; height: 19px; background: var(--rule); }
.topbar-label, .session-label { color: var(--muted); font-size: 12px; }
.session, .feed-controls { display: flex; align-items: center; gap: 9px; }
.session { margin-left: auto; }
.feed-state { display: inline-flex; align-items: center; gap: 7px; border-radius: 20px; padding: 5px 9px; background: var(--violet-wash); color: var(--violet-dark); font-size: 11px; font-weight: 700; white-space: nowrap; }
.feed-state i, .chart-footer i { width: 6px; height: 6px; display: inline-block; border-radius: 50%; background: currentColor; }
.feed-state.playing { background: #e6f8f1; color: var(--up); }
.feed-state.offline { background: #fff0f3; color: var(--down); }

.button, select, input { min-width: 0; border: 1px solid #ded8ec; border-radius: 7px; background: var(--surface); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 7px 12px; font-weight: 700; font-size: 12px; white-space: nowrap; }
.button:hover:not(:disabled) { border-color: #b6a8e0; background: #f9f7ff; }
.button.primary { border-color: var(--violet); background: var(--violet); color: #fff; }
.button.primary:hover:not(:disabled) { background: var(--violet-dark); border-color: var(--violet-dark); }
.automation-link { color: var(--ink); text-decoration: none; }
select { padding: 7px 26px 7px 9px; appearance: none; background:
  linear-gradient(45deg, transparent 52%, #6c6083 52%) calc(100% - 12px) 50% / 4px 4px no-repeat,
  linear-gradient(135deg, #6c6083 48%, transparent 48%) calc(100% - 8px) 50% / 4px 4px no-repeat,
  var(--surface); }
input { padding: 7px 9px; }
input::placeholder { color: #766e87; opacity: 1; }
input[type="number"] { font-family: var(--mono); font-size: 12px; }
input[type="number"]::placeholder { font: 500 12px var(--sans); }

.workspace { padding-top: 28px; }
.workspace-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 19px; }
h1 { font: 760 clamp(28px, 4vw, 39px)/1.08 var(--display); letter-spacing: -.065em; margin-bottom: 6px; }
.workspace-header p { color: var(--muted); font-size: 13px; }
.speed-label { color: var(--muted); font-size: 12px; }
.feed-controls select { min-height: 36px; font-size: 12px; }
#play-icon { font-size: 10px; }
.notice { position: fixed; right: 16px; bottom: 16px; z-index: 5; width: max-content; max-width: calc(100% - 32px); display: flex; align-items: center; gap: 12px; background: var(--violet-wash); border: 1px solid #d9cff9; border-radius: 8px; padding: 8px 10px 8px 13px; box-shadow: 0 5px 20px #24165024; color: var(--violet-dark); font-size: 13px; }
.notice.error { background: #fff0f3; border-color: #efcad3; color: #8c2b43; }
.notice .close-button { margin-left: auto; }
.account-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--rule); background: var(--surface); border-radius: 11px; margin-bottom: 16px; }
.account-stats div { padding: 11px 17px 12px; }
.account-stats div + div { border-left: 1px solid var(--rule); }
.account-stats dt { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.account-stats dd { overflow-wrap: anywhere; font: 650 clamp(12px, 1.5vw, 20px)/1.3 var(--mono); letter-spacing: -.05em; }
.positive { color: var(--up); }
.negative { color: var(--down); }

.terminal-grid { display: grid; grid-template-columns: minmax(228px, 1fr) minmax(0, 2.85fr) minmax(244px, 1.12fr); align-items: stretch; gap: 14px; }
.panel { min-width: 0; background: var(--surface); border: 1px solid var(--rule); border-radius: 11px; box-shadow: 0 2px 4px #2e225503; }
.panel-head { min-height: 51px; padding: 0 15px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.count { color: var(--muted); min-width: 22px; text-align: center; background: var(--paper); border-radius: 5px; padding: 2px 5px; font: 600 11px/1.45 var(--mono); }
.watch-panel { display: flex; flex-direction: column; }
.watch-search { padding: 0 12px 12px; }
.watch-search label { display: flex; position: relative; align-items: center; }
.watch-search input { width: 100%; padding-left: 28px; height: 35px; background: #faf9fd; font-size: 12px; }
.search-icon { position: absolute; left: 10px; width: 10px; height: 10px; border: 1.5px solid var(--muted); border-radius: 50%; pointer-events: none; }
.search-icon::after { content: ""; position: absolute; width: 5px; height: 1.5px; background: var(--muted); top: 7px; left: 6px; transform: rotate(45deg); }
.watch-labels, .watch-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(53px, auto) minmax(53px, auto); gap: 6px; align-items: center; width: 100%; text-align: right; }
.watch-labels { padding: 7px 13px; border-block: 1px solid var(--rule); color: var(--muted); font-size: 10px; }
.watch-labels span:first-child { text-align: left; }
.watchlist { flex: 1; overflow: auto; max-height: 440px; }
.watch-row { position: relative; border: 0; border-bottom: 1px solid var(--rule); padding: 10px 12px 10px 13px; min-height: 49px; background: var(--surface); }
.watch-row:focus-visible { outline-offset: -3px; }
.watch-row:hover { background: #f8f5ff; }
.watch-row[aria-pressed="true"] { background: var(--violet-wash); }
.watch-row[aria-pressed="true"]::before { content: ""; position: absolute; left: 0; top: 0; height: 100%; width: 3px; background: var(--violet); }
.row-symbol { min-width: 0; text-align: left; line-height: 1.2; }
.row-symbol strong, .row-symbol small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.row-symbol strong { font-size: 12px; }
.row-symbol small { font-size: 10px; margin-top: 4px; color: var(--muted); }
.row-price { font: 550 10px/1.3 var(--mono); }
.watch-footer, .chart-footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--muted); padding: 9px 13px; border-top: 1px solid var(--rule); font-size: 10px; }
.watch-footer time { color: var(--ink); font-family: var(--mono); margin-left: 3px; }
.empty-watch { margin: 14px; font-size: 12px; color: var(--muted); }

.chart-panel { display: flex; flex-direction: column; }
.chart-head { display: flex; gap: 12px; justify-content: space-between; align-items: center; padding: 14px 16px 12px; }
.instrument { display: flex; gap: 9px; align-items: center; min-width: 0; }
.instrument > div { min-width: 0; }
.instrument-mark { display: grid; place-items: center; width: 36px; height: 36px; flex: none; background: var(--violet-wash); color: var(--violet-dark); border-radius: 9px; font: 700 19px/1 var(--display); }
.instrument h2 { font-size: 18px; overflow-wrap: anywhere; }
.instrument p { font-size: 11px; color: var(--muted); }
.chart-quote { text-align: right; white-space: nowrap; }
.chart-quote > span { display: block; font: 700 23px/1.1 var(--mono); letter-spacing: -.065em; }
.chart-quote small { display: block; min-height: 16px; margin-top: 3px; color: var(--muted); font: 550 10px/1.3 var(--mono); }
.chart-quote small.positive { color: var(--up); }
.chart-quote small.negative { color: var(--down); }
.chart-toolbar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; padding: 8px 15px; border-block: 1px solid var(--rule); }
.segmented { background: var(--paper); border-radius: 7px; padding: 2px; display: inline-flex; gap: 1px; }
.segmented button { min-width: 33px; min-height: 27px; display: flex; align-items: center; justify-content: center; gap: 5px; padding: 3px 7px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); font: 650 11px/1.3 var(--sans); }
.segmented button:hover { color: var(--violet-dark); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--violet-dark); box-shadow: 0 1px 3px #3521631c; }
.candle-icon { display: inline-flex; align-items: center; gap: 2px; }
.candle-icon i { display: block; width: 2px; height: 9px; background: currentColor; }
.candle-icon i:nth-child(2) { height: 12px; }
.candle-icon i:nth-child(3) { height: 7px; }
.line-icon { font-size: 15px; line-height: 10px; transform: rotate(-17deg); }
.chart-readout { padding: 8px 15px 2px; min-height: 24px; display: flex; flex-wrap: wrap; gap: 3px 9px; color: var(--muted); font: 500 10px/1.4 var(--mono); }
.chart-readout b { font-weight: 600; color: var(--ink); }
.plot { flex: 1; min-height: 265px; position: relative; }
.plot canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; cursor: crosshair; }
.plot canvas:focus-visible { outline-offset: -3px; }
.chart-footer i { background: var(--violet); margin-right: 4px; }

.ticket-icon { width: 15px; height: 16px; border: 1.5px solid #7765ae; border-radius: 3px; position: relative; }
.ticket-icon::after { content: ""; position: absolute; inset: 4px 3px; border-block: 1px solid #7765ae; }
#order-form { padding: 0 14px 14px; display: grid; align-content: start; gap: 10px; }
.field, .field-pair { display: grid; min-width: 0; }
.field { gap: 4px; color: var(--muted); font-size: 11px; font-weight: 700; }
.field input, .field select { width: 100%; min-height: 35px; color: var(--ink); }
.field-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.order-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.order-sides button { display: grid; gap: 2px; text-align: left; padding: 6px 9px; border: 1px solid #eee7ed; border-radius: 7px; background: #fff8f9; color: var(--down); font-size: 11px; }
.order-sides .buy { background: #f0faf7; color: var(--up); border-color: #e2f2ec; }
.order-sides button[aria-pressed="true"] { border-color: currentColor; box-shadow: inset 0 0 0 .5px currentColor; }
.order-sides strong { font: 650 13px/1.3 var(--mono); }
.order-submit { width: 100%; min-height: 38px; margin-top: 2px; }
.inline-error { color: #97283f; font-size: 12px; overflow-wrap: anywhere; }

.activity-panel { margin-top: 14px; }
.activity-panel .panel-head { min-height: 47px; }
.activity-tabs { display: flex; gap: 16px; padding: 0 15px; border-bottom: 1px solid var(--rule); }
.activity-tabs button { background: transparent; border: 0; border-bottom: 2px solid transparent; min-height: 34px; padding: 3px 0 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.activity-tabs button[aria-selected="true"] { color: var(--violet-dark); border-color: var(--violet); }
.activity-tabs span { background: var(--paper); border-radius: 5px; padding: 2px 5px; margin-left: 2px; font: 550 10px/1 var(--mono); }
.table-scroll { overflow: auto; }
.activity-table { width: 100%; border-collapse: collapse; white-space: nowrap; font-size: 12px; }
.activity-table th, .activity-table td { padding: 8px 13px; text-align: left; border-bottom: 1px solid var(--rule); }
.activity-table th { color: var(--muted); font-size: 11px; font-weight: 650; background: #faf9fd; }
.activity-table tbody tr:last-child td { border-bottom: 0; }
.activity-table td.numeric { font-family: var(--mono); }
.activity-table .button { min-height: 29px; padding: 4px 7px; font-size: 11px; }
.activity-table .button + .button { margin-left: 5px; }
.empty-activity { min-height: 97px; display: grid; justify-items: center; align-content: center; gap: 2px; text-align: center; padding: 12px; color: var(--muted); font-size: 12px; }
.empty-activity b { color: var(--ink); font-size: 13px; }
.page-footer { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 10px; padding: 13px 0; }

dialog { width: min(100% - 32px, 400px); padding: 0; border: 1px solid var(--rule); border-radius: 11px; background: var(--surface); color: var(--ink); box-shadow: 0 24px 75px #23184635; }
dialog::backdrop { background: #23184655; }
#dialog-form { display: grid; gap: 13px; padding: 16px; }
#dialog-form header, #dialog-form footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#dialog-form footer { justify-content: flex-end; }
#dialog-detail { color: var(--muted); font-size: 13px; }
#dialog-fields:empty { display: none; }
.close-button { display: grid; place-items: center; width: 28px; height: 28px; flex: none; border: 0; border-radius: 5px; background: transparent; color: inherit; font: 500 21px/1 var(--sans); }
.close-button:hover { background: #81759816; }

@media (max-width: 1130px) {
  .topbar-inner, .workspace { width: calc(100% - 38px); }
  .terminal-grid { grid-template-columns: minmax(215px, 1fr) minmax(0, 2.25fr) minmax(222px, 1fr); gap: 10px; }
}
@media (max-width: 920px) {
  .terminal-grid { grid-template-columns: minmax(210px, 1fr) minmax(0, 2.3fr); }
  .order-panel { grid-column: 1 / -1; }
  #order-form { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; }
  #order-form .inline-error { grid-column: 1 / -1; }
}
@media (max-width: 620px) {
  .topbar-inner, .workspace { width: calc(100% - 24px); }
  .topbar-inner { min-height: 56px; gap: 7px; }
  .topbar-divider, .topbar-label { display: none; }
  .brand { font-size: 22px; }
  .brand-mark { width: 25px; height: 25px; margin-right: 6px; }
  .session { gap: 6px; }
  .session .button { padding-inline: 8px; }
  .workspace { padding-top: 20px; }
  .workspace-header { align-items: flex-start; flex-direction: column; margin-bottom: 14px; }
  .feed-controls { flex-wrap: wrap; gap: 6px; }
  .account-stats { grid-template-columns: repeat(6, minmax(0, 1fr)); margin-bottom: 10px; }
  .account-stats div { grid-column: span 2; padding: 7px 8px; }
  .account-stats div:nth-child(n+4) { grid-column: span 3; border-top: 1px solid var(--rule); }
  .account-stats div:nth-child(4) { border-left: 0; }
  .account-stats dd { font-size: 14px; }
  .terminal-grid { grid-template-columns: minmax(0, 1fr); }
  #order-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #order-form .field-pair, #order-form .order-submit { grid-column: 1 / -1; }
  .watchlist { max-height: 160px; }
  .watch-row { min-height: 39px; padding-block: 6px; }
  .watch-labels, .watch-row { grid-template-columns: minmax(0, 1fr) minmax(65px, auto) minmax(65px, auto); }
  .row-price { font-size: 11px; }
  .plot { min-height: 245px; }
  .activity-panel { margin-top: 10px; }
}
@media (max-width: 350px) {
  .brand { font-size: 19px; }
  .brand-mark { width: 22px; height: 22px; margin-right: 5px; }
  .session .feed-state, .session .account-mode, .session .button { font-size: 10px; padding-inline: 5px; }
  #order-form { grid-template-columns: minmax(0, 1fr); }
  .speed-label { width: 100%; }
}

.account-mode { padding: 5px 9px; border: 1px solid var(--rule); border-radius: 6px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.watch-spread { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 10px 13px; border-top: 1px solid var(--rule); color: var(--muted); font-size: 11px; }
.watch-spread strong { color: var(--ink); font: 600 11px/1.3 var(--mono); }
.dialog-field-stack { display: grid; gap: 8px; }

.activity-tabs { flex-wrap: wrap; column-gap: clamp(9px, 3vw, 16px); row-gap: 0; }
.history-footer { border-top: 1px solid var(--rule); padding: 9px 13px; display: flex; justify-content: space-between; gap: 10px; align-items: center; color: var(--muted); font-size: 12px; }
.history-footer [role="status"] { overflow-wrap: anywhere; }
.table-scroll:focus-visible { outline-offset: -2px; }
.button[aria-disabled="true"] { opacity: .64; cursor: default; }

.account-report { padding: 15px; }
.report-header, .report-curve > header { display: flex; align-items: center; justify-content: space-between; gap: 8px 14px; flex-wrap: wrap; }
.account-report h3, .account-report h4 { margin: 0; font: 700 14px/1.25 var(--display); }
.account-report h3 { font-size: 17px; letter-spacing: -.025em; }
.report-status { margin-top: 7px; color: var(--muted); font-size: 12px; }
.report-status.error { color: var(--down); }
.report-headlines, .report-layout { display: grid; gap: 12px; margin-top: 13px; }
.report-headlines { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border: 1px solid var(--rule); border-radius: 8px; background: var(--violet-wash); }
.report-headlines > div { padding: 10px 13px; min-width: 0; }
.report-headlines > div + div { border-left: 1px solid #e2d9fa; }
.report-headlines dt, .curve-readout dt { color: var(--muted); font-size: 11px; }
.report-headlines dd { font: 650 clamp(12px, 2vw, 22px)/1.45 var(--mono); overflow-wrap: anywhere; letter-spacing: -.055em; }
.report-layout { grid-template-columns: minmax(0, 1.9fr) minmax(265px, 1fr); }
.report-curve, .report-breakdown > section { border: 1px solid var(--rule); border-radius: 8px; min-width: 0; }
.report-curve > header, .report-breakdown h4 { padding: 10px 12px; border-bottom: 1px solid var(--rule); }
.curve-legend { display: flex; flex-wrap: wrap; gap: 8px 12px; font-size: 11px; color: var(--muted); }
.curve-key { display: inline-flex; align-items: center; gap: 4px; }
.curve-key::before { content: ""; width: 12px; border-top: 2px solid var(--key-color); }
.balance-key { --key-color: #55467d; }
.balance-key::before { border-top-style: dashed; }
.equity-key { --key-color: var(--violet); }
.margin-key { --key-color: var(--up); }
#report-chart { display: block; width: 100%; height: clamp(245px, 23vw, 320px); cursor: crosshair; }
.curve-inspector { padding: 8px 12px; border-block: 1px solid var(--rule); display: grid; grid-template-columns: auto minmax(45px, 1fr) auto; align-items: center; gap: 7px 9px; color: var(--muted); font-size: 11px; }
.curve-inspector label { font-weight: 700; }
.curve-inspector input { padding: 0; width: 100%; accent-color: var(--violet); }
.curve-inspector time { font: 550 11px/1.4 var(--mono); }
.curve-readout { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-column: 1 / -1; gap: 7px; }
.curve-readout dd { color: var(--ink); font: 600 11px/1.5 var(--mono); overflow-wrap: anywhere; }
.curve-note, #curve-empty { padding: 8px 12px; color: var(--muted); font-size: 11px; }
.report-breakdown { display: grid; gap: 10px; }
.report-metrics { padding: 3px 12px; }
.report-metrics > div { display: flex; justify-content: space-between; gap: 7px 12px; padding: 5px 0; font-size: 12px; }
.report-metrics > div + div { border-top: 1px solid var(--rule); }
.report-metrics dt { color: var(--muted); }
.report-metrics dd { text-align: right; font: 600 12px/1.45 var(--mono); overflow-wrap: anywhere; }

@media (max-width: 740px) {
  .report-layout { grid-template-columns: minmax(0, 1fr); }
  .report-breakdown { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .account-report { padding: 11px; }
  .report-headlines > div { padding: 7px; }
  .report-breakdown { grid-template-columns: minmax(0, 1fr); }
  #report-chart { height: 205px; }
  .curve-inspector { grid-template-columns: auto minmax(45px, 1fr); }
  .curve-inspector time { grid-column: 1 / -1; }
}
#history-table .table-scroll { max-height: 420px; }
#history-table th { position: sticky; top: 0; }

#expert-button i { width: 6px; height: 6px; border-radius: 50%; background: var(--up); }
#expert-button i.stopped { background: var(--down); }
#expert-dialog { width: min(100% - 26px, 900px); max-height: calc(100dvh - 26px); }
.expert-header, .expert-journal > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.expert-header { padding: 13px 15px; border-bottom: 1px solid var(--rule); }
.expert-header p { color: var(--muted); font-size: 12px; margin-top: 3px; }
.expert-layout { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); }
#expert-form, .expert-journal { padding: 13px 15px; min-width: 0; }
#expert-form { display: grid; gap: 8px; }
.expert-state, .journal-status, #expert-validation-status { color: var(--muted); font-size: 12px; }
.expert-state { background: var(--violet-wash); padding: 7px 9px; border-radius: 6px; overflow-wrap: anywhere; }
.expert-settings { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: 8px; align-items: start; }
#expert-form textarea { width: 100%; min-width: 0; resize: vertical; border: 1px solid #ded8ec; border-radius: 7px; background: #faf9fd; color: var(--ink); padding: 8px 9px; font: 500 12px/1.5 var(--mono); }
#expert-source { min-height: 155px; tab-size: 2; white-space: pre; }
#expert-inputs { min-height: 35px; }
.expert-source-tools, .expert-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.expert-source-tools { justify-content: space-between; }
.expert-actions { justify-content: flex-end; }
.expert-diagnostics { margin: 5px 0 0; padding-left: 18px; max-height: 120px; overflow: auto; font-size: 12px; overflow-wrap: anywhere; }
.expert-diagnostics li + li { margin-top: 3px; }
.expert-journal { min-width: 0; border-left: 1px solid var(--rule); background: #faf9fd; }
.expert-journal h3 { font: 700 14px/1.25 var(--display); margin: 0; }
.journal-status { margin-top: 7px; }
.journal-entries { padding: 0; margin: 6px 0 0; list-style: none; max-height: 400px; overflow: auto; }
.journal-entries li { padding: 7px 3px; border-bottom: 1px solid var(--rule); font-size: 12px; overflow-wrap: anywhere; }
.journal-entries li span { display: block; color: var(--muted); font: 500 10px/1.35 var(--mono); }
.journal-entries li p { white-space: pre-wrap; }
@media (max-width: 650px) {
  .expert-layout { grid-template-columns: minmax(0, 1fr); }
  .expert-journal { border-left: 0; border-top: 1px solid var(--rule); }
  .journal-entries { max-height: 225px; }
}
@media (max-width: 350px) {
  .expert-header, #expert-form, .expert-journal { padding-inline: 10px; }
  .expert-settings { grid-template-columns: minmax(0, 1fr); }
}
.order-sides small { color: var(--muted); font-size: 10px; }

.feed-controls { flex-wrap: wrap; justify-content: flex-end; }
#indicator-button { min-height: 31px; font-size: 11px; padding: 3px 8px; }
.indicator-info { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 11px; padding: 7px 13px; border-top: 1px solid var(--rule); font-size: 11px; color: var(--muted); }
.indicator-info > strong { color: var(--ink); }
.indicator-info .curve-legend { margin-left: auto; }
.plot.has-indicator-pane { min-height: 350px; }
.indicator-fields { padding: 13px 15px; }

#tester-dialog { width: min(100% - 26px, 1150px); max-height: calc(100dvh - 26px); }
#tester-dialog > .expert-header { position: sticky; top: 0; z-index: 2; background: var(--surface); }
.tester-layout { display: grid; grid-template-columns: minmax(290px, 1fr) minmax(0, 1.65fr); }
#tester-form, .tester-result { padding: 14px 15px; min-width: 0; }
#tester-form, .tester-stack { display: grid; align-content: start; gap: 9px; }
#tester-form textarea { width: 100%; min-width: 0; resize: vertical; border: 1px solid #ded8ec; border-radius: 7px; background: #faf9fd; color: var(--ink); padding: 8px 9px; font: 500 12px/1.5 var(--mono); }
.tester-source-tools { display: flex; flex-wrap: wrap; gap: 6px 9px; align-items: center; }
.tester-hint { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.tester-visualize { display: inline-flex; align-items: center; gap: 7px; justify-self: start; min-height: 26px; cursor: pointer; font-weight: 650; }
.tester-visualize input { margin: 0; accent-color: var(--violet); }
#tester-visualize-hint { margin-top: -7px; }
.tester-result { border-left: 1px solid var(--rule); background: #faf9fd; }
.tester-result h3, .tester-result h4 { margin: 0; font: 700 14px/1.25 var(--display); }
#tester-status { margin-top: 6px; }
.tester-metrics > div:nth-child(n+4) { border-top: 1px solid #e2d9fa; }
.tester-metrics > div:nth-child(4) { border-left: 0; }
.tester-metrics > .tester-custom-score { grid-column: 1 / -1; border-left: 0; }
.tester-curve { margin-top: 11px; background: var(--surface); }
.tester-canvas { display: block; width: 100%; height: 205px; cursor: crosshair; }
.tester-curve .curve-readout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.report-curve > .tester-playback-header { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 5px 12px; }
.tester-fill-key { display: inline-flex; align-items: center; gap: 4px; }
.tester-fill-key::before { content: ""; border: 4px solid transparent; }
.tester-buy-key::before { border-top: 0; border-bottom: 7px solid var(--up); }
.tester-sell-key::before { border-bottom: 0; border-top: 7px solid var(--down); }
.tester-playback-canvas { display: block; width: 100%; height: 205px; }
.tester-transport { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 5px 12px; padding: 0 12px 8px; }
.tester-transport [data-playback-play] { min-width: 62px; }
.tester-playback-speed { display: inline-flex; align-items: center; gap: 5px; min-height: 36px; color: var(--muted); font-size: 11px; }
.tester-playback-speed select { min-height: 30px; padding: 4px; }
.tester-playback-inspector { grid-template-columns: auto minmax(45px, 1fr); }
.tester-playback-times { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.tester-playback-times time { color: var(--ink); }
.tester-playback-inspector .curve-readout { grid-template-columns: repeat(auto-fit, minmax(min(100%, 70px), 1fr)); }
.tester-playback-fills { display: grid; gap: 5px; padding: 8px 12px 10px; }
.tester-playback-fills .table-scroll { border: 1px solid var(--rule); border-radius: 6px; }
[data-playback-report-note] { border-top: 1px solid var(--rule); }
.tester-records-header { display: flex; flex-wrap: wrap; align-items: end; gap: 7px 13px; margin: 11px 0 7px; }
.tester-records-header .tester-hint { padding-bottom: 5px; }
#tester-records .table-scroll { max-height: 300px; border: 1px solid var(--rule); background: var(--surface); border-radius: 6px; }
#tester-records th { position: sticky; top: 0; }
#tester-records td.log-message { white-space: pre-wrap; min-width: 160px; max-width: 400px; overflow-wrap: anywhere; }
#tester-more { margin-top: 7px; }
@media (max-width: 720px) {
  .tester-layout { grid-template-columns: minmax(0, 1fr); }
  .tester-result { border-left: 0; border-top: 1px solid var(--rule); }
}
@media (max-width: 620px) {
  .feed-controls { justify-content: flex-start; }
}
@media (max-width: 350px) {
  #tester-form, .tester-result { padding-inline: 10px; }
  .tester-metrics > div { padding-inline: 6px; }
}

.expert-projects { min-width: 0; border: 1px solid var(--rule); border-radius: 7px; background: #faf9fd; }
.expert-projects > summary { min-height: 36px; padding: 8px; cursor: pointer; font-size: 12px; overflow-wrap: anywhere; }
#project-summary { color: var(--muted); font: 550 11px/1.35 var(--mono); margin-left: 7px; }
.project-fields { padding: 8px; border-top: 1px solid var(--rule); display: grid; gap: 7px; }
.project-picker { min-width: 0; display: flex; align-items: flex-end; gap: 5px; }
.project-picker > .field { flex: 1; }
.project-picker select { text-overflow: ellipsis; }
.project-save-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.project-fields .button { min-height: 35px; padding-inline: 8px; }
#project-status.error { color: var(--down); }
.project-confirmation { border: 1px solid #ded8ec; border-radius: 6px; padding: 8px; display: grid; gap: 6px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }

.tester-optimization, .tester-job { border-top: 1px solid var(--rule); padding-top: 12px; margin-top: 12px; }
.tester-optimization > summary { color: var(--violet-dark); cursor: pointer; font-weight: 700; }
.tester-optimization > .field, .tester-optimization > .tester-hint, .tester-optimization > .button { margin-top: 9px; }
#tester-genetic-options { display: grid; gap: 6px; margin-top: 9px; }
#tester-symbol-options, #tester-additional-symbol-options { min-width: 0; margin: 0; padding: 7px 9px; border: 1px solid var(--rule); border-radius: 7px; }
#tester-symbol-options { margin-top: 9px; }
:is(#tester-symbol-options, #tester-additional-symbol-options) legend { color: var(--muted); font-size: 11px; font-weight: 700; }
#tester-symbol-choices, #tester-additional-symbol-choices { display: flex; flex-wrap: wrap; gap: 4px 12px; }
:is(#tester-symbol-choices, #tester-additional-symbol-choices) label { display: inline-flex; align-items: center; gap: 5px; min-height: 26px; cursor: pointer; font: 600 12px var(--mono); }
:is(#tester-symbol-choices, #tester-additional-symbol-choices) input { margin: 0; accent-color: var(--violet); }
#tester-symbol-hint, #tester-additional-symbol-hint { margin-top: 5px; }
#tester-commission-rule, #tester-commission-tiers, .tester-commission-tier { min-width: 0; margin: 0; padding: 8px; border: 1px solid var(--rule); border-radius: 7px; }
#tester-commission-rule, #tester-commission-tiers { margin-top: 10px; }
#tester-commission-tiers legend { color: var(--muted); font-size: 11px; font-weight: 700; }
#tester-commission-tiers > .tester-source-tools { margin-top: 8px; }
.tester-commission-tier > button { justify-self: start; }
#tester-trading-limits-fields, #tester-blocked-sessions, .tester-blocked-session { min-width: 0; margin: 0; padding: 8px; border: 1px solid var(--rule); border-radius: 7px; }
#tester-trading-limits-fields { margin-top: 10px; }
#tester-blocked-sessions legend { color: var(--muted); font-size: 11px; font-weight: 700; }
.tester-blocked-session > button { justify-self: start; }
#tester-symbol-spec-fields { min-width: 0; margin: 9px 0 0; padding: 0; border: 0; }
.tester-job > header { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.tester-job progress { display: block; width: 100%; accent-color: var(--violet); margin: 7px 0; }
.tester-job pre { max-height: 14rem; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
