:root {
  color-scheme: light dark;
  --canvas: #f5f5f7;
  --paper: #ffffff;
  --ink: #1d1d1f;
  --muted: #626268;
  --rule: #e4e4e9;
  --blue: #0066cc;
  --plot: #ebebef;
  --surface: #f5f5f7;
  --selection: #e8f1fc;
  --shadow: 0 2px 8px #1d1d1f04, 0 14px 40px #1d1d1f05;
  --chart-grid: #f0f0f3;
  --order-pending: #a7afbf;
  --order-open: #3865cb;
  --order-filled: #23946a;
  --order-partial: #d9a52b;
  --order-rearmed: #8c60c9;
  color: var(--ink);
  background: var(--canvas);
  font: 100%/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 76px; }
[hidden] { display: none !important; }
body { display: grid; grid-template-columns: var(--sidebar-width, 216px) minmax(0, 1fr); margin: 0; }
.dashboard-content { min-width: 0; }
.dashboard-sidebar { position: sticky; top: 0; align-self: start; min-height: 100dvh; background: #ebebeff2; color: #424247; border-right: 1px solid #dcdce3; backdrop-filter: blur(24px) saturate(150%); }
.dashboard-nav { display: grid; gap: 5px; padding: 26px 12px; }
.dashboard-nav a { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 7px; color: inherit; text-decoration: none; white-space: nowrap; }
.dashboard-nav a:hover, .dashboard-nav a:focus-visible { background: #1d1d1f07; }
.dashboard-nav a[aria-current] { background: #0071e3; color: #fff; box-shadow: 0 2px 5px #0071e321; }
.dashboard-nav svg { width: 19px; height: 19px; flex: none; }
.dashboard-nav-group { margin-top: 24px; }
.dashboard-nav-group > span { display: block; padding: 0 10px 9px; color: #727279; font-size: .72rem; font-weight: 600; letter-spacing: .035em; text-transform: uppercase; }
.dashboard-nav-parent { display: flex; align-items: center; gap: 4px; padding-right: 4px; border-radius: 7px; }
.dashboard-nav-parent:has(> a[aria-current]) { background: #0071e3; color: #fff; box-shadow: 0 2px 5px #0071e321; }
.dashboard-nav-parent > a[aria-current] { background: transparent; box-shadow: none; }
.dashboard-nav-parent > a:first-child { flex: 1; }
.dashboard-nav .dashboard-nav-add { justify-content: center; flex: none; width: 30px; height: 30px; padding: 0; }
.dashboard-nav-add svg { width: 16px; height: 16px; }
#dca-bot-children { display: grid; gap: 3px; margin: 9px 0 0 19px; padding: 0 0 0 8px; border-left: 1px solid #ceced6; list-style: none; }
#dca-bot-children li { min-width: 0; }
#dca-bot-children button { display: block; width: 100%; padding: 6px 7px; overflow: hidden; border: 0; border-radius: 6px; background: transparent; color: inherit; font: inherit; font-size: .82rem; text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
#dca-bot-children button:is(:hover, :focus-visible) { background: #1d1d1f07; }
#dca-bot-children button[aria-current] { background: #dce7f5; color: #004c99; font-weight: 600; }
#config, #account-panel, #bots-panel, #exchange-account, #bot-details { scroll-margin-top: 90px; }
#bot-details { padding: 24px; border: 1px solid var(--rule); border-radius: 18px; background: var(--paper); box-shadow: var(--shadow); }
#bot-details h1 { overflow-wrap: anywhere; font-size: 1.2rem; line-height: 1.4; letter-spacing: -.025em; }
#bot-details-settings section + section { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--rule); }
#bot-details-settings h2 { margin: 0 0 12px; color: var(--ink); font-size: .86rem; font-weight: 650; }
#bot-details-settings dl { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 7px 10px; margin: 0; font-size: .85rem; }
#bot-details-settings dt { color: var(--muted); }
#bot-details-settings dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
@media (max-width: 960px) {
  body { display: block; }
  .dashboard-sidebar { position: static; min-height: 0; }
  .dashboard-nav { display: flex; flex-wrap: wrap; align-items: end; padding: 8px; }
  .dashboard-nav-group { max-width: 100%; margin: 0; }
  .dashboard-nav-group > span { padding-bottom: 0; }
}
header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px clamp(20px, 2.4vw, 40px);
  border-bottom: 1px solid #e4e4e980;
  background: #fafafbd9;
}
body > .dashboard-content > header { position: sticky; top: 0; z-index: 8; min-height: 70px; backdrop-filter: blur(22px) saturate(160%); }
header strong { display: flex; align-items: center; gap: 10px; font-size: 1.15rem; }
.brand-mark { display: block; width: auto; height: 34px; image-rendering: pixelated; }
.demo-badge { padding: 4px 10px; border: 1px solid var(--rule); border-radius: 999px; color: var(--muted); font-size: .85rem; }
.dashboard-header-actions { display: flex; align-items: center; gap: 10px; }
.dashboard-logout { margin: 0; padding: 0; border: 0; background: transparent; box-shadow: none; }
.dashboard-logout button { padding: 4px 10px; border: 1px solid var(--rule); border-radius: 7px; background: var(--paper); color: var(--ink); font: inherit; cursor: pointer; }
body.auth-page { display: block; }
.auth-layout { display: grid; grid-template-columns: minmax(0, 390px); justify-content: center; align-content: center; min-height: 100vh; }
.auth-card { padding: clamp(18px, 5vw, 28px); }
.auth-brand { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; font-weight: 650; }
.auth-brand .brand-mark { height: 64px; }
.auth-card button { width: 100%; padding: 10px; border: 0; border-radius: 7px; background: var(--blue); color: white; font: inherit; font-weight: 600; cursor: pointer; }
.standalone-notice { padding: 10px clamp(14px, 4vw, 58px); border-bottom: 1px solid var(--rule); background: var(--paper); color: var(--muted); font-size: .87rem; }
.standalone-notice a { margin-left: 5px; color: var(--blue); }
main {
  display: grid;
  grid-template-columns: minmax(290px, 320px) minmax(0, 1fr);
  gap: 24px;
  max-width: 1920px;
  margin: auto;
  padding: clamp(20px, 2.4vw, 40px);
  align-items: start;
}
#panel-resize {
  position: absolute;
  inset: 0 0 0 auto;
  width: 10px;
  cursor: col-resize;
  touch-action: none;
}
#panel-resize::after {
  content: "";
  position: absolute;
  inset: 0 0 0 auto;
  width: 2px;
  border-radius: 2px;
  background: #d1d1d8;
}
#panel-resize:is(:hover, :focus-visible, :active)::after { background: var(--blue); }
@media (max-width: 960px) {
  #panel-resize { display: none; }
}
form, main > section { min-width: 0; }
main > section { container-type: inline-size; }
.chart-and-balance { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; gap: 12px; }
form { padding: 24px; border: 1px solid var(--rule); border-radius: 18px; background: var(--paper); box-shadow: var(--shadow); }
h1 { margin: 0 0 24px; font-size: 1.65rem; font-weight: 650; line-height: 1.2; letter-spacing: -.04em; }
fieldset { min-width: 0; margin: 0 0 13px; padding: 9px 0 2px; border: 0; border-bottom: 1px solid var(--rule); }
fieldset:last-of-type { margin-bottom: 0; border-bottom: 0; }
legend { padding: 0; color: var(--ink); font-size: .9rem; font-weight: 650; }
label { display: block; margin-bottom: 10px; color: var(--muted); font-size: .86rem; }
input, select {
  width: 100%;
  min-height: 42px;
  margin-top: 4px;
  padding: 7px 9px;
  border: 1px solid var(--rule);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-variant-numeric: tabular-nums;
}
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 10px; }
.text-field { display: flex; flex-direction: column; cursor: text; }
.text-field > input { min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; font-size: .94rem; }
.text-field:focus-within { border-color: #0071e3; outline: 3px solid #0071e326; outline-offset: 1px; background: var(--paper); }
.text-field > input:focus-visible { outline: none; }
.grid > .text-field > input { margin-top: auto; }
.field-label { display: block; margin-bottom: 4px; color: var(--muted); font-size: .86rem; }
.segmented { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px; margin-bottom: 14px; padding: 3px; border-radius: 10px; background: #ededf0; }
.segmented[data-field="direction"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.segmented button:disabled { opacity: .55; cursor: not-allowed; }
.segmented button {
  min-height: 36px;
  padding: 5px 6px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: .82rem;
  cursor: pointer;
}
.segmented button:hover { background: #ffffff60; }
.segmented button[aria-pressed="true"] { border-color: #00000008; background: var(--paper); color: var(--ink); box-shadow: 0 1px 4px #1d1d1f18; font-weight: 600; }
.available-balance { margin: -4px 0 10px; color: var(--blue); font-size: .83rem; font-variant-numeric: tabular-nums; }
.strategy-balance { margin: -3px 0 10px; padding: 6px 8px; border-radius: 6px; background: var(--canvas); color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.strategy-balance[data-state="sufficient"] { background: #e4f4ed; color: #08634d; }
.strategy-balance[data-state="insufficient"] { background: #fae9ee; color: #972942; }
.account-panel { display: flex; flex-direction: column; min-width: 0; max-width: 760px; margin: clamp(14px, 3vw, 40px) clamp(14px, 3vw, 48px); padding: 16px; border: 1px solid var(--rule); border-radius: 12px; background: var(--paper); }
.wallet-name-field { display: grid; margin-bottom: 16px; }
.account-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 8px; margin-bottom: 8px; }
.account-heading h2 { margin: 0; font-size: 1rem; }
.account-heading span { margin-left: auto; color: var(--muted); font-size: .82rem; }
.account-pnl { display: inline-flex; align-self: flex-start; flex-wrap: wrap; gap: 10px; padding: 6px 9px; border-radius: 7px; background: var(--canvas); font-size: .85rem; }
.account-assets-scroll { flex: 1 1 auto; min-height: 0; max-height: 19rem; margin-top: 8px; overflow: auto; }
.account-panel table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .85rem; font-variant-numeric: tabular-nums; }
.account-panel thead th { position: sticky; top: 0; z-index: 1; background: var(--paper); }
.account-totals { flex: none; padding-top: 6px; border-top: 1px solid var(--rule); }
.account-total { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 6px; padding: 3px 0; font-size: .8rem; font-variant-numeric: tabular-nums; }
.account-total-combined { margin-top: 4px; padding-top: 6px; border-top: 1px solid var(--rule); font-weight: 600; }
.account-panel :is(th, td) { padding: 6px 4px; border-bottom: 1px solid var(--rule); text-align: right; }
.account-panel :is(th, td):first-child { text-align: left; }
.account-panel small { display: block; color: var(--muted); }
.account-panel .field-help:empty { display: none; }
.balance-asset { display: inline-flex; align-items: center; gap: 6px; padding: 3px; border: 0; border-radius: 5px; background: transparent; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.balance-asset:hover { background: var(--canvas); color: var(--blue); }
.balance-asset-icon { display: grid; place-items: center; width: 23px; height: 23px; flex: none; overflow: hidden; border-radius: 50%; background: #e6edff; color: var(--blue); font-size: .58rem; }
.balance-asset-icon img { width: 100%; height: 100%; }
.market-picker { position: relative; margin-bottom: 10px; }
.text-field, .market-picker summary { padding: 10px 12px; border: 1px solid #e8e8ed; border-radius: 10px; background: var(--surface); color: var(--muted); font-size: .76rem; letter-spacing: .005em; }
.market-picker summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; list-style: none; }
.market-picker summary::-webkit-details-marker { display: none; }
.market-picker summary::after { content: ""; width: 6px; height: 6px; margin-right: 3px; border: solid var(--blue); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.market-picker[open] summary { border-color: var(--blue); }
.market-picker[open] summary::after { transform: rotate(225deg); }
.market-picker summary small { display: block; color: var(--ink); font-size: .94rem; }
.picker-panel { position: absolute; z-index: 10; top: calc(100% + 6px); inset-inline: 0; padding: 6px; border: 1px solid #ffffffc0; border-radius: 12px; background: #ffffffed; box-shadow: 0 8px 24px #1d1d1f15, 0 0 0 1px #1d1d1f09; backdrop-filter: blur(20px) saturate(150%); }
.picker-search { position: relative; display: block; margin: 0; }
.picker-search svg { position: absolute; width: 16px; height: 16px; top: 50%; left: 10px; transform: translateY(-50%); pointer-events: none; }
.picker-search input { min-width: 0; margin: 0; padding-left: 33px; }
.pair-columns, .pair-option { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 6px; }
.pair-columns { padding: 9px 7px 4px; color: var(--muted); font-size: .72rem; }
.pair-columns > :last-child, .pair-option > :last-child { text-align: right; }
.pair-sort-group { display: flex; align-items: center; gap: 2px; }
.pair-columns button { border: 0; padding: 2px 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.pair-columns button:hover { color: var(--ink); }
.sort-arrows { display: inline-flex; flex-direction: column; gap: 2px; margin-left: 3px; vertical-align: middle; }
.sort-arrows::before, .sort-arrows::after { content: ""; border-inline: 2px solid transparent; }
.sort-arrows::before { border-bottom: 3px solid #979eb5; }
.sort-arrows::after { border-top: 3px solid #979eb5; }
[data-direction="ascending"] .sort-arrows::before { border-bottom-color: #111; }
[data-direction="descending"] .sort-arrows::after { border-top-color: #111; }
.picker-options { max-height: min(340px, 42vh); overflow: auto; padding: 3px; }
.pair-option, .exchange-option { width: 100%; border: 0; border-radius: 5px; padding: 7px 5px; background: transparent; color: var(--ink); text-align: left; font: inherit; font-size: .8rem; font-variant-numeric: tabular-nums; cursor: pointer; }
.pair-option:hover, .exchange-option:hover, .picker-panel button[aria-current="true"] { background: var(--canvas); }
.pair-option span { min-width: 0; overflow-wrap: anywhere; }
.pair-option small { display: block; color: var(--muted); }
.pair-up { color: #007558; }
.pair-down { color: #ad3653; }
.field-help { margin: 0 0 10px; color: var(--muted); font-size: .83rem; }
.checkbox-field { display: flex; align-items: center; gap: 8px; }
.checkbox-field input { width: 16px; min-height: 0; height: 16px; margin: 0; accent-color: var(--blue); }
.switch-field { display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer; }
.switch-field input {
  appearance: none;
  display: grid;
  align-items: center;
  flex: none;
  width: 42px;
  min-height: 0;
  height: 24px;
  margin: 0;
  padding: 3px;
  border: 0;
  border-radius: 999px;
  background: #d1d1d6;
  cursor: pointer;
}
.switch-field input::before { content: ""; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px #00000026; transition: transform 150ms ease; }
.switch-field input:checked { background: #248a3d; }
.switch-field input:checked::before { transform: translateX(18px); }
.take-profit-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.take-profit-toolbar > span { font-size: .85rem; }
.take-profit { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr) 28px; align-items: center; gap: 6px; margin-bottom: 8px; padding: 6px; border: 1px solid var(--rule); border-radius: 9px; background: var(--canvas); }
.take-profit > strong { color: var(--blue); font-size: .8rem; white-space: nowrap; }
.take-profit .icon-button { width: 28px; height: 28px; }
.take-profit .text-field { min-width: 0; margin: 0; padding: 5px 6px; background: var(--paper); font-size: .76rem; }
.take-profit .text-field > span { white-space: nowrap; }
.icon-button { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid var(--rule); border-radius: 6px; background: var(--paper); color: var(--blue); cursor: pointer; }
.icon-button:hover { background: var(--canvas); }
.icon-button[data-remove] { color: #9a2540; }
.paper-cycle { margin-top: 18px; }
.bot-actions { margin-top: 16px; }
.bot-actions button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; padding: 10px 16px; border: 0; border-radius: 8px; font: inherit; cursor: pointer; }
#start-bot { width: 100%; color: white; background: #087dff; font-weight: 600; }
.bot-actions button:disabled { opacity: .5; cursor: not-allowed; }
.bot-actions button:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.bots-panel { margin: clamp(20px, 2.4vw, 40px); padding: 26px; background: var(--paper); border: 1px solid var(--rule); border-radius: 18px; box-shadow: var(--shadow); }
.bots-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.bots-heading h2 { margin: 0 12px 0 0; font-size: 1.65rem; font-weight: 650; letter-spacing: -.035em; }
.bots-tabs { display: flex; gap: 3px; padding: 3px; border: 1px solid #00000004; border-radius: 10px; background: #ededf0; }
.bots-tabs button { border: 0; border-radius: 6px; padding: 7px 10px; font: inherit; font-size: .83rem; color: var(--muted); background: transparent; cursor: pointer; }
.bots-tabs button[aria-selected="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 4px #1d1d1f18; font-weight: 600; }
.bots-tabs button span { margin-left: 4px; }
.bots-heading .market-picker { min-width: 130px; margin: 0; }
.bots-heading .market-picker summary { min-height: 44px; }
.bots-table { width: 100%; min-width: 1150px; border-collapse: collapse; font-size: .8rem; }
.bots-table th { color: var(--muted); font-weight: 400; text-align: left; }
.bots-table th, .bots-table td { padding: 18px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.bots-table small { display: block; margin-top: 4px; color: var(--muted); }
.bots-table .bot-name { font-weight: 600; }
.bots-table .bot-name a { color: var(--blue); text-underline-offset: 3px; }
.bot-status { display: inline-block; margin-top: 7px; padding: 3px 6px; border-radius: 5px; background: #fff0ce; color: #87600f; font-size: .72rem; }
.bot-status[data-state="stopped"] { background: #eceef3; color: var(--muted); }
.bot-resume-analysis { margin-top: 7px; font-size: .76rem; font-weight: 400; }
.bot-resume-analysis summary { color: var(--blue); cursor: pointer; }
.bot-resume-analysis p { margin: 5px 0; max-width: 340px; white-space: normal; }
.bot-direction { display: inline-block; margin-left: 5px; padding: 1px 5px; border-radius: 4px; background: #e5eaff; color: var(--blue); font-size: .72rem; }
.bot-actions-cell { display: flex; gap: 6px; }
.bot-actions-cell button { padding: 6px 8px; border: 1px solid var(--rule); border-radius: 6px; background: var(--paper); color: var(--blue); font: inherit; white-space: nowrap; cursor: pointer; }
.bot-actions-cell button:disabled { opacity: .5; cursor: not-allowed; }
.bot-actions-cell .bot-play { color: #087e68; background: #e5f5ee; border-color: #b6ddce; }
.bot-actions-cell .bot-play svg { display: block; fill: currentColor; }
.bot-actions-cell .bot-delete { color: #972942; }
#edit-bot-dialog { width: min(480px, calc(100% - 24px)); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid #ffffffc0; border-radius: 20px; background: #fafafaf2; color: var(--ink); box-shadow: 0 24px 100px #0000002b; backdrop-filter: blur(24px); }
#edit-bot-dialog::backdrop { background: #1d1d1f40; backdrop-filter: blur(4px); }
#edit-bot-form { display: flex; flex-direction: column; max-height: calc(100dvh - 28px); padding: 0; border: 0; }
#edit-bot-form header, #edit-bot-form footer { padding: 14px 16px; }
#edit-bot-form h2 { margin: 0; font-size: 1.15rem; }
#edit-bot-form header p { margin-bottom: 0; }
.edit-bot-fields { overflow: auto; padding: 4px 16px; }
.edit-bot-fields select { margin: 0; padding: 0; border: 0; background: transparent; font-size: .94rem; }
.edit-bot-fields .switch-field { margin: 8px 0; }
#edit-stop-loss { display: grid; gap: 8px; padding: 4px 0 0; border: 0; margin: 0; }
#edit-carry-settings { padding: 0; margin: 0; border: 0; }
.execution-table td small { display: block; color: var(--muted); }
#edit-bot-form [data-edit-error] { margin: 0; padding: 0 16px; }
#edit-bot-form [data-edit-error]:empty { display: none; }
#edit-bot-form footer { display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--rule); }
#edit-bot-form footer button { padding: 8px 16px; border: 1px solid var(--rule); border-radius: 7px; background: var(--paper); color: var(--ink); font: inherit; cursor: pointer; }
#edit-bot-form footer button[type="submit"] { background: var(--blue); color: white; }
#edit-bot-form footer button:disabled { opacity: .55; cursor: wait; }
.execution-history { margin-top: 24px; padding: 20px; border: 1px solid var(--rule); border-radius: 16px; background: var(--paper); box-shadow: var(--shadow); }
.history-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.history-tabs { display: inline-flex; padding: 3px; gap: 3px; border: 1px solid #00000004; border-radius: 10px; background: #ededf0; }
.history-tabs button { display: flex; align-items: center; gap: 5px; border: 0; border-radius: 9px; padding: 7px 10px; background: transparent; color: var(--muted); font: inherit; font-size: .82rem; cursor: pointer; }
.history-tabs button[aria-selected="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 4px #1d1d1f18; font-weight: 600; }
.history-tabs button span { padding: 1px 6px; border-radius: 9px; background: #e6e6eb; color: #56565e; font-size: .72rem; }
.history-tabs button:focus-visible { outline: 2px solid var(--blue); }
.history-sort { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: transparent; color: var(--muted); font: inherit; cursor: pointer; }
.history-sort span { color: #b8c0d5; font-size: .65rem; }
th[aria-sort="ascending"] .history-sort, th[aria-sort="descending"] .history-sort { color: #111; }
th[aria-sort="ascending"] .history-sort span, th[aria-sort="descending"] .history-sort span { color: #111; }
.execution-table td { white-space: nowrap; font-size: .8rem; padding: 9px 8px; }
.execution-table th { font-weight: 400; }
.execution-buy, .execution-positive { color: #147d45; }
.execution-sell, .execution-negative { color: #c43235; }
.execution-history h2 { margin: 0 0 12px; font-size: 1rem; }
.execution-totals { display: flex; flex-wrap: wrap; gap: 12px 24px; margin-bottom: 12px; color: var(--muted); font-size: .85rem; }
.execution-totals strong { margin-left: 6px; color: var(--ink); font-variant-numeric: tabular-nums; }
.history-pagination { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: .85rem; }
.history-pagination[hidden] { display: none; }
.history-pagination button { min-width: 30px; padding: 2px 8px; }
#history-cycle-net.execution-positive { color: var(--green, #087f61); }
#history-cycle-net.execution-negative { color: var(--red, #b22445); }
.execution-table { min-width: 850px; }
.execution-table th { white-space: nowrap; }
.execution-table .execution-empty { padding: 24px 8px; text-align: center; color: var(--muted); }
.paper-cycle button, .market-data-controls button { margin-bottom: 7px; padding: 7px 12px; border: 1px solid var(--rule); border-radius: 6px; background: var(--paper); color: var(--blue); font: inherit; cursor: pointer; }
.paper-cycle button:disabled, .market-data-controls button:disabled { opacity: .6; cursor: default; }
.market-data-controls { margin-bottom: 6px; color: var(--muted); font-size: .85rem; }
.summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px 24px; margin-bottom: 20px; padding: 24px; border: 1px solid var(--rule); border-radius: 18px; background: var(--paper); box-shadow: var(--shadow); }
.summary span { color: var(--muted); font-size: .85rem; }
.summary strong { display: block; margin-top: 5px; font-size: clamp(1.2rem, 1.55vw, 1.8rem); line-height: 1.25; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.04em; overflow-wrap: anywhere; }
.entry-execution-summary { grid-column: 1 / -1; min-width: 0; padding-top: 16px; border-top: 1px solid var(--rule); font-size: .85rem; font-variant-numeric: tabular-nums; }
.entry-execution-summary b { margin-left: 4px; }
.entry-execution-summary:not([hidden]) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 24px; }
.bot-return-metrics { font-variant-numeric: tabular-nums; }
.chart-panel { border: 1px solid var(--rule); border-radius: 10px; color: var(--ink); background: var(--paper); }
.chart-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; padding: 5px 8px; border-bottom: 1px solid var(--rule); }
.chart-heading h2 { margin: 0; font-size: 1rem; }
.chart-heading p, #chart-status { margin: 0; color: var(--muted); font-size: .79rem; }
#chart-status { padding: 20px 5px; }
#chart { height: clamp(280px, 49vh, 520px); position: relative; }
.chart-execution-tooltip { position: absolute; z-index: 5; pointer-events: none; padding: 7px 10px; border: 1px solid #dedfea; border-radius: 6px; background: #fbf9fc; color: #242536; box-shadow: 0 3px 12px #24253620; white-space: pre-line; font-size: .8rem; }
.chart-timeframe, .chart-indicators { margin: 0; }
.chart-timeframe { min-width: 70px; }
.chart-timeframe summary, .chart-indicators summary { padding: 4px 7px; }
.chart-timeframe summary small { display: inline; margin-left: 5px; }
.chart-indicators .picker-panel { min-width: 105px; padding: 8px; }
.chart-indicators .checkbox-field { margin-bottom: 3px; white-space: nowrap; }
.chart-plot { position: relative; min-width: 0; }
#chart-legend { position: absolute; z-index: 2; top: 8px; left: 8px; max-width: 80%; pointer-events: none; padding: 2px 4px; background: #ffffffdf; color: #087e68; font-size: .77rem; font-variant-numeric: tabular-nums; }
#chart-legend[data-direction="down"] { color: #b23650; }
.chart-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px; padding: 4px 6px; border-top: 1px solid var(--rule); }
.chart-footer > div { display: flex; flex-wrap: wrap; gap: 3px; }
.chart-heading > button, .chart-footer button { border: 1px solid transparent; border-radius: 5px; padding: 4px 6px; color: var(--ink); background: transparent; font: inherit; font-size: .8rem; cursor: pointer; }
.chart-heading > button:hover, .chart-footer button:hover, .chart-panel button[aria-pressed="true"] { background: var(--canvas); color: var(--blue); }
#chart-fullscreen { margin-left: auto; }
.chart-panel:fullscreen { display: flex; flex-direction: column; border-radius: 0; }
.chart-panel:fullscreen .chart-workspace { flex: 1; min-height: 0; }
.chart-panel:fullscreen :is(.chart-plot, #chart) { height: 100%; }
.chart-panel { overflow: clip; border: 1px solid var(--rule); border-radius: 16px; color: var(--ink); background: var(--paper); box-shadow: var(--shadow); }
.chart-heading { gap: 0; min-height: 44px; padding: 5px 8px; border-bottom: 1px solid var(--rule); background: #fafafb; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.chart-timeframe { min-width: auto; }
.chart-timeframe summary, .chart-indicators summary { padding: 3px 9px; border: 0; border-radius: 0; background: transparent; color: inherit; font-size: .87rem; }
.chart-timeframe summary::after, .chart-indicators summary::after { display: none; }
.chart-timeframe summary small { margin: 0; font-size: inherit; }
.chart-timeframe .picker-panel { min-width: 70px; }
.indicator-icon { font-size: 1.05rem; }
#chart-legend { top: 5px; background: #fbf9fcdd; font-size: .8rem; line-height: 1.55; }
#chart-history-status:not(:empty) { position: absolute; z-index: 3; top: 47px; left: 12px; padding: 4px 8px; background: var(--paper); color: var(--muted); font-size: .78rem; }
.chart-footer { padding: 3px 6px; border-top-color: #e4e0ed; }
.chart-footer > div { align-items: center; gap: 1px; }
.chart-symbol { display: flex; align-items: center; flex-wrap: wrap; font-size: .86rem; }
.chart-symbol span, .chart-indicators, #chart-type { border-left: 1px solid #e4e0ed; }
.chart-symbol span { padding: 1px 9px; }
#chart-fullscreen { margin-left: 0; }
#chart-reset { margin-left: auto; }
.chart-icon { display: grid; place-items: center; cursor: pointer; }
.chart-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
#chart-clock { padding: 0 7px; font-size: .76rem; font-variant-numeric: tabular-nums; }
.planned-levels { width: 100%; min-width: 1100px; margin-top: 0; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; background: var(--paper); }
.planned-levels-scroll { overflow-x: auto; margin-top: 20px; border: 1px solid var(--rule); border-radius: 14px; scrollbar-width: thin; }
.planned-levels caption { padding: 14px 16px; background: var(--paper); color: var(--muted); text-align: left; font-size: .82rem; }
.planned-levels :is(th, td) { padding: 12px 12px; border-bottom: 1px solid var(--rule); text-align: left; }
.planned-levels th { background: #f5f5f7; color: var(--muted); font-size: .73rem; line-height: 1.45; font-weight: 600; }
.planned-levels td { font-size: .82rem; white-space: nowrap; }
.planned-levels :is(th, td):first-child { min-width: 145px; }
.planned-levels .take-profit-column-heading th { border-top: 1px solid var(--rule); }
.planned-levels tr[data-funding="insufficient"] { color: #972942; background: #fae9ee; --level: #972942; }
.planned-levels tr[data-execution="pending"] { background: #f3f4f8; color: #697389; }
.planned-levels tr[data-execution="open"] { background: #e7efff; color: #2853a2; --level: #2853a2; }
.planned-levels tr[data-execution="filled"] { background: #e5f5ee; color: #146548; --level: #146548; }
.planned-levels tr[data-execution="partial"] { background: #fff4d8; color: #87600f; --level: #87600f; }
.planned-levels tr[data-execution="rearmed"] { background: #eee7fc; color: #6840a8; --level: #6840a8; }
.planned-levels tr[data-invalid="true"] { background: #fae1e7; color: #a22140; --level: #a22140; }
.order-state-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; color: var(--muted); font-size: .75rem; }
.order-state-legend > span::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 50%; background: var(--order-pending); }
.order-state-legend [data-execution="filled"]::before { background: var(--order-filled); }
.order-state-legend [data-execution="open"]::before { background: var(--order-open); }
.order-state-legend [data-execution="partial"]::before { background: var(--order-partial); }
.order-state-legend [data-execution="rearmed"]::before { background: var(--order-rearmed); }
.planned-levels :is(th, td):not(:first-child) { text-align: right; }
.planned-levels td:first-child::before { display: inline-block; width: 11px; margin-right: 7px; border-bottom: 2px dashed var(--level, #384d9f); content: ""; vertical-align: middle; }
[data-kind="entry"] { --level: #976300; }
[data-kind="tp"] { --level: #007558; }
[data-kind="stop"] { --level: #ad3653; }
#error, .field-error { margin: 0; color: #9a2540; }
.field-error:not(:empty) { margin-bottom: 10px; font-size: .83rem; }
button, a, summary { -webkit-tap-highlight-color: transparent; }
button, .dashboard-nav a, .market-picker summary { touch-action: manipulation; }
button { transition: background-color 120ms ease, color 120ms ease, box-shadow 120ms ease, transform 100ms ease; }
button:enabled:active { transform: scale(.97); }
.icon-button, .bot-actions-cell button { min-width: 34px; min-height: 34px; border-radius: 9px; }
.bots-table thead th, .execution-table thead th { background: #f5f5f7; color: var(--muted); font-size: .74rem; font-weight: 600; }
.bots-table tbody tr:hover, .execution-table tbody tr:hover { background: #f7f9fc; }
.bots-table tbody tr:last-child td, .planned-levels tbody tr:last-child td { border-bottom: 0; }
.bots-table .bot-name a { color: var(--ink); text-decoration: none; }
.bots-table .bot-name a:hover { color: var(--blue); }
.history-pagination button { border: 1px solid var(--rule); border-radius: 7px; min-height: 30px; background: var(--paper); color: var(--ink); cursor: pointer; }
.history-pagination button:disabled { opacity: .4; cursor: default; }
.account-panel { padding: 24px; border-radius: 18px; box-shadow: var(--shadow); }
.account-heading { margin-bottom: 16px; }
.account-heading h2 { font-size: 1.4rem; letter-spacing: -.025em; }
.account-panel :is(th, td) { padding: 12px 8px; }
.account-total { padding: 8px 0; font-size: .85rem; }
.entry-position-metrics, .bot-return-metrics { max-width: 420px; }
.entry-position-metrics > div, .bot-return-metrics > div { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.entry-execution-summary b { text-align: right; font-weight: 600; }
.chart-execution-tooltip { border-radius: 9px; background: #fffffff2; box-shadow: 0 4px 16px #1d1d1f12; }
.chart-symbol span, .chart-indicators, #chart-type { border-left-color: var(--rule); }
.chart-footer { padding: 7px 8px; border-top-color: var(--rule); background: #fafafb; }
#chart-legend { background: #ffffffed; }
.take-profit { background: var(--surface); border-color: #e8e8ed; border-radius: 12px; }
.order-state-legend { padding: 4px 2px; }
@media (hover: hover) {
  .bot-actions-cell button:hover, .icon-button:hover, .dashboard-logout button:hover { background: var(--selection); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
  button:enabled:active { transform: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .dashboard-sidebar { background: #ebebef; backdrop-filter: none; }
  body > .dashboard-content > header, .picker-panel, #edit-bot-dialog, .chart-execution-tooltip { background: #fafafb; backdrop-filter: none; }
  #edit-bot-dialog::backdrop { backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  :root { --muted: #3e3e44; --rule: #85858f; }
  .dashboard-sidebar, body > .dashboard-content > header, .picker-panel, #edit-bot-dialog { background: #fff; backdrop-filter: none; border-color: #85858f; }
  button, .text-field, .market-picker summary { border-color: #85858f; }
}
@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #151517;
    --paper: #202023;
    --surface: #2b2b30;
    --ink: #f2f2f5;
    --muted: #b0b0ba;
    --rule: #38383e;
    --blue: #69adff;
    --plot: #19191c;
    --selection: #253d5c;
    --shadow: 0 2px 8px #00000016, 0 14px 40px #00000018;
    --chart-grid: #2a2a2f;
  }
  .dashboard-sidebar { background: #1c1c20ed; color: #d4d4dc; border-color: var(--rule); }
  body > .dashboard-content > header { background: #1c1c20de; border-color: #38383e80; }
  .dashboard-nav a:hover, .dashboard-nav a:focus-visible,
  #dca-bot-children button:is(:hover, :focus-visible) { background: #ffffff0a; }
  .dashboard-nav a[aria-current], .dashboard-nav-parent:has(> a[aria-current]) { background: #066bd2; color: #fff; }
  .dashboard-nav-parent > a[aria-current] { background: transparent; }
  .dashboard-nav-group > span { color: #9595a2; }
  #dca-bot-children { border-left-color: #44444d; }
  #dca-bot-children button[aria-current] { background: #253d5c; color: #a1ceff; }
  #panel-resize::after { background: #3b3b43; }
  .text-field, .market-picker summary, .take-profit { background: var(--surface); border-color: #3a3a42; }
  .text-field:focus-within { background: var(--paper); }
  .segmented, .bots-tabs, .history-tabs { background: #151518; border-color: #ffffff08; }
  .segmented button:hover { background: #ffffff0a; }
  .segmented button[aria-pressed="true"], .bots-tabs button[aria-selected="true"],
  .history-tabs button[aria-selected="true"] { background: #414149; color: #fff; border-color: #ffffff12; }
  .history-tabs button span { background: #303038; color: #c5c5d1; }
  .picker-panel { background: #2a2a30f2; border-color: #ffffff12; box-shadow: 0 8px 28px #00000050; }
  .picker-panel button[aria-current="true"], .pair-option:hover, .exchange-option:hover { background: var(--selection); }
  .switch-field input { background: #505059; }
  .switch-field input:checked { background: #248a3d; }
  #start-bot, .auth-card button, #edit-bot-form footer button[type="submit"] { background: #0877e8; color: white; }
  #edit-bot-dialog { background: #242429f5; border-color: #ffffff14; }
  #edit-bot-dialog::backdrop { background: #00000080; }
  #edit-bot-form header { background: #242429d9; }
  .chart-heading, .chart-footer, .planned-levels th,
  .bots-table thead th, .execution-table thead th { background: #28282d; }
  #chart-legend { background: #202023ed; color: #65d3bb; }
  #chart-legend[data-direction="down"] { color: #ff919a; }
  .chart-execution-tooltip { background: #2b2b31f5; color: var(--ink); border-color: var(--rule); }
  .chart-footer, .chart-symbol span, .chart-indicators, #chart-type { border-color: var(--rule); }
  .chart-heading > button:hover, .chart-footer button:hover,
  .chart-panel button[aria-pressed="true"] { background: var(--selection); color: var(--blue); }
  .bots-table tbody tr:hover, .execution-table tbody tr:hover { background: #292d36; }
  .planned-levels tr[data-execution="pending"] { background: #24242a; color: #aaaab5; }
  .planned-levels tr[data-execution="open"] { background: #20364e; color: #a4caff; --level: #a4caff; }
  .planned-levels tr[data-execution="filled"] { background: #203c32; color: #92dbb5; --level: #92dbb5; }
  .planned-levels tr[data-execution="partial"] { background: #44391f; color: #ebce8b; --level: #ebce8b; }
  .planned-levels tr[data-execution="rearmed"] { background: #382b4e; color: #cfb0f5; --level: #cfb0f5; }
  .planned-levels tr[data-funding="insufficient"], .planned-levels tr[data-invalid="true"] {
    background: #46272f; color: #ffb0bd; --level: #ffb0bd;
  }
  .strategy-balance[data-state="sufficient"], .bot-actions-cell .bot-play { background: #203c32; color: #92dbb5; border-color: #375b4a; }
  .strategy-balance[data-state="insufficient"] { background: #46272f; color: #ffb0bd; }
  .bot-status { background: #44391f; color: #ebce8b; }
  .bot-status[data-state="stopped"] { background: #35353d; color: #bbbbc8; }
  .bot-direction, .balance-asset-icon { background: #293852; color: #a4caff; }
  .execution-buy, .execution-positive, .pair-up, #history-cycle-net.execution-positive { color: #77d6a0; }
  .execution-sell, .execution-negative, .pair-down, #history-cycle-net.execution-negative,
  #error, .field-error, .icon-button[data-remove], .bot-actions-cell .bot-delete { color: #ff939d; }
  th[aria-sort="ascending"] .history-sort, th[aria-sort="descending"] .history-sort,
  th[aria-sort="ascending"] .history-sort span, th[aria-sort="descending"] .history-sort span { color: var(--ink); }
}
@media (prefers-color-scheme: dark) and (prefers-reduced-transparency: reduce) {
  .dashboard-sidebar, body > .dashboard-content > header { background: #1c1c20; }
  .picker-panel, #edit-bot-dialog, #edit-bot-form header, .chart-execution-tooltip { background: #28282d; }
}
@media (prefers-color-scheme: dark) and (prefers-contrast: more) {
  :root { --ink: #fff; --muted: #d4d4dc; --rule: #82828d; }
  .dashboard-sidebar, body > .dashboard-content > header, .picker-panel, #edit-bot-dialog { background: #151517; border-color: var(--rule); }
  .text-field, .market-picker summary { border-color: var(--rule); }
}
@media (max-width: 960px) {
  #dca-bot-children { display: none; }
}
@container (max-width: 650px) {
  .summary { gap: 16px; padding: 18px; }
  .summary span { font-size: .74rem; }
  .summary strong { font-size: 1.2rem; }
  .entry-execution-summary:not([hidden]) { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  main { grid-template-columns: minmax(0, 1fr); }
  form { padding: 15px; }
  #chart { height: 310px; }
  .bots-panel, .account-panel { margin: 16px; padding: 18px; }
  .dashboard-nav { padding: 10px; gap: 4px; }
  .dashboard-nav-group { margin-top: 0; }
  .dashboard-nav-group > span, #dca-bot-children { display: none; }
  .summary { grid-template-columns: minmax(0, 1fr); }
  .summary > div:not(.entry-execution-summary) { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
  .summary strong { font-size: 1.35rem; }
  .dashboard-sidebar { min-height: 0; }
  body > .dashboard-content > header { flex-wrap: nowrap; gap: 8px; padding: 12px 16px; min-height: 62px; }
  header strong { gap: 8px; font-size: 1.05rem; }
  .brand-mark { height: 28px; }
  .dashboard-header-actions { gap: 6px; }
  .demo-badge { padding: 4px 8px; font-size: .72rem; }
  .dashboard-logout button { padding: 5px 8px; font-size: .78rem; }
  .auth-layout { margin: 16px; }
}

#chart-loading {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: clamp(12px, 3vh, 28px);
  padding: 20px;
  background: var(--paper);
  --galaga-candle: #465476;
}
#chart-loading[hidden] { display: none; }
#chart-loading .galaga-wordmark-candles {
  width: min(82%, 660px);
  height: 44%;
  flex: 0 1 auto;
  min-height: 0;
}
#chart-loading .galaga-candles {
  width: min(24%, 160px);
  height: 29%;
  flex: 0 1 auto;
  min-height: 0;
}
@media (prefers-color-scheme: dark) {
  #chart-loading { --galaga-candle: #edf3ff; }
}
.awaiting-market #chart-legend { visibility: hidden; }
.chart-footer { justify-content: flex-end; }
