:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #15213b;
  background: #f3f6fb;
  --ink: #15213b;
  --muted: #6b7891;
  --line: #dce4ef;
  --blue: #4169e1;
  --blue-dark: #2148b1;
  --green: #23845a;
  --red: #c13b3b;
  --amber: #9a6500;
  --navy: #10284e;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: #f3f6fb; }
body.plan-editor-open { overflow: hidden; }
button, input, select { font: inherit; }
button { cursor: pointer; }

.site-header {
  min-height: 68px;
  padding: 10px 28px;
  background: rgba(255,255,255,.96);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand > span { width: 40px; height: 40px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg,#4774ea,#55bec8); border-radius: 12px; font-size: 21px; font-weight: 900; box-shadow: 0 8px 18px #4169e12e; }
.brand b,.brand small { display: block; }
.brand b { font-size: 18px; line-height: 1.05; }
.brand small { color: #7b879b; letter-spacing: .12em; font-size: 9px; margin-top: 4px; }
.header-status { display: flex; align-items: center; gap: 9px; }
.console-nav { display: flex; align-items: center; gap: 6px; padding: 4px; background: #f1f4f9; border: 1px solid #e0e6ef; border-radius: 11px; }
.console-nav a { padding: 8px 12px; color: #5c6980; border-radius: 8px; font-size: 12px; font-weight: 850; text-decoration: none; }
.console-nav a.active,.console-nav a:hover { color: #244fb7; background: #fff; box-shadow: 0 2px 8px #18376612; }
.local-only,.runtime,.pill { font-size: 11px; font-weight: 800; letter-spacing: .03em; padding: 8px 11px; border-radius: 999px; }
.local-only { color: #66738a; background: #f4f6f9; border: 1px solid #e0e5ed; }
.runtime,.pill { color: #2e55bc; background: #edf3ff; border: 1px solid #d8e4ff; }
.pill.safe { color: #18724b; background: #ecf8f2; border-color: #c8ead8; }

main { width: min(1500px, calc(100% - 36px)); margin: 22px auto 70px; display: flex; flex-direction: column; }
.part-heading { margin: 24px 0 12px; padding: 14px 17px; display: flex; align-items: center; gap: 13px; background: #eaf0fb; border: 1px solid #d5e0f2; border-radius: 14px; }
.part-heading > span { width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center; color: #fff; background: #315ec9; border-radius: 11px; font-size: 17px; font-weight: 900; }
.part-heading p,.part-heading h2,.part-heading small { margin: 0; display: block; }
.part-heading p { color: #5271b5; font-size: 9px; font-weight: 900; letter-spacing: .13em; }
.part-heading h2 { margin-top: 2px; font-size: 18px; }
.part-heading small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.hero { order: 1; }
.warning { order: 2; }
.status-board { order: 0; }
.saved-plans-panel { order: 1; }
.execution-panel { order: 2; }
.positions-panel { order: 3; }
.activity-panel { order: 4; }
.slippage-panel { order: 5; }
.hero { min-height: 145px; display: flex; justify-content: space-between; align-items: center; gap: 30px; padding: 25px 30px; border-radius: 20px; color: #fff; background: linear-gradient(120deg,#112b55 0%,#17386c 72%,#1d4e89 100%); box-shadow: 0 18px 45px #1e31561f; }
.hero h1 { margin: 3px 0 6px; font-size: clamp(30px,4vw,48px); letter-spacing: -.035em; line-height: 1; }
.hero p:not(.eyebrow) { margin: 0; color: #c9d8ee; font-size: 15px; }
.eyebrow { margin: 0 0 5px !important; color: #4e78e8 !important; font-weight: 900; font-size: 10px; letter-spacing: .15em; }
.hero .eyebrow { color: #8db1ff !important; }
.engine-tile { min-width: 285px; padding: 17px 19px; background: #ffffff12; border: 1px solid #ffffff24; border-radius: 15px; display: grid; }
.engine-tile span { color: #a8bfdf; font-size: 10px; font-weight: 900; letter-spacing: .14em; }
.engine-tile b { margin-top: 2px; font-size: 27px; color: #7fe0ae; }
.engine-tile small { margin-top: 4px; color: #cbd8eb; }
.warning { margin: 14px 0; padding: 12px 16px; border-radius: 11px; background: #fff8df; border: 1px solid #ecd06d; color: #755c00; font-size: 13px; font-weight: 750; }

.status-board { position: sticky; top: var(--console-header-height,68px); z-index: 9; display: grid; grid-template-columns: repeat(7,minmax(165px,1fr)); gap: 10px; margin: 0 0 14px; padding: 8px; overflow-x: auto; background: rgba(243,246,251,.96); border: 1px solid #dce4ef; border-radius: 15px; box-shadow: 0 10px 28px #1427441a; backdrop-filter: blur(12px); scrollbar-width: thin; }
.status-card { min-height: 76px; padding: 14px 16px; display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 8px 24px #23395908; }
.status-card.connection-launch { width: 100%; color: var(--ink); text-align: left; appearance: none; transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease; }
.status-card.connection-launch:hover { border-color: #9db3eb; box-shadow: 0 10px 26px #294d9a1c; transform: translateY(-1px); }
.status-card.connection-launch:focus-visible { outline: 3px solid #b9cbfb; outline-offset: 2px; }
.status-card .status-dot { width: 11px; height: 11px; flex: 0 0 auto; border-radius: 999px; background: #aab3c1; box-shadow: 0 0 0 5px #eef1f5; }
.status-card small,.status-card b { display: block; }
.status-card small { color: #7b879b; font-size: 9px; font-weight: 900; letter-spacing: .09em; }
.status-card b { margin-top: 3px; font-size: 13px; }
.status-card em { display: block; margin-top: 2px; color: #8a95a6; font-size: 8px; font-style: normal; }
.status-card[data-state="ready"] .status-dot { background: #2b9a68; box-shadow: 0 0 0 5px #e5f5ed; }
.status-card[data-state="ready"] b { color: #237e57; }
.status-card[data-state="configured"] .status-dot { background: #d19523; box-shadow: 0 0 0 5px #fff4dc; }
.status-card[data-state="configured"] b { color: #8c620d; }
.status-card[data-state="blocked"] .status-dot { background: #d64a4a; box-shadow: 0 0 0 5px #fdeaea; }
.status-card[data-state="blocked"] b { color: #b43737; }
.status-card[data-state="positive"] .status-dot { background: #2b9a68; box-shadow: 0 0 0 5px #e5f5ed; }
.status-card[data-state="positive"] b { color: #17825a; }
.status-card[data-state="negative"] .status-dot { background: #d64a4a; box-shadow: 0 0 0 5px #fdeaea; }
.status-card[data-state="negative"] b { color: #c53b45; }
.status-card[data-state="cost"] .status-dot { background: #d19523; box-shadow: 0 0 0 5px #fff4dc; }
.status-card[data-state="cost"] b { color: #8c620d; }

/* Trade Book: isolated manual order and position control. */
.trade-book-main { width: min(1780px,calc(100% - 34px)); gap: 14px; }
.trade-book-hero { padding: 24px 28px; display: flex; align-items: center; justify-content: space-between; gap: 20px; color: #fff; background: linear-gradient(120deg,#10284e,#1d477e); border-radius: 19px; }
.trade-book-hero h1,.trade-book-hero p { margin: 0; }
.trade-book-hero h1 { font-size: 38px; }
.trade-book-hero p:not(.eyebrow) { margin-top: 6px; color: #cbd9ec; }
.trade-book-hero button { padding: 10px 18px; color: #163d77; background: #fff; border: 0; border-radius: 10px; font-weight: 850; }
.trade-summary { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 10px; }
.trade-filter { padding: 14px 17px; display: flex; justify-content: space-between; align-items: center; color: #66738a; background: #fff; border: 1px solid var(--line); border-radius: 13px; }
.trade-filter small { font-size: 10px; font-weight: 900; letter-spacing: .09em; }
.trade-filter b { font-size: 23px; color: var(--ink); }
.trade-filter.active { color: #2756c4; border-color: #7d9df0; box-shadow: 0 0 0 2px #dfe8ff; }
.trade-filter.rejected b { color: var(--red); }
.trade-safety-note { padding: 12px 16px; display: flex; gap: 12px; align-items: baseline; color: #745400; background: #fff8df; border: 1px solid #efd67d; border-radius: 11px; font-size: 12px; }
.trade-safety-note span { color: #756b4e; }
.trade-actions { padding: 14px 16px; display: flex; align-items: center; gap: 10px; }
.trade-actions > div:first-child { margin-right: auto; display: grid; }
.trade-actions small { color: var(--muted); }
.trade-actions button,.hard-square-control select { min-height: 42px; padding: 0 14px; border: 1px solid #ced8e6; border-radius: 10px; background: #fff; font-weight: 800; }
.trade-actions button:disabled { opacity: .42; cursor: not-allowed; }
.trade-actions .danger { color: #a52e2e; border-color: #e7b5b5; background: #fff7f7; }
.trade-actions .bulk-warning { color: #855b00; border-color: #dfc270; background: #fff9e7; }
.trade-actions .hard-danger { color: #fff; border-color: #a52424; background: #b62d2d; }
.bulk-trade-control { display: flex; gap: 8px; padding-left: 10px; border-left: 1px solid var(--line); }
.bulk-trade-control[hidden] { display: none; }
.hard-square-control { display: flex; gap: 8px; padding-left: 10px; border-left: 1px solid var(--line); }
.hard-square-control select { min-width: 280px; }
.trade-table-panel { overflow: hidden; }
.trade-table-head,.trade-row { display: grid; grid-template-columns: 65px 130px minmax(190px,1.1fr) minmax(190px,1fr) 145px 135px 110px minmax(260px,1.4fr); align-items: center; gap: 10px; }
.trade-table-head { min-width: 1370px; padding: 11px 16px; color: #758198; background: #f5f7fb; border-bottom: 1px solid var(--line); font-size: 9px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.trade-rows { overflow-x: auto; }
.trade-row { min-width: 1370px; min-height: 76px; padding: 10px 16px; background: #fff; border-bottom: 1px solid #e7ecf3; }
.trade-row:last-child { border-bottom: 0; }
.trade-row > span { min-width: 0; display: grid; gap: 3px; }
.trade-row b { overflow-wrap: anywhere; font-size: 12px; }
.trade-row small { color: #7d899c; font-size: 10px; }
.trade-row.category-active { box-shadow: inset 4px 0 #2c9968; }
.trade-row.category-pending { background: #fffdf4; box-shadow: inset 4px 0 #daa22f; }
.trade-row.category-rejected { background: #fff7f7; box-shadow: inset 4px 0 #cc4242; }
.trade-row.category-exited { color: #68758b; box-shadow: inset 4px 0 #aab4c4; }
.category-active .trade-status { color: #227b55; }
.category-pending .trade-status { color: #996300; }
.category-rejected .trade-status,.category-rejected .broker-remark b { color: #b42e2e; }
.broker-remark { padding: 8px 10px; background: #f7f9fc; border-radius: 8px; }
.category-rejected .broker-remark { background: #feecec; }
.trade-empty { padding: 50px 20px; color: var(--muted); text-align: center; }
.trade-message { position: fixed; right: 22px; bottom: 22px; z-index: 50; max-width: 520px; padding: 14px 18px; color: #fff; background: #173866; border-radius: 11px; box-shadow: 0 12px 35px #09182d55; font-weight: 750; }
.trade-message[data-level="error"] { background: #9e2929; }
.trade-message[data-level="warning"] { background: #8a6200; }

@media (max-width: 900px) {
  .site-header { flex-wrap: wrap; }
  .console-nav { order: 3; width: 100%; }
  .console-nav a { flex: 1; text-align: center; }
  .trade-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .trade-actions { align-items: stretch; flex-direction: column; }
  .trade-actions > div:first-child { margin: 0; }
  .bulk-trade-control { padding: 10px 0 0; border-left: 0; border-top: 1px solid var(--line); flex-direction: column; }
  .hard-square-control { padding: 10px 0 0; border-left: 0; border-top: 1px solid var(--line); flex-direction: column; }
  .hard-square-control select { min-width: 0; }
}

[data-resizable-pane] { position: relative; display: flex; flex-direction: column; overflow: hidden; }
.saved-plans-panel { height: var(--saved-plans-pane-height,520px); min-height: 320px; max-height: min(900px,80vh); margin-bottom: 15px; padding: 20px 22px 28px; }
.saved-plans-panel .panel-head { flex: 0 0 auto; align-items: center; margin-bottom: 13px; }
.saved-plans-scroll-region { min-height: 0; flex: 1 1 auto; overflow: auto; padding-right: 5px; overscroll-behavior: contain; scrollbar-gutter: stable; }
.saved-plan-toolbar { display: flex; align-items: center; justify-content: flex-end; gap: 7px; }
.saved-plan-toolbar > span { color: var(--muted); font-size: 9px; font-weight: 800; white-space: nowrap; }
.saved-plan-toolbar button { white-space: nowrap; }
.saved-plan-toolbar .square-selected-strategies:not(:disabled) { color: #fff; background: #a62929; border-color: #8e1f1f; }
.saved-plan-toolbar .reset-selected-strategies:not(:disabled) { color: #765200; background: #fff4cf; border-color: #dfc270; }
.saved-plan-toolbar .delete-selected-plans:not(:disabled) { color: #fff; background: #b43737; border-color: #b43737; }
.strategy-workspace-filters { display: flex; align-items: flex-end; gap: 7px; }
.strategy-workspace-filters label { min-width: 116px; display: flex; flex-direction: column; gap: 3px; color: var(--muted); font-size: 8px; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; }
.strategy-workspace-filters select { min-height: 34px; padding: 0 28px 0 9px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--navy); font-size: 10px; font-weight: 800; }
.broker-automation-controls { margin: 0 0 12px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
.broker-automation-controls[hidden] { display: none; }
.broker-automation-controls > p { grid-column: 1/-1; margin: 0; padding: 9px 11px; color: #7a5b18; background: #fff9e9; border: 1px solid #f0dda5; border-radius: 9px; font-size: 9px; line-height: 1.45; }
.broker-automation-card { min-width: 0; padding: 10px 11px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; background: #f4fbf7; border: 1px solid #cce9d8; border-radius: 10px; }
.broker-automation-card.stopped { background: #fff4eb; border-color: #efc99f; }
.broker-automation-card > div:first-child { min-width: 0; display: grid; gap: 2px; }
.broker-automation-card small { color: #5d7ee0; font-size: 7px; font-weight: 900; letter-spacing: .08em; }
.broker-automation-card b { font-size: 11px; }
.broker-automation-card span { color: #367453; font-size: 8px; line-height: 1.35; }
.broker-automation-card .broker-account-connection-status.error { max-width: 320px; color: #b42318; font-weight: 850; overflow-wrap: anywhere; }
.broker-automation-card.stopped span { color: #a85b22; font-weight: 800; }
.broker-margin-summary { min-width: 255px; flex: 1 1 255px; display: grid; grid-template-columns: repeat(3,minmax(70px,1fr)); gap: 6px; }
.broker-margin-summary > span { min-width: 0; padding: 7px 8px; display: grid; gap: 2px; background: #e5f5eb; border: 1px solid #c4e4d1; border-radius: 8px; }
.broker-margin-summary > span small { color: #4f6e5b; font-size: 7px; }
.broker-margin-summary > span b { overflow: hidden; color: #176844; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.broker-automation-card.stopped .broker-margin-summary > span { background: #fff9f2; border-color: #edd7ba; }
.broker-automation-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.broker-automation-actions button { padding: 7px 8px; font-size: 8px; white-space: nowrap; }
.broker-automation-actions [data-broker-automation-action="stop"] { color: #a43c3c; border-color: #e4aeae; }
.broker-automation-actions [data-broker-automation-action="confirm-flat"] { color: #8c551a; border-color: #e0bd87; }
.broker-automation-actions [data-broker-automation-action="start"] { color: #176844; border-color: #9dceb7; }
.variation-guide { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; margin-bottom: 12px; }
.variation-guide > div { padding: 10px 11px; display: flex; align-items: flex-start; gap: 9px; background: #f7f9fd; border: 1px solid #e1e7f1; border-radius: 10px; }
.variation-guide > div > span { width: 24px; height: 24px; flex: 0 0 auto; display: grid; place-items: center; color: #fff; background: #5375d5; border-radius: 999px; font-size: 10px; font-weight: 900; }
.variation-guide p { margin: 0; }
.variation-guide b,.variation-guide small { display: block; }
.variation-guide b { font-size: 11px; }
.variation-guide small { margin-top: 2px; color: var(--muted); font-size: 9px; line-height: 1.4; }
.saved-plan-table { overflow-x: clip; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.saved-plan-table-head,.saved-plan-row { width: 100%; min-width: 0; display: grid; grid-template-columns: 76px minmax(150px,1.35fr) minmax(110px,.9fr) 60px 72px 105px 90px minmax(250px,auto); gap: 7px; align-items: center; }
.saved-plan-table-head { position: sticky; top: 0; z-index: 2; padding: 9px 12px; color: #64728a; background: #f5f7fa; border-bottom: 1px solid var(--line); font-size: 9px; font-weight: 900; letter-spacing: .05em; text-transform: uppercase; }
.saved-plan-select-all { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.saved-plan-select-all input,.saved-plan-status input { width: 14px; height: 14px; margin: 0; accent-color: #4e74df; }
.saved-plans-list { display: block; }
.saved-plan-row { padding: 12px; border-bottom: 1px solid var(--line); background: #fff; font-weight: 650; }
.saved-plan-row { cursor: pointer; }
.saved-plan-row :is(button,input,select,label) { cursor: auto; }
.saved-plan-row:last-child { border-bottom: 0; }
.saved-plan-row.selected { background: #f4f7ff; box-shadow: inset 4px 0 #5d7ee0; }
.saved-plan-status { display: flex; align-items: center; gap: 7px; min-width: 0; color: #7f8a9c; font-size: 10px; font-weight: 800; }
.saved-plan-status i { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: #aab4c2; }
.saved-plan-status b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-plan-status.running { color: #19734c; }
.saved-plan-status.running i { background: #2aa676; box-shadow: 0 0 0 4px #e3f5ed; }
.saved-plan-status.ready { color: #315ec9; }
.saved-plan-status.ready i { background: #4e78e8; box-shadow: 0 0 0 4px #e6edff; }
.saved-plan-status.locked { color: #b43737; }
.saved-plan-status.locked i { background: #d64a4a; box-shadow: 0 0 0 4px #fdeaea; }
.saved-plan-status.stopped { color: #a25e16; }
.saved-plan-status.stopped i { background: #d58a2c; box-shadow: 0 0 0 4px #fff0dc; }
.saved-plan-identity { min-width: 0; }
.saved-plan-identity h3 { margin: 0 0 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 850; }
.saved-plan-identity small { display: block; margin-top: 2px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: 9px; font-weight: 650; }
.saved-plan-identity small.advanced-on { color: #19734c; font-weight: 800; }
.saved-plan-leg-rules { min-width: 0; padding: 6px 8px; display: grid; gap: 4px; background: #f7f9fc; border: 1px solid #e1e7f0; border-radius: 8px; }
.saved-plan-rule-line { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #162a52; font-size: 9px; font-weight: 900; letter-spacing: -.01em; }
.saved-plan-rule-line.plan-codes { color: #4269bc; }
.inline-broker-select { min-width: 0; display: block; }
.inline-broker-select select { width: 100%; min-width: 0; margin: 0; padding: 7px 8px; border-radius: 7px; font-size: 9px; }
.saved-plan-metric { min-width: 0; display: flex; flex-direction: column; gap: 3px; padding-left: 10px; border-left: 1px solid var(--line); }
.saved-plan-metric b { font-size: 11px; font-weight: 850; white-space: nowrap; }
.saved-plan-metric small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: 9px; font-weight: 650; }
.plan-row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; min-width: 0; }
.plan-row-actions button { padding: 7px 8px; font-size: 9px; font-weight: 800; white-space: nowrap; }
.plan-row-actions .row-live-button { border-color: #cc4b55; background: #d94d57; color: #fff; font-weight: 900; }
.plan-row-actions .row-live-button:disabled { border-color: #d9dfe7; background: #eef1f5; color: #9aa5b4; }
.plan-row-actions .row-live-button.ready:disabled { opacity: 1; border-color: #9db4ef; background: #e9efff; color: #315ec9; }
.plan-row-actions .strategy-exit-button { color: #fff; border-color: #9f2424; background: #b62d2d; font-weight: 900; }
.plan-row-actions .square-leftover-button { color: #fff; border-color: #8e1f1f; background: #a62929; font-weight: 900; }
.plan-row-actions .delete-plan { color: #b43737; border-color: #e8bcbc; }
.plan-row-actions .automation-stop-button { color: #a43c3c; border-color: #e4aeae; }
.plan-row-actions .confirm-flat-button { color: #8c551a; border-color: #e0bd87; }
.plan-row-actions .reset-plan { color: #315ec9; border-color: #aec0ee; }
.saved-plans-empty { padding: 17px; color: var(--muted); text-align: center; background: #f7f9fc; font-size: 11px; }

.local-modal-backdrop { position: fixed; inset: 0; z-index: 1000; padding: 24px; display: grid; place-items: center; background: #0c1525a8; backdrop-filter: blur(4px); }
.local-modal-backdrop[hidden] { display: none; }
.local-modal { position: relative; width: min(650px,100%); max-height: calc(100vh - 48px); overflow: auto; padding: 24px; color: var(--ink); background: #fff; border: 1px solid #d9e1ed; border-radius: 18px; box-shadow: 0 24px 70px #07112045; }
.local-modal h2 { margin: 3px 0 7px; font-size: 23px; }
.local-modal > p:not(.eyebrow) { margin: 0 35px 18px 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.local-modal-close { position: absolute; top: 15px; right: 16px; width: 34px; height: 34px; padding: 0; display: grid; place-items: center; border: 0; background: #f1f4f8; border-radius: 999px; color: #66748a; font-size: 22px; }
.duplicate-fields { display: grid; grid-template-columns: 1.5fr repeat(3,1fr); gap: 10px; }
.duplicate-fields label:first-child { grid-column: 1/-1; }
.duplicate-fields label:last-child { grid-column: span 1; }
.duplicate-preview { margin-top: 12px; padding: 12px; display: grid; gap: 5px; border: 1px solid #cfe0f8; border-radius: 10px; background: #f2f7ff; }
.duplicate-preview b { color: #285dbd; font-size: 10px; }
.duplicate-preview span { color: #5e6d83; font-size: 9px; line-height: 1.6; }
.duplicate-preview.error { color: #a73838; background: #fff2f2; border-color: #efbcbc; font-size: 10px; }
.local-modal-actions { margin-top: 16px; display: flex; justify-content: flex-end; gap: 8px; }
.compact-edit-modal { width: min(860px,100%); padding: 20px; }
.compact-edit-modal h2 { font-size: 20px; }
.compact-edit-summary { display: grid; grid-template-columns: minmax(190px,1.35fr) minmax(145px,.9fr) repeat(5,minmax(90px,.7fr)); gap: 9px; }
.compact-edit-summary input,.compact-edit-modal input,.compact-edit-modal select { margin-top: 4px; padding: 8px 9px; }
.compact-leg-grid { margin-top: 11px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.compact-leg-card { padding: 11px; border: 1px solid #dfe6f1; border-radius: 11px; background: #f8faff; }
.compact-leg-card h3 { margin: 0 0 9px; display: flex; align-items: center; gap: 7px; font-size: 12px; }
.compact-leg-card h3 span { width: 29px; height: 25px; display: grid; place-items: center; color: #fff; background: #4e72d6; border-radius: 7px; font-size: 9px; }
.compact-risk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.compact-trail-rule { margin-top: 8px; padding: 8px; display: grid; grid-template-columns: 1.15fr 1fr 1fr; align-items: end; gap: 7px; background: #fff; border: 1px solid #e2e8f2; border-radius: 8px; }
.compact-trail-rule .switch-row { align-self: center; }
.compact-trail-rule label { font-size: 9px; }
.compact-trail-rule input:disabled { color: #8490a2; background: #eef1f5; opacity: .7; }
.compact-retry-section { margin-top: 8px; padding: 8px; background: #fff; border: 1px solid #dce5f2; border-radius: 8px; }
.compact-retry-section > b { display: block; margin-bottom: 5px; color: #315ec9; font-size: 9px; letter-spacing: .09em; }
.compact-retry-rule { display: grid; grid-template-columns: 58px 1.2fr .9fr .8fr .7fr; align-items: end; gap: 5px; }
.compact-retry-rule + .compact-retry-rule { margin-top: 6px; padding-top: 6px; border-top: 1px solid #e6ebf3; }
.compact-retry-rule strong { align-self: center; font-size: 9px; }
.compact-retry-rule label { min-width: 0; font-size: 8px; }
.compact-retry-rule input,.compact-retry-rule select { width: 100%; min-width: 0; padding: 6px 5px; font-size: 9px; }
.compact-retry-rule input:disabled,.compact-retry-rule select:disabled { color: #8490a2; background: #eef1f5; opacity: .7; }
.strategy-detail-modal { width: min(1280px,100%); }
.detail-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-right: 38px; }
.detail-title h2 { margin-bottom: 3px; font-size: 23px; font-weight: 850; }
.detail-title p { margin: 0; color: var(--muted); font-size: 11px; font-weight: 650; }
.detail-title > strong { display: flex; flex-direction: column; align-items: flex-end; font-size: 23px; font-weight: 850; white-space: nowrap; }
.detail-title > strong small { margin-top: 3px; color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.positive { color: #17825a !important; }
.negative { color: #c53b45 !important; }
.detail-summary { margin: 15px 0 12px; display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; }
.detail-summary span { padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; background: #f6f8fb; border: 1px solid var(--line); border-radius: 9px; }
.detail-summary b { font-size: 16px; font-weight: 850; }
.detail-summary small { color: var(--muted); font-size: 9px; font-weight: 750; text-transform: uppercase; }
.detail-run { margin-top: 11px; overflow: hidden; border: 1px solid #dce4ef; border-radius: 11px; }
.detail-run > header { padding: 11px 13px; display: grid; grid-template-columns: minmax(210px,.85fr) minmax(280px,1.6fr) minmax(130px,.6fr) minmax(100px,.45fr); align-items: center; gap: 12px; background: #eef4ff; }
.detail-run > header span { display: flex; flex-direction: column; gap: 3px; }
.detail-run > header b { font-size: 12px; font-weight: 850; }
.detail-run > header small { color: var(--muted); font-size: 10px; font-weight: 650; }
.detail-run > header > strong { text-align: right; font-size: 15px; font-weight: 850; }
.detail-run > header .detail-run-center { min-width: 0; display: grid; grid-template-columns: minmax(0,1.25fr) minmax(145px,.75fr); gap: 7px; }
.detail-run > header .detail-strategy-rules { min-width: 0; padding: 7px 10px; display: grid; gap: 3px; color: #162a52; background: rgba(255,255,255,.68); border: 1px solid #d7e0ee; border-radius: 8px; }
.detail-run > header .detail-strategy-rules b,.detail-run > header .detail-strategy-rules small { overflow-wrap: anywhere; line-height: 1.35; }
.detail-run > header .detail-strategy-rules b { font-size: 10px; }
.detail-run > header .detail-strategy-rules small { color: #4269bc; font-size: 9px; font-weight: 800; }
.detail-run > header .detail-margin-summary { min-width: 0; padding: 6px 9px; display: grid; align-content: center; gap: 1px; color: #183c2c; background: #e9f7ef; border: 1px solid #c7e5d3; border-radius: 8px; }
.detail-run > header .detail-margin-summary small { color: #4f7664; font-size: 7px; font-weight: 900; letter-spacing: .06em; }
.detail-run > header .detail-margin-summary b { color: #26744f; font-size: 13px; }
.detail-run > header .detail-margin-summary em { overflow-wrap: anywhere; color: #60766c; font-size: 7px; font-style: normal; font-weight: 750; line-height: 1.3; }
.detail-cycle { border-top: 1px solid #dce4ef; }
.detail-cycle > header { padding: 8px 12px; display: flex; align-items: center; justify-content: space-between; background: #fafbfd; }
.detail-cycle > header span { display: flex; flex-direction: column; gap: 2px; }
.detail-cycle > header b { font-size: 11px; font-weight: 850; }
.detail-cycle > header small { color: var(--muted); font-size: 9px; font-weight: 650; }
.detail-cycle > header strong { font-size: 12px; font-weight: 850; }
.detail-leg-head,.detail-leg-row { min-width: 0; display: grid; grid-template-columns: 56px 88px minmax(150px,1.35fr) 150px 65px 72px 170px 150px minmax(108px,120px); gap: 9px; align-items: center; }
.detail-leg-head { padding: 7px 12px; color: #6f7d92; background: #f4f6f9; border-top: 1px solid #e2e7ef; font-size: 9px; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
.detail-leg-row { padding: 10px 12px; border-top: 1px solid #edf0f4; font-size: 11px; font-weight: 650; }
.detail-leg-row > span,.detail-leg-row > time { min-width: 0; display: flex; flex-direction: column; gap: 2px; font-style: normal; }
.detail-leg-row b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 850; }
.detail-leg-row small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: 9px; font-weight: 650; }
.detail-leg-row > strong { min-width: 0; padding-right: 8px; text-align: right; font-size: 12px; font-weight: 850; white-space: nowrap; }
.detail-risk-levels { min-width: 0; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 4px; }
.detail-risk-levels > span { min-width: 0; padding: 4px 3px; display: flex; flex-direction: column; gap: 2px; background: #f5f7fb; border: 1px solid #e3e8f1; border-radius: 6px; }
.detail-risk-levels > span small { color: #748197; font-size: 7px; font-weight: 900; letter-spacing: .01em; text-align: center; }
.detail-risk-levels > span b { overflow: visible; color: #263750; font-size: 9px; text-align: center; text-overflow: clip; }
.detail-risk-levels > span.trailed { background: #e8f6ee; border-color: #bfe1cd; }
.detail-risk-levels > span.trailed small,.detail-risk-levels > span.trailed b { color: #19734c; }
.detail-risk-levels > span.inactive b { color: #9ba5b4; }
.detail-leg-row > [data-label]::before { display: none; content: attr(data-label); }
.detail-leg-status { width: fit-content; padding: 4px 7px; border-radius: 999px; font-size: 8px !important; letter-spacing: .04em; }
.detail-leg-status.live-entered { color: #237447; background: #e5f5eb; }
.detail-leg-status.exited { color: #58677c; background: #edf1f6; }
.detail-leg-status.waiting { color: #a06a08; background: #fff3d7; }
.detail-leg-status.submitting { color: #315ed2; background: #e8efff; }
.detail-waiting-row { background: #fffaf0; }
.detail-leg-row > strong.waiting-value { color: #a06a08; }
.detail-activity { margin-top: 18px; }
.detail-activity h3 { margin: 0 0 8px; font-size: 15px; font-weight: 850; }
.detail-activity-head { margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.detail-activity-head h3 { margin: 0; }
.detail-activity-head button { padding: 7px 11px; font-size: 11px; }
.detail-activity-row { padding: 9px 10px; display: grid; grid-template-columns: 175px 70px 1fr; gap: 10px; border-top: 1px solid var(--line); font-size: 11px; font-weight: 650; }
.detail-activity-row time { color: #5d6c81; }
.detail-activity-row b { color: #4d73d4; }
.detail-empty { padding: 22px; color: var(--muted); text-align: center; background: #f8fafc; font-size: 10px; }

.workspace-grid { display: contents; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 17px; box-shadow: 0 10px 30px #23395908; }
.execution-panel,.readiness-panel,.connection-panel,.positions-panel,.activity-panel,.slippage-panel { padding: 22px; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.panel-head h2 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.panel-head p:not(.eyebrow) { max-width: 720px; margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.editor-head-actions { display: flex; align-items: center; gap: 8px; }
.plan-editor-backdrop { position: fixed; inset: 0; z-index: 999; background: #0c1525a8; backdrop-filter: blur(4px); }
.plan-editor-backdrop[hidden] { display: none; }
.execution-panel[hidden] { display: none; }
.execution-panel.plan-editor-modal { position: fixed; inset: 24px max(24px,calc((100vw - 1400px)/2)); z-index: 1000; width: auto; max-height: calc(100vh - 48px); overflow: auto; box-shadow: 0 28px 80px #0711205c; }
.execution-panel.plan-editor-modal > .panel-head { position: sticky; top: -22px; z-index: 4; margin: -22px -22px 18px; padding: 20px 22px 14px; background: #fff; border-bottom: 1px solid var(--line); }
#close-plan-editor { color: #fff; background: #315ec9; border-color: #315ec9; white-space: nowrap; }
#close-plan-editor[hidden] { display: none; }

#strategy-form { display: grid; gap: 13px; }
fieldset { margin: 0; padding: 15px; border: 1px solid var(--line); border-radius: 13px; }
legend { padding: 0 7px; color: #34425e; font-size: 12px; font-weight: 850; }
.form-grid { display: grid; gap: 12px; }
.market-grid { grid-template-columns: 1.45fr 1fr .85fr .85fr; }
.plan-broker-routes { display: grid; gap: 5px; }
.plan-broker-route { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 5px 7px; color: #24437e; background: #eef3ff; border: 1px solid #d5e0f5; border-radius: 8px; font-size: 9px; font-weight: 850; }
.plan-broker-route button { padding: 1px 5px; color: #a83131; border: 0; background: transparent; font-size: 12px; }
.plan-no-broker { color: #a35e00; font-size: 10px; font-weight: 850; }
.plan-add-brokers { display: flex; flex-wrap: wrap; gap: 4px; }
.broker-card-multiplier { display: grid; justify-items: center; gap: 3px; color: #60708c; font-size: 9px; letter-spacing: .06em; }
.broker-card-multiplier span { display: flex; align-items: center; gap: 4px; }
.broker-card-multiplier input { width: 58px; margin: 0; padding: 7px 8px; text-align: center; font-size: 13px; font-weight: 900; }
.broker-card-multiplier b { color: #315ec9; font-size: 15px; }
.add-plan-broker { margin-top: 5px; padding: 5px 8px; color: #315ec9; border-color: #aabde9; font-size: 9px; }
.route-multiplier { display: block; margin-top: 4px; color: #315ec9; font-size: 10px; font-weight: 900; }
.schedule-grid { grid-template-columns: repeat(5,minmax(110px,1fr)); }
label { color: #657189; font-size: 11px; font-weight: 800; }
input,select { width: 100%; margin-top: 6px; padding: 10px 11px; border: 1px solid #cad5e5; border-radius: 9px; color: var(--ink); background: #fff; }
input:focus,select:focus { outline: 2px solid #9ab5ff; border-color: var(--blue); }
input:disabled { color: #6e7b90; background: #f3f5f8; }
.field-note { margin: 9px 0 0; color: #7a879b; font-size: 11px; }
.leg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.leg-card { padding: 12px; background: #f8faff; border: 1px solid #e0e7f3; border-radius: 11px; }
.leg-title { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.leg-title span { width: 32px; height: 27px; display: grid; place-items: center; color: #fff; background: #496fdc; border-radius: 7px; font-size: 11px; font-weight: 900; }
.leg-title b { font-size: 13px; }
.leg-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.advanced-rules { padding: 0; background: #f7f9fc; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.advanced-rules > summary { padding: 13px 14px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; font-size: 12px; font-weight: 850; list-style: none; }
.advanced-rules > summary::-webkit-details-marker { display: none; }
.advanced-rules > summary::after { content: "+"; margin-left: 10px; color: #5472bf; font-size: 18px; }
.advanced-rules[open] > summary::after { content: "−"; }
.advanced-rules > summary strong { margin-left: auto; padding: 4px 8px; color: #8d6000; background: #fff1cb; border-radius: 999px; font-size: 9px; letter-spacing: .08em; }
.advanced-rules > summary strong.enabled { color: #16724a; background: #ddf4e8; }
.advanced-intro { padding: 13px 14px; display: grid; grid-template-columns: minmax(270px,1fr) 210px; gap: 12px; align-items: center; background: #eef3ff; border-top: 1px solid #dce5f5; border-bottom: 1px solid #dce5f5; }
.switch-row { display: flex; align-items: flex-start; gap: 9px; color: var(--ink); }
.switch-row input[type="checkbox"] { width: 17px; height: 17px; flex: 0 0 auto; margin: 1px 0 0; accent-color: #4169e1; }
.switch-row span b,.switch-row span small { display: block; }
.switch-row span b { font-size: 11px; }
.switch-row span small { margin-top: 2px; color: var(--muted); font-size: 9px; line-height: 1.35; }
.compact-field input { margin-top: 4px; padding: 8px 9px; }
.advanced-section { padding: 14px; border-bottom: 1px solid var(--line); }
.advanced-heading { margin-bottom: 10px; }
.advanced-heading b,.advanced-heading small { display: block; }
.advanced-heading b { font-size: 12px; }
.advanced-heading small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.advanced-card-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.advanced-card,.advanced-leg-card { padding: 12px; background: #fff; border: 1px solid #dfe6f1; border-radius: 10px; }
.inline-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 9px; }
.inline-fields input,.inline-fields select,.retry-fields input,.retry-fields select { margin-top: 4px; padding: 8px 9px; }
.advanced-leg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.advanced-leg-title { display: flex; gap: 8px; align-items: center; padding-bottom: 9px; border-bottom: 1px solid #e6ebf3; }
.advanced-leg-title > span { width: 32px; height: 28px; display: grid; place-items: center; color: #fff; background: #496fdc; border-radius: 7px; font-size: 10px; font-weight: 900; }
.advanced-leg-title div b,.advanced-leg-title div small { display: block; }
.advanced-leg-title div b { font-size: 12px; }
.advanced-leg-title div small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.trail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.rule-block,.retry-block { padding: 9px; background: #f8faff; border: 1px solid #e3e9f3; border-radius: 8px; }
.retry-grid { display: grid; gap: 8px; margin-top: 8px; }
.retry-block > b { font-size: 10px; }
.retry-fields { display: grid; grid-template-columns: 1.15fr 1fr .8fr .7fr; gap: 7px; margin-top: 7px; }
.advanced-warning { margin: 0; padding: 11px 14px; color: #7b5809; background: #fff8e4; font-size: 10px; line-height: 1.45; }
.advanced-rules input:disabled,.advanced-rules select:disabled { color: #8792a4; background: #eef1f5; opacity: .75; }
.advanced-rules .rule-disabled { opacity: .62; }
.execution-safety { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; padding: 11px; background: #f7faff; border: 1px solid #dfe8f8; border-radius: 11px; }
.execution-safety > div { display: flex; gap: 8px; align-items: center; }
.execution-safety b,.execution-safety small { display: block; }
.execution-safety b { font-size: 11px; }
.execution-safety small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.safety-number { width: 25px; height: 25px; flex: 0 0 auto; display: grid; place-items: center; color: #fff; background: #4f73d7; border-radius: 999px; font-size: 11px; font-weight: 900; }
.actions { display: flex; gap: 9px; padding-top: 2px; }
button { padding: 10px 15px; border: 1px solid #cbd6e6; border-radius: 9px; background: #fff; color: #24437e; font-size: 12px; font-weight: 850; }
button:hover:not(:disabled) { border-color: #8aa6df; transform: translateY(-1px); }
button.primary,.live-button { color: #fff; background: var(--blue); border-color: var(--blue); }
.live-button:not(:disabled) { background: #158457; border-color: #158457; box-shadow: 0 8px 18px #15845724; }
button.danger { margin-left: auto; color: #b93434; border-color: #e5baba; }
button:disabled { opacity: .42; cursor: not-allowed; transform: none; }
.message { min-height: 18px; margin: 12px 0 0; color: #247a53; font-size: 12px; font-weight: 800; }
.message.error { color: #bd3232; }

.readiness-panel { position: static; }
.readiness-list { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.check-item { padding: 11px; display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; background: #fbfcfe; }
.check-icon { width: 22px; height: 22px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 999px; color: #fff; background: #a9b2c0; font-size: 11px; font-weight: 900; }
.check-item.ready .check-icon { background: #279263; }
.check-item.blocked .check-icon { background: #cf4646; }
.check-item b,.check-item small { display: block; }
.check-item b { font-size: 12px; }
.check-item small { margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.selected-plan { margin-top: 12px; padding: 13px; color: #fff; background: var(--navy); border-radius: 11px; }
.selected-plan small,.selected-plan b,.selected-plan span { display: block; }
.selected-plan small { color: #91abd2; font-size: 9px; font-weight: 900; letter-spacing: .1em; }
.selected-plan b { margin-top: 4px; font-size: 14px; }
.selected-plan span { margin-top: 3px; color: #cbd8eb; font-size: 10px; }
.rules-card { margin-top: 12px; padding: 13px; background: #f6f8fb; border-radius: 11px; }
.rules-card h3 { margin: 0 0 8px; font-size: 12px; }
.rules-card ul { margin: 0; padding-left: 17px; color: #66738a; font-size: 10px; line-height: 1.65; }

.connection-panel { margin-top: 15px; }
.connection-list { display: grid; grid-template-columns: repeat(3,1fr); gap: 11px; }
.connection-disclosure { border: 1px solid var(--line); border-radius: 12px; background: #fafbfd; overflow: hidden; }
.connection-disclosure[open] { grid-column: 1/-1; background: #fff; }
.connection-disclosure summary { min-height: 78px; padding: 13px; display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 10px; cursor: pointer; list-style: none; }
.connection-disclosure summary::-webkit-details-marker { display: none; }
.connection-disclosure summary div b,.connection-disclosure summary div small { display: block; }
.connection-disclosure summary div b { font-size: 13px; }
.connection-disclosure summary div small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.connection-disclosure summary strong { color: #6f7c91; font-size: 10px; text-align: right; }
.connection-disclosure summary strong.ready { color: #23845a; }
.broker-symbol { width: 34px; height: 34px; display: grid; place-items: center; color: #fff; background: #5476d5; border-radius: 10px; font-size: 11px; font-weight: 900; }
.credential-form { padding: 0 14px 14px; border-top: 1px solid var(--line); }
.credential-grid { display: grid; grid-template-columns: repeat(5,minmax(140px,1fr)); gap: 11px; padding-top: 13px; }
.connection-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.connect-button { color: #fff; background: #4a70dc; border-color: #4a70dc; }
.connect-button.ready { color: #fff; background: #23845a; border-color: #23845a; box-shadow: 0 0 0 4px #e5f5ed; }
.connect-button.ready:hover { background: #1d704c; border-color: #1d704c; }
.caution-note { margin: 10px 0 0; padding: 9px 11px; color: #7b5a0d; background: #fff8e7; border: 1px solid #eedca5; border-radius: 8px; font-size: 10px; }
.credential-note { margin: 12px 0 0; color: var(--muted); font-size: 10px; }

.connection-modal { width: min(920px,100%); }
.connection-modal-head { margin-right: 42px; display: grid; grid-template-columns: 44px minmax(0,1fr) auto; align-items: center; gap: 13px; }
.connection-modal-head .broker-symbol { width: 44px; height: 44px; font-size: 13px; }
.connection-modal-head h2 { margin: 2px 0 0; }
.connection-modal-head small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.connection-modal-head > strong { color: #6f7c91; font-size: 11px; text-align: right; }
.connection-modal-head > strong.ready { color: #23845a; }
.connection-secret-pill { display: inline-block; margin-top: 14px; }
.modal-credential-form { margin-top: 14px; padding: 0; border-top: 1px solid var(--line); }
.modal-credential-form .credential-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
.modal-credential-form .connection-actions { justify-content: flex-end; }
.connection-modal-message { min-height: 18px; margin: 10px 0 0; color: #28724f; font-size: 10px; font-weight: 800; text-align: right; }
.connection-modal-message.error { color: var(--red); }
.price-feed-modal { width: min(980px,100%); }
.price-feed-choice-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin-top: 20px; }
.price-feed-choice { display: flex; align-items: flex-start; gap: 11px; padding: 15px; border: 1px solid #d8e1ef; border-radius: 14px; background: #f8faff; cursor: pointer; }
.price-feed-choice:has(input:checked) { border-color: #5574dd; background: #edf2ff; box-shadow: 0 0 0 2px #5574dd20; }
.price-feed-choice input { width: 18px; height: 18px; margin-top: 2px; accent-color: #5574dd; }
.price-feed-choice span,.price-feed-choice small { display: block; }
.price-feed-choice b { font-size: 13px; }
.price-feed-choice small { margin-top: 4px; color: var(--muted); line-height: 1.4; }
.price-feed-save-actions { justify-content: flex-end; }
.price-feed-setup-block { margin-top: 18px; padding: 16px; border: 1px solid #dce4f0; border-radius: 15px; background: #fbfcff; }
.compact-connection-head { margin-right: 0; }
.motilal-feed-note { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.motilal-feed-note small { display: block; margin-top: 4px; color: var(--muted); }
.plan-broker-picker-list { display: grid; gap: 10px; margin: 18px 0; max-height: 55vh; overflow: auto; }
.plan-broker-picker-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 14px; border: 1px solid #dbe3f0; border-radius: 12px; background: #f8faff; }
.plan-broker-picker-row > input { width: 20px; height: 20px; }
.plan-broker-picker-row span small { display: block; margin-top: 3px; color: var(--muted); }
.plan-broker-picker-multiplier { display: flex; align-items: center; gap: 5px; }
.plan-broker-picker-multiplier input { width: 70px; text-align: center; }

.positions-panel,.activity-panel,.slippage-panel { margin-top: 15px; }
.workspace-positions-panel .panel-head { align-items: center; }
.positions-scope { padding: 7px 9px; color: #315ec9; background: #edf3ff; border: 1px solid #d8e4ff; border-radius: 999px; font-size: 8px; font-weight: 850; white-space: nowrap; }
.positions-summary-grid { margin-bottom: 10px; display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 7px; }
.positions-summary-grid article { min-width: 0; padding: 9px 10px; background: #f6f8fc; border: 1px solid #e0e6ef; border-radius: 9px; }
.positions-summary-grid small,.positions-summary-grid b { display: block; }
.positions-summary-grid small { overflow: hidden; color: #77839a; text-overflow: ellipsis; white-space: nowrap; font-size: 7px; font-weight: 900; letter-spacing: .05em; }
.positions-summary-grid b { margin-top: 3px; overflow: hidden; color: var(--ink); text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 850; }
.positive { color: var(--green) !important; }
.negative { color: var(--red) !important; }
.run-summary { display: flex; justify-content: space-between; padding: 11px 13px; margin-bottom: 10px; background: #edf8f2; border: 1px solid #bfe4ce; border-radius: 9px; font-size: 12px; }
.run-summary b { color: #228050; }
.table-wrap { width: 100%; overflow: auto; }
.strike-position-table { max-height: 330px; border: 1px solid var(--line); border-radius: 10px; }
.strike-position-table table { min-width: 1160px; }
.strike-position-table thead { position: sticky; top: 0; z-index: 1; background: #f5f7fa; }
.strike-position-table td { font-size: 9px; font-weight: 700; }
.strike-position-table .position-contract { max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.strike-position-table .position-status { font-size: 8px; font-weight: 900; }
.strike-position-table .position-status.live { color: #19734c; }
.strike-position-table .position-status.closed { color: #69778c; }
.strike-position-table tr.position-live { background: #fbfefc; }
.strike-position-table tr.position-closed { background: #fafbfc; }
table { width: 100%; border-collapse: collapse; font-size: 11px; }
th,td { padding: 10px; text-align: left; border-bottom: 1px solid #e4eaf3; white-space: nowrap; }
th { color: #6d7890; font-size: 9px; letter-spacing: .06em; }
.empty { padding: 24px; text-align: center; color: #7b879d; background: #f7f9fd; border-radius: 10px; font-size: 12px; }
.activity-panel { height: var(--activity-pane-height,420px); min-height: 240px; max-height: min(800px,75vh); padding-bottom: 28px; }
.activity-panel .panel-head { flex: 0 0 auto; }
.activity { min-height: 0; flex: 1 1 auto; overflow: auto; border: 1px solid var(--line); border-radius: 10px; overscroll-behavior: contain; scrollbar-gutter: stable; }
.pane-resize-handle { position: absolute; inset: auto 14px 5px; height: 16px; display: flex; align-items: center; justify-content: center; color: #6f7d94; cursor: ns-resize; touch-action: none; user-select: none; border-radius: 7px; outline: none; }
.pane-resize-handle::before { width: 52px; height: 4px; content: ""; background: #c8d2e1; border-radius: 999px; transition: width .15s ease,background .15s ease; }
.pane-resize-handle span { position: absolute; left: calc(50% + 36px); overflow: hidden; width: 0; color: #697890; white-space: nowrap; font-size: 8px; font-weight: 850; opacity: 0; transition: width .15s ease,opacity .15s ease; }
.pane-resize-handle:hover::before,.pane-resize-handle:focus-visible::before,.pane-resize-handle.dragging::before { width: 64px; background: #6685d9; }
.pane-resize-handle:hover span,.pane-resize-handle:focus-visible span,.pane-resize-handle.dragging span { width: 78px; opacity: 1; }
.pane-resize-handle:focus-visible { box-shadow: 0 0 0 3px #cbd8fa; }
body.resizing-pane { cursor: ns-resize; user-select: none; }
.activity-row { display: grid; grid-template-columns: 76px 62px 1fr; gap: 9px; align-items: start; padding: 10px 12px; border-bottom: 1px solid #e6ebf3; font-size: 11px; }
.activity-row time { color: #77839a; font-variant-numeric: tabular-nums; }
.activity-row b { color: #4d75e8; }
.activity-row p { margin: 0; line-height: 1.45; overflow-wrap: anywhere; }
.activity-row p .activity-strategy-name,
.detail-activity-row span strong { color: #15213a; font-weight: 900; }
.activity-row.error,.activity-row.critical { background: #fff2f2; }
.activity-row.error b,.activity-row.critical b { color: #c03737; }
.activity-row.warning { background: #fff9e9; }
.activity-row.warning b { color: #9a6500; }
.slippage-summary { margin-bottom: 12px; display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 8px; }
.slippage-summary article { min-width: 0; padding: 10px 12px; background: #f6f8fc; border: 1px solid #e0e6ef; border-radius: 10px; }
.slippage-summary small,.slippage-summary b { display: block; }
.slippage-summary small { overflow: hidden; color: #77839a; text-overflow: ellipsis; white-space: nowrap; font-size: 8px; font-weight: 900; letter-spacing: .06em; }
.slippage-summary b { margin-top: 4px; overflow: hidden; color: var(--ink); text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 900; }
.slippage-summary b.positive { color: var(--green); }
.slippage-summary b.negative { color: var(--red); }
.live-slippage-table table { min-width: 1220px; }
.live-slippage-table th { white-space: nowrap; }
.live-slippage-table td { font-size: 10px; font-weight: 750; font-variant-numeric: tabular-nums; }
.live-slippage-table tr.slippage-adverse { background: #fff5f5; }
.live-slippage-table tr.slippage-favourable { background: #f2fbf6; }
.live-slippage-table tr.slippage-adverse .slippage-value { color: var(--red); }
.live-slippage-table tr.slippage-favourable .slippage-value { color: var(--green); }
.slippage-strategy { max-width: 260px; white-space: pre-line; overflow-wrap: anywhere; }
.slippage-value { font-weight: 900 !important; }
.slippage-note { margin: 11px 2px 0; color: var(--muted); font-size: 9px; line-height: 1.45; }
.slippage-empty { border: 1px dashed #d7e0ec; border-radius: 10px; }

@media (max-width: 1180px) {
  .workspace-grid { grid-template-columns: 1fr; }
  .readiness-panel { position: static; }
  .readiness-list { grid-template-columns: repeat(2,1fr); }
  .connection-list { grid-template-columns: 1fr; }
  .credential-grid { grid-template-columns: repeat(2,1fr); }
  .status-board { grid-template-columns: repeat(7,minmax(165px,1fr)); }
  .advanced-card-grid,.advanced-leg-grid { grid-template-columns: 1fr; }
  .saved-plans-list { grid-template-columns: 1fr; }
  .detail-leg-head { display: none; }
  .detail-leg-row {
    min-width: 0;
    padding: 14px;
    grid-template-columns: repeat(4,minmax(0,1fr));
    grid-template-areas:
      "leg status contract contract"
      "entry-time entry latest risk"
      "exit-time exit-time mtm mtm";
    align-items: start;
    gap: 13px 15px;
  }
  .detail-cell-leg { grid-area: leg; }
  .detail-cell-status { grid-area: status; }
  .detail-cell-contract { grid-area: contract; }
  .detail-cell-entry-time { grid-area: entry-time; }
  .detail-cell-entry { grid-area: entry; }
  .detail-cell-latest { grid-area: latest; }
  .detail-cell-risk { grid-area: risk; }
  .detail-cell-exit-time { grid-area: exit-time; }
  .detail-cell-mtm { grid-area: mtm; }
  .detail-leg-row > [data-label]::before {
    display: block;
    margin-bottom: 5px;
    color: #738198;
    font-size: 8px;
    font-weight: 900;
    letter-spacing: .06em;
    text-transform: uppercase;
  }
  .detail-leg-row b,.detail-leg-row small { overflow: visible; text-overflow: clip; white-space: normal; overflow-wrap: anywhere; }
  .detail-leg-row > strong { padding-top: 9px; text-align: left; border-top: 1px dashed #dce3ed; font-size: 14px; }
}
@media (max-width: 850px) {
  .broker-automation-controls { grid-template-columns: 1fr; }
  .market-grid,.schedule-grid { grid-template-columns: repeat(2,1fr); }
  .execution-safety { grid-template-columns: 1fr; }
  .advanced-intro { grid-template-columns: 1fr; }
  .saved-plan-toolbar { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .duplicate-fields { grid-template-columns: 1fr 1fr; }
  .duplicate-fields label:first-child { grid-column: 1/-1; }
  .detail-run > header { grid-template-columns: 1fr auto; }
  .detail-run > header .detail-run-center { grid-column: 1/-1; }
  .detail-run > header > strong { grid-column: 2; grid-row: 1; text-align: right; }
  .detail-summary { grid-template-columns: repeat(2,1fr); }
  .detail-leg-row {
    grid-template-columns: repeat(2,minmax(0,1fr));
    grid-template-areas:
      "leg status"
      "contract contract"
      "entry-time exit-time"
      "entry latest"
      "risk risk"
      "mtm mtm";
  }
  .variation-guide { grid-template-columns: 1fr; }
  .hero { align-items: stretch; flex-direction: column; }
  .engine-tile { min-width: 0; }
}
@media (max-width: 580px) {
  .site-header { padding: 9px 13px; }
  .local-only { display: none; }
  .runtime { max-width: 155px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  main { width: calc(100% - 18px); margin-top: 9px; }
  .hero,.execution-panel,.readiness-panel,.positions-panel,.activity-panel,.slippage-panel { padding: 16px; }
  .hero { min-height: auto; }
  .hero h1 { font-size: 31px; }
  .readiness-list,.market-grid,.schedule-grid,.leg-grid,.credential-grid,.trail-grid,.inline-fields,.retry-fields { grid-template-columns: 1fr; }
  .strategy-workspace-filters { width: 100%; align-items: stretch; flex-direction: column; }
  .strategy-workspace-filters label { width: 100%; }
  .panel-head { flex-direction: column; }
  .saved-plans-panel { height: var(--saved-plans-pane-height,440px); min-height: 300px; max-height: 80vh; }
  .activity-panel { height: var(--activity-pane-height,360px); min-height: 220px; max-height: 75vh; }
  .actions { align-items: stretch; flex-direction: column; }
  button.danger { margin-left: 0; }
  .activity-row { grid-template-columns: 68px 1fr; }
  .activity-row p { grid-column: 1/-1; }
  .positions-summary-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .slippage-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .local-modal-backdrop { padding: 8px; }
  .local-modal { max-height: calc(100vh - 16px); padding: 16px; border-radius: 13px; }
  .connection-modal-head { grid-template-columns: 38px 1fr; }
  .connection-modal-head .broker-symbol { width: 38px; height: 38px; }
  .connection-modal-head > strong { grid-column: 1/-1; text-align: left; }
  .modal-credential-form .credential-grid { grid-template-columns: 1fr; }
  .price-feed-choice-grid { grid-template-columns: 1fr; }
  .motilal-feed-note { align-items: stretch; flex-direction: column; }
  .detail-title { margin-right: 30px; flex-direction: column; gap: 8px; }
  .detail-title > strong { align-items: flex-start; }
  .detail-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .detail-leg-row { gap: 12px 10px; }
  .detail-activity-row { grid-template-columns: 1fr auto; }
  .detail-activity-row span { grid-column: 1/-1; }
}
.workspace-picker{display:flex;align-items:center;gap:8px;margin-left:auto}.workspace-picker span{font-size:9px;font-weight:900;letter-spacing:.08em;color:#7f8da3}.workspace-picker select{height:36px;padding:0 30px 0 11px;border:1px solid #cbd5e1;border-radius:8px;background:#fff;color:#172033;font-weight:800}
@media(max-width:760px){.workspace-picker{order:3;width:100%;justify-content:flex-end}.site-header{flex-wrap:wrap}.workspace-picker select{max-width:190px}}
