/* The Strategy builder page (#view-strategy): ported from strategy-preview/style.css, every rule scoped to the page and
   every class prefixed sb- (the app has short global classes such as .g that would otherwise collide). */
#view-strategy {
  --profit: var(--up);
  --loss: var(--down);
  --today: #6c9cff;
  --band: var(--accent);
  --chart-zero: #646b88;
  --sb-call: #f0625d;   /* calls red, puts green, as on the OI page */
  --sb-put: #7ac74f;
  --sb-strategy: #9d8cff;
}
#view-strategy [hidden] { display: none !important; }   /* rules below set display; the attribute must still win */
#view-strategy .sb-wrap { max-width: 1500px; margin-inline: auto; }
#view-strategy .sb-vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
#view-strategy .sb-g { color: var(--profit); }
#view-strategy .sb-r { color: var(--loss); }
#view-strategy button, #view-strategy select, #view-strategy input, #view-strategy output { font: inherit; color: inherit; }
#view-strategy dl, #view-strategy dd, #view-strategy p, #view-strategy h2, #view-strategy h3 { margin: 0; }

#view-strategy .sb-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
#view-strategy .sb-title { font-size: 18px; font-weight: 650; }
#view-strategy .sb-und { display: flex; gap: 6px; overflow-x: auto; }
#view-strategy .sb-und button, #view-strategy .sb-tabs button {
  flex: none; min-height: 34px; padding: 6px 14px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer;
}
#view-strategy .sb-und button[aria-selected="true"], #view-strategy .sb-tabs button[aria-selected="true"] {
  border-color: var(--accent); background: var(--panel-2); color: var(--text);
}

#view-strategy .sb-layout {
  display: grid; grid-template-columns: minmax(560px, 1fr) minmax(0, 1.25fr); gap: 12px; align-items: start;
  grid-template-areas: "builder chart" "details chart";
}
#view-strategy .sb-builder { grid-area: builder; }
#view-strategy .sb-analysis { grid-area: chart; }
#view-strategy .sb-details { grid-area: details; }
#view-strategy .sb-card { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }

/* builder */
#view-strategy .sb-spot-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; flex-wrap: wrap; }
#view-strategy .sb-spot-head h3 { font-size: 15px; font-weight: 600; color: var(--muted); }
#view-strategy .sb-spot-line { margin-top: 2px; }
#view-strategy .sb-spot { font-size: 26px; font-weight: 650; font-variant-numeric: tabular-nums; }
#view-strategy .sb-head-actions { display: flex; gap: 8px; align-items: center; }
#view-strategy .sb-btn {
  min-height: 34px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel-2); font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer;
}
#view-strategy .sb-btn:hover { border-color: var(--accent); }
#view-strategy .sb-btn.sb-ghost { background: transparent; color: var(--muted); }
#view-strategy .sb-btn.sb-exec { background: var(--accent); border-color: var(--accent); color: #fff; }
#view-strategy .sb-btn.sb-exec:disabled { opacity: .45; cursor: not-allowed; }
#view-strategy .sb-dialog { width: min(560px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); color: var(--text); }
#view-strategy .sb-dialog::backdrop { background: rgba(5, 6, 10, .6); backdrop-filter: blur(2px); }
#view-strategy .sb-dialog form { padding: 18px 18px 16px; }
#view-strategy .sb-dialog h3 { font-size: 17px; margin: 0 0 4px; }
#view-strategy .sb-exec-legs { width: 100%; margin: 12px 0 8px; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
#view-strategy .sb-exec-legs th { padding: 6px 4px; color: var(--muted); font-size: 11px; font-weight: 600; text-align: right; }
#view-strategy .sb-exec-legs th:first-child, #view-strategy .sb-exec-legs td:first-child { text-align: left; }
#view-strategy .sb-exec-legs td { padding: 7px 4px; border-top: 1px solid var(--line); text-align: right; }
#view-strategy .sb-exec-note { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
#view-strategy .sb-exec-msg { min-height: 18px; margin: 10px 0 0; font-size: 13px; }
#view-strategy .sb-exec-msg.bad { color: var(--loss); }
#view-strategy .sb-exec-msg.good { color: var(--profit); }
#view-strategy .sb-exec-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
#view-strategy .sb-link { padding: 0 4px; border: 0; background: none; color: var(--accent); font-size: 11px; font-weight: 600; cursor: pointer; }
#view-strategy select {
  min-height: 32px; padding: 4px 8px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); font-size: 13px;
}
#view-strategy .sb-fast select { min-height: 34px; font-weight: 600; }
/* The open list of a transparent select (the strike stepper's) is drawn white by Chrome on Windows while the text stays
   light, so give every option its own dark background; the ATM strike stands out in the list. */
#view-strategy select option { background-color: var(--panel-2); color: var(--text); }
#view-strategy select option.sb-atm { color: var(--accent); font-weight: 700; }
#view-strategy select option:checked { background-color: var(--panel-3); }

#view-strategy .sb-legs-wrap { position: relative; overflow-x: auto; border-block: 1px solid var(--line); }
#view-strategy table { width: 100%; border-collapse: collapse; }
#view-strategy .sb-legs { min-width: 500px; }
#view-strategy .sb-legs th, #view-strategy .sb-pnl th { padding: 8px 4px; color: var(--muted); font-size: 11px; font-weight: 600; text-align: left; white-space: nowrap; }
#view-strategy .sb-legs td { padding: 6px 4px; border-top: 1px solid var(--line); vertical-align: middle; }
#view-strategy .sb-legs td:first-child, #view-strategy .sb-legs th:first-child { padding-left: 12px; }
#view-strategy .sb-legs tr.sb-off td:not(:first-child) { opacity: 0.45; }
#view-strategy .sb-legs input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }
#view-strategy .sb-side { width: 30px; height: 30px; border: 0; border-radius: 6px; font-weight: 700; cursor: pointer; }
#view-strategy .sb-side.b { background: var(--buy); color: #0f1a10; }
#view-strategy .sb-side.s { background: var(--sell); color: #2a0d0b; }
#view-strategy .sb-kind { min-width: 38px; height: 30px; border: 1px solid; border-radius: 6px; background: transparent; font-weight: 700; font-size: 12px; cursor: pointer; }
#view-strategy .sb-kind.ce { border-color: var(--sb-call); color: var(--sb-call); }
#view-strategy .sb-kind.pe { border-color: var(--sb-put); color: var(--sb-put); }
#view-strategy .sb-stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }
#view-strategy .sb-stepper button { width: 26px; height: 30px; border: 0; background: none; color: var(--muted); font-size: 15px; cursor: pointer; }
#view-strategy .sb-stepper button:hover { color: var(--text); }
#view-strategy .sb-stepper select { min-height: 30px; border: 0; background: transparent; padding-inline: 2px; }
#view-strategy .sb-stepper output, #view-strategy .sb-stepper .sb-lots { min-width: 26px; text-align: center; }
#view-strategy .sb-price {
  width: 78px; min-height: 30px; padding: 4px 6px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); text-align: right;
}
#view-strategy .sb-price.sb-manual { border-color: var(--amber); }
#view-strategy .sb-del { width: 28px; height: 28px; border: 0; border-radius: 6px; background: none; color: var(--muted); font-size: 16px; cursor: pointer; }
#view-strategy .sb-del:hover { background: var(--panel-3); color: var(--loss); }
#view-strategy .sb-empty { padding: 18px 16px; color: var(--muted); font-size: 13px; }

#view-strategy .sb-builder-foot { display: flex; flex-wrap: wrap; align-items: end; gap: 14px; padding: 12px 16px; }
#view-strategy .sb-builder-foot label, #view-strategy .sb-stepper-field { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
#view-strategy .sb-builder-foot .sb-btn { margin-left: auto; }
#view-strategy .sb-premium-line { padding: 0 16px 14px; color: var(--muted); font-size: 13px; }
#view-strategy .sb-premium-line strong { color: var(--text); }

/* analysis */
#view-strategy .sb-tabs { display: flex; gap: 6px; padding: 12px 14px 0; overflow-x: auto; }
#view-strategy .sb-tabs.sb-sub { padding-top: 12px; }
#view-strategy .sb-legend { display: flex; flex-wrap: wrap; gap: 14px; padding: 10px 14px 0; color: var(--muted); font-size: 12px; }
#view-strategy .sb-legend span { display: inline-flex; align-items: center; gap: 6px; }
#view-strategy .sb-sw { display: inline-block; width: 16px; height: 3px; border-radius: 2px; }
#view-strategy .sb-sw.expiry { background: linear-gradient(90deg, var(--profit) 50%, var(--loss) 50%); }
#view-strategy .sb-sw.today { background: var(--today); }
#view-strategy .sb-sw.target { background: repeating-linear-gradient(90deg, var(--amber) 0 5px, transparent 5px 8px); }
#view-strategy .sb-sw.band { height: 10px; background: var(--band); opacity: 0.35; }
#view-strategy .sb-sw.strategy { background: var(--sb-strategy); height: 3px; }
#view-strategy .sb-sw.index { background: var(--amber); }
#view-strategy .sb-hist-status { min-height: 18px; padding: 8px 14px 0; color: var(--muted); font-size: 12px; }
#view-strategy .sb-hist-legend { justify-content: center; padding: 4px 14px 12px; }
#view-strategy .sb-margins { margin: 0 16px 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }
#view-strategy .sb-margins h4 { margin: 0 0 8px; font-size: 13px; font-weight: 650; }
#view-strategy .sb-margin-src { margin-left: 6px; color: var(--muted); font-size: 11px; font-weight: 400; }
#view-strategy .sb-margins dl { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0; }
#view-strategy .sb-margins dt { color: var(--muted); font-size: 11px; }
#view-strategy .sb-margins dd { margin: 3px 0 0; font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { #view-strategy .sb-margins dl { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
#view-strategy .sb-chart-box { position: relative; height: min(540px, 64vh); min-height: 300px; padding: 6px 4px 0; }
#view-strategy .sb-chart-box canvas { display: block; width: 100%; height: 100%; }
#view-strategy .sb-chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
#view-strategy .sb-readout { min-height: 36px; padding: 6px 14px 10px; color: var(--muted); font-size: 12px; }
#view-strategy .sb-readout b { color: var(--text); font-weight: 600; }

#view-strategy .sb-table-wrap { position: relative; overflow-x: auto; padding: 8px 6px 4px; }
#view-strategy .sb-pnl { min-width: 460px; }
#view-strategy .sb-pnl td, #view-strategy .sb-pnl tfoot th { padding: 8px 6px; border-top: 1px solid var(--line); font-size: 13px; text-align: left; font-variant-numeric: tabular-nums; }
#view-strategy .sb-pnl td:not(:first-child), #view-strategy .sb-pnl th:not(:first-child) { text-align: right; }
#view-strategy .sb-pnl tfoot th { color: var(--muted); font-weight: 600; }
#view-strategy .sb-pnl tfoot td { font-weight: 700; }
#view-strategy .sb-stale { color: var(--amber); cursor: help; }
#view-strategy .sb-foot-note { font-weight: 400; font-size: 11px; }
#view-strategy .sb-tag { display: inline-block; width: 20px; margin-right: 6px; border-radius: 4px; text-align: center; font-size: 11px; font-weight: 700; }
#view-strategy .sb-tag.b { background: var(--buy); color: #0f1a10; }
#view-strategy .sb-tag.s { background: var(--sell); color: #2a0d0b; }

#view-strategy .sb-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin: 10px 14px 14px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--line); }
#view-strategy .sb-metrics > div { min-width: 0; padding: 10px 12px; background: var(--panel); }
#view-strategy .sb-metrics .sb-wide { grid-column: span 2; }
#view-strategy .sb-metrics dt { color: var(--muted); font-size: 12px; }
#view-strategy .sb-metrics dd { margin-top: 4px; font-size: 18px; font-weight: 650; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
#view-strategy .sb-note { margin-top: 2px; color: var(--muted); font-size: 11px; }
#view-strategy .sb-greeks-src { padding: 0 14px 14px; }

#view-strategy .sb-adjust { display: grid; gap: 14px; padding: 12px 14px 14px; }
#view-strategy .sb-slider { display: grid; gap: 6px; font-size: 12px; color: var(--muted); }
#view-strategy .sb-slider-head { display: flex; justify-content: space-between; gap: 10px; }
#view-strategy .sb-slider-head output { color: var(--text); font-weight: 600; }
#view-strategy .sb-slider input { width: 100%; accent-color: var(--accent); }
#view-strategy .sb-adjust-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
#view-strategy .sb-adjust-foot strong { font-size: 16px; }
#view-strategy .sb-footnote { margin-top: 12px; line-height: 1.5; }

@media (max-width: 1220px) {
  #view-strategy .sb-layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "builder" "chart" "details"; }
  #view-strategy .sb-chart-box { height: min(440px, 56vh); }
}
@media (max-width: 640px) {
  .nav [data-view="strategy"] { display: none !important; }      /* phones reach it from the account menu */
  #view-strategy .sb-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #view-strategy .sb-spot { font-size: 22px; }
  #view-strategy .sb-builder-foot .sb-btn { margin-left: 0; }
}
