@font-face {
  font-family: "Satoshi";
  src: url("/assets/fonts/satoshi.woff2") format("woff2");
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
}

@font-face {
  font-family: "SF Pro Display";
  src: url("/assets/fonts/sf-pro-display-medium.woff2") format("woff2");
  font-style: normal;
  font-weight: 500 600;
  font-display: swap;
}

@font-face {
  font-family: "SF Pro Display";
  src: url("/assets/fonts/sf-pro-display-bold.woff2") format("woff2");
  font-style: normal;
  font-weight: 700 800;
  font-display: swap;
}

:root {
  --bg: #0d0f13;
  --panel: #15181e;
  --panel-2: #1a1e25;
  --line: #272c35;
  --border: #272c35;
  --border-2: #343a45;
  --fg: #f0f2f5;
  --text: #f0f2f5;
  --dim: #9aa2af;
  --faint: #6d7582;
  --accent: #20a5a9;
  --accent-soft: #71cdd0;
  --green: #69c98a;
  --red: #ef6b78;
  --amber: #dcb65a;
  --cyan: #65bad0;
  --grid: #242a32;
  --shell-sidebar: #12151a;
  --shell-sidebar-hover: #1a1e25;
  --shell-header: rgba(19, 22, 27, 0.96);
  --shell-workspace: #0f1116;
  --shell-active: #27b0b4;
  --shell-sans: "Satoshi", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --shell-display: "SF Pro Display", "Satoshi", ui-sans-serif, -apple-system, BlinkMacSystemFont, sans-serif;
}

html,
body {
  min-height: 100%;
}

body {
  display: block;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  background: var(--shell-workspace);
  color: var(--fg);
  font-family: var(--shell-sans);
  font-size: 14px;
  line-height: 1.45;
}

button,
input,
select {
  font-family: inherit;
}

/* Auth stays app-owned and visually separate from the signed-in workspace. */
#login.auth-stage,
#boot.boot-stage {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  width: auto;
  max-width: none;
  place-items: center;
  margin: 0;
  padding: 24px;
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(circle at 52% 35%, rgba(145, 201, 91, 0.08), transparent 35%),
    #0c0e12;
}

.login-card {
  width: min(440px, 100%);
  padding: 30px;
  border: 1px solid var(--border-2);
  border-radius: 8px;
  background: #14171c;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  font-family: var(--shell-display);
  font-size: 16px;
  font-weight: 730;
  letter-spacing: 0.035em;
}

.login-brand .brand-mark {
  width: 34px;
  height: 34px;
}

#login .lead {
  margin: 0 0 17px;
  color: var(--dim);
  font-size: 13px;
}

#login .pwline {
  align-items: stretch;
}

#login .pwline label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

#login .pwline input {
  min-width: 0;
  border-color: var(--border-2);
  background: #0e1115;
  color: var(--fg);
  font-family: var(--shell-sans);
  font-size: 14px;
}

#login .pwline button {
  min-width: 96px;
  background: var(--shell-active);
  color: #10140d;
  font-family: var(--shell-sans);
}

#login .loginerr {
  margin-top: 12px;
}

#boot.boot-stage {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 13px;
}

/* Desktop application frame. */
#app.app-shell {
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
  min-height: 100vh;
  background: var(--shell-workspace);
}

.app-sidebar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  width: 238px;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: var(--shell-sidebar);
}

.brand-link {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 11px;
  height: 77px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  color: var(--fg);
  text-decoration: none;
}

.sidebar-menu-icon {
  color: #f2f3f5;
  font-family: var(--shell-sans);
  font-size: 24px;
  font-weight: 400;
  line-height: 1;
}

.brand-link:hover {
  text-decoration: none;
}

.brand-mark {
  display: block;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.brand-copy {
  display: grid;
  line-height: 1.1;
}

.brand-name {
  font-family: var(--shell-display);
  font-size: 13px;
  font-weight: 760;
  letter-spacing: 0.12em;
}

.brand-edition {
  margin-top: 4px;
  color: var(--faint);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.sidebar-scroll {
  min-height: 0;
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 17px 14px 20px;
}

#prodnav.prodnav {
  display: block;
  min-height: 0;
  margin: 0;
}

.sidebar-section + .sidebar-section {
  margin-top: 18px;
}

.sidebar-section-label {
  padding: 0 0 7px;
  color: #8b9098;
  font-size: 10.5px;
  font-weight: 720;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.sidebar-nav-item {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 30px;
  align-items: center;
  gap: 11px;
  margin: 0;
  padding: 5px 4px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #d0d3d7;
  font-size: 13px;
  font-weight: 520;
  line-height: 1.25;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.sidebar-nav-item:hover {
  background: var(--shell-sidebar-hover);
  color: var(--fg);
  text-decoration: none;
}

.sidebar-nav-item.active {
  background: transparent;
  color: #58bcb9;
  font-weight: 650;
}

.sidebar-nav-item.active::before {
  position: absolute;
  top: 5px;
  bottom: 5px;
  left: -14px;
  width: 2px;
  border-radius: 0 2px 2px 0;
  background: #58bcb9;
  content: "";
}

.sidebar-nav-item:focus-visible,
.brand-link:focus-visible {
  outline: 2px solid var(--shell-active);
  outline-offset: 1px;
}

.nav-icon {
  display: grid;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  place-items: center;
  color: #7c8592;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1;
}

.sidebar-nav-item.active .nav-icon {
  color: var(--shell-active);
}

.sidebar-nav-item[disabled],
.sidebar-nav-item[aria-disabled="true"] {
  color: #c3c7cc;
  cursor: not-allowed;
  opacity: 0.78;
}

.sidebar-nav-item[disabled]:hover,
.sidebar-nav-item[aria-disabled="true"]:hover {
  background: transparent;
  color: #c3c7cc;
}

.sidebar-nav-item.sidebar-aux {
  margin-top: 7px;
}

.nav-soon {
  margin-left: auto;
  color: #505865;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-foot {
  flex: 0 0 auto;
  padding: 13px 20px 16px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 10px;
}

.sidebar-foot-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(105, 201, 138, 0.08);
}

.workspace-shell {
  min-width: 0;
  background: var(--shell-workspace);
}

.market-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  min-height: 77px;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
  background: var(--shell-header);
  backdrop-filter: blur(12px);
}

.workspace-product {
  display: flex;
  min-width: 190px;
  flex: 1 1 auto;
  align-items: center;
  gap: 10px;
  padding: 0 26px;
  color: #f2f3f5;
  font-family: var(--shell-display);
  font-size: 15px;
  font-weight: 650;
}

.workspace-product .brand-mark {
  width: 26px;
  height: 26px;
}

.market-strip {
  display: flex;
  min-width: 0;
  flex: 0 1 540px;
  align-items: stretch;
  overflow-x: auto;
  scrollbar-width: none;
}

.market-strip::-webkit-scrollbar {
  display: none;
}

.market-quote {
  display: grid;
  min-width: 108px;
  align-content: center;
  justify-items: center;
  padding: 8px 8px;
  border-right: 1px solid rgba(39, 44, 53, 0.82);
  font-variant-numeric: tabular-nums;
}

.market-quote-top {
  display: flex;
  max-width: 100%;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
}

.market-quote-label {
  color: #717a87;
  font-family: var(--shell-sans);
  font-size: 9px;
  font-weight: 520;
  letter-spacing: 0;
}

.market-quote-value {
  color: #e5e8ec;
  font-family: var(--mono);
  font-size: 10px;
  white-space: nowrap;
}

.market-quote-change {
  display: block;
  margin-top: 3px;
  color: var(--faint);
  font-size: 8.5px;
  text-align: center;
}

.market-quote-change.up {
  color: var(--green);
}

.market-quote-change.dn {
  color: var(--red);
}

.topmeta {
  position: relative;
  display: flex;
  width: 245px;
  flex: 0 0 245px;
  min-width: 245px;
  align-items: center;
  gap: 9px;
  margin: 0;
  padding: 0 12px;
  border-left: 1px solid var(--line);
}

.topmeta .kv,
.topmeta > .pill {
  display: none;
}

.topmeta .iconbtn {
  width: 31px;
  height: 31px;
  padding: 0;
  border-color: transparent;
  border-radius: 4px;
  color: #858e9b;
  font-family: var(--shell-sans);
  font-size: 10.5px;
}

.topmeta .iconbtn:hover {
  border-color: var(--line);
  background: var(--panel-2);
  color: var(--fg);
}

.account-trigger {
  min-height: 31px;
  border-color: var(--line);
  background: #171a20;
  font-family: var(--shell-sans);
  font-size: 10.5px;
}

.account-menu {
  z-index: 100;
  font-family: var(--shell-sans);
}

.workspace-scroll {
  width: 100%;
  padding: 27px 30px 52px;
}

.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.page-eyebrow {
  margin-bottom: 5px;
  color: var(--faint);
  font-size: 9px;
  font-weight: 720;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.page-title {
  margin: 0;
  color: #f3f4f6;
  font-family: var(--shell-display);
  font-size: clamp(22px, 2vw, 29px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.meta {
  max-width: 830px;
  margin: 7px 0 0;
  color: #7f8895;
  font-family: var(--shell-sans);
  font-size: 11.5px;
}

.meta b {
  color: #cbd0d7;
}

.workspace-controls.subnav {
  min-height: 34px;
  align-items: center;
  margin: 0 0 15px;
  padding: 0;
}

.workspace-content {
  width: 100%;
  min-width: 0;
}

.workspace-content .panel {
  border-color: var(--line);
  border-radius: 5px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.015);
}

.workspace-content .panel-h {
  border-bottom-color: var(--line);
  background: #181b21;
}

.workspace-content .panel-h h1.t {
  margin: 0;
}

/* TRACE and Equity deliberately create wide canvases inside their own scrollers. */
.workspace-content canvas {
  max-width: none;
}

.workspace-content .sliderrow {
  flex-wrap: wrap;
}

.workspace-content .sliderrow input[type="range"] {
  min-width: 180px;
}

/* TRACE has a denser two-line control surface than the other product views. */
.workspace-controls:has(.trace-controls) {
  display: block;
  overflow: visible;
}

.trace-controls,
.trace-model-row {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.trace-controls {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #15181e;
}

.trace-model-row {
  margin-top: 7px;
  padding: 0 2px;
}

.trace-field,
.trace-range {
  min-width: 0;
  color: #7f8895;
  font-family: var(--shell-sans);
  font-size: 8px;
  font-weight: 720;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.trace-field {
  display: grid;
  gap: 4px;
}

.trace-field > span:first-child {
  white-space: nowrap;
}

.trace-field .tsel,
.trace-field .dinput {
  min-height: 30px;
  border-color: #303640;
  border-radius: 4px;
  background: #101318;
  color: #d8dce2;
  font-family: var(--shell-sans);
  font-size: 10.5px;
  letter-spacing: 0;
  text-transform: none;
}

.trace-field .tsel {
  min-width: 112px;
  padding: 5px 24px 5px 8px;
}

.trace-field.trace-compact .tsel {
  min-width: 76px;
}

.trace-field.trace-date .dinput {
  min-width: 132px;
}

.trace-field .tsel:hover,
.trace-field .tsel:focus,
.trace-field .dinput:focus {
  border-color: #687381;
}

.trace-switch {
  position: relative;
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  align-self: flex-end;
  gap: 6px;
  padding: 0 3px;
  color: #949da9;
  cursor: pointer;
  font-family: var(--shell-sans);
  white-space: nowrap;
}

.trace-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.trace-switch .switch-track {
  position: relative;
  display: inline-block;
  width: 28px;
  height: 16px;
  flex: 0 0 auto;
  border: 1px solid #3a414c;
  border-radius: 999px;
  background: #242a32;
  transition: border-color 120ms ease, background 120ms ease;
}

.trace-switch .switch-track::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #818b98;
  content: "";
  transition: transform 120ms ease, background 120ms ease;
}

.trace-switch input:checked + .switch-track {
  border-color: #5ba8ae;
  background: rgba(32, 166, 175, 0.28);
}

.trace-switch input:checked + .switch-track::after {
  background: #42c1c7;
  transform: translateX(12px);
}

.trace-switch input:focus-visible + .switch-track {
  outline: 2px solid var(--shell-active);
  outline-offset: 2px;
}

.trace-switch b {
  font-size: 9.5px;
  font-weight: 550;
  letter-spacing: 0;
}

.trace-range {
  display: flex;
  min-width: 92px;
  flex-direction: column-reverse;
  gap: 5px;
}

.trace-range input[type="range"] {
  width: 92px;
  height: 15px;
  margin: 0;
  accent-color: #42c1c7;
}

.trace-spacer {
  min-width: 8px;
  flex: 1 1 18px;
}

.trace-iconbtn {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #303640;
  border-radius: 4px;
  background: #111419;
  color: #9ba4b0;
  cursor: pointer;
  font-family: var(--shell-sans);
  transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
}

.trace-iconbtn {
  width: 30px;
  height: 30px;
  align-self: flex-end;
  padding: 0;
  font-size: 13px;
}

.trace-iconbtn:hover {
  border-color: #687381;
  background: #20252d;
  color: #f0f2f5;
}

.trace-iconbtn:focus-visible {
  outline: 2px solid var(--shell-active);
  outline-offset: 2px;
}

.trace-controls .popwrap {
  display: inline-flex;
  align-self: flex-end;
}

.trace-settings-pop,
.trace-colors-pop {
  right: 0;
  left: auto;
  z-index: 120;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 96px);
  overflow: auto;
  border-color: #3a414c;
  background: #171b21;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.58);
  color: #dfe2e7;
  font-family: var(--shell-sans);
}

.trace-settings-pop {
  width: min(460px, calc(100vw - 32px));
}

.trace-colors-pop {
  width: min(590px, calc(100vw - 32px));
}

.trace-settings-pop h4,
.trace-colors-pop h4 {
  margin: 13px 0 7px;
  color: #7e8793;
  font-family: var(--shell-sans);
}

.trace-pop-grid,
.color-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 12px;
}

.trace-pop-grid .poprow {
  min-width: 0;
}

.trace-settings-pop .poprow {
  color: #c9ced5;
  font-family: var(--shell-sans);
  font-size: 11px;
}

.trace-settings-pop .seg {
  max-width: 100%;
  flex-wrap: wrap;
}

.trace-settings-pop .seg button {
  font-family: var(--shell-sans);
  white-space: nowrap;
}

.color-field {
  display: grid;
  min-width: 0;
  gap: 4px;
  color: #aab1bb;
  font-family: var(--shell-sans);
  font-size: 10px;
}

.color-field > span:last-child {
  display: grid;
  grid-template-columns: 31px minmax(0, 1fr);
  gap: 5px;
}

.color-field input[type="color"] {
  width: 31px;
  height: 29px;
  padding: 2px;
  border: 1px solid #3a414c;
  border-radius: 4px;
  background: #101318;
}

.color-field input[type="text"] {
  width: 100%;
  min-width: 0;
  height: 29px;
  padding: 5px 7px;
  border: 1px solid #3a414c;
  border-radius: 4px;
  background: #101318;
  color: #dfe2e7;
  font-family: var(--mono);
  font-size: 10px;
}

.color-field input:focus {
  border-color: #687381;
  outline: none;
}

.color-reset {
  margin-top: 12px;
  padding: 6px 10px;
  border: 1px solid #3a414c;
  border-radius: 4px;
  background: transparent;
  color: #aeb6c1;
  cursor: pointer;
  font-family: var(--shell-sans);
  font-size: 10px;
}

.color-reset:hover {
  border-color: #687381;
  color: #fff;
}

.trace-slider-track {
  position: relative;
  display: inline-flex;
  min-width: 240px;
  flex: 1 1 320px;
  align-items: center;
  padding-bottom: 13px;
}

.workspace-content .trace-slider-track input[type="range"] {
  width: 100%;
  min-width: 0;
  margin: 0;
}

.trace-timeline-marks {
  position: absolute;
  right: 9px;
  bottom: 0;
  left: 9px;
  height: 10px;
  color: #69727f;
  font-family: var(--shell-sans);
  font-size: 8px;
  line-height: 1;
  pointer-events: none;
}

.trace-timeline-marks > span {
  position: absolute;
  white-space: nowrap;
  transform: translateX(-50%);
}

#content.trace-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 210;
  width: 100vw;
  height: 100vh;
  padding: 132px 16px 18px;
  overflow: auto;
  background: #0d1014;
}

#subnav:has(+ #content.trace-fullscreen) {
  position: fixed;
  inset: 0 0 auto;
  z-index: 220;
  max-height: 122px;
  margin: 0;
  padding: 10px 14px;
  overflow: auto;
  border-bottom: 1px solid #303640;
  background: rgba(13, 16, 20, 0.98);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.34);
}

body:has(#content.trace-fullscreen) {
  overflow: hidden;
}

#content.trace-fullscreen .panel {
  min-height: calc(100vh - 152px);
}

#content.trace-light {
  --panel: #f7f8fa;
  --panel-2: #eef1f4;
  --fg: #181c22;
  --text: #181c22;
  --dim: #626a75;
  --faint: #858d98;
  --line: #d6dae0;
  --border: #d6dae0;
  --border-2: #c6cbd3;
  --grid: #d8dce2;
  --trace-zero: #f7f8fa;
  background: #f3f5f7;
  color: #181c22;
}

#content.trace-light .panel {
  border-color: #cfd4dc;
  background: #f7f8fa;
}

#content.trace-light .panel-h {
  border-bottom-color: #d6dae0;
  background: #eef1f4;
}

#content.trace-light .panel-h .t,
#content.trace-light .panel-h .sub,
#content.trace-light .sliderrow,
#content.trace-light .sliderrow .ts,
#content.trace-light .hint {
  color: #4e5661;
}

#content.trace-light .sbtn,
#content.trace-light .tglbtn {
  border-color: #c6cbd3;
  background: #fff;
  color: #4e5661;
}

#content.trace-light .tt {
  border-color: #c6cbd3;
  background: rgba(255, 255, 255, 0.97);
  color: #181c22;
}

.workspace-footer {
  margin-top: 24px;
  color: #505866;
  font-size: 9.5px;
  letter-spacing: 0.02em;
}

/* TRACE repeats its identity in the active nav and panel title. Reclaim that
   heading block so the 1440x900 first viewport includes the full timeline. */
#app[data-section="trace"] .workspace-scroll {
  padding-top: 14px;
  padding-bottom: 24px;
}

#app[data-section="trace"] .page-heading {
  display: none;
}

#app[data-section="trace"] .workspace-controls.subnav {
  margin-bottom: 7px;
}

/* TRACE desktop hierarchy follows the live product: identity/model row, one control row,
   then a borderless chart and a full-width replay timeline. */
#app[data-section="trace"] .workspace-controls:has(.trace-controls) {
  display: block;
}

.trace-heading-row {
  display: flex;
  min-height: 57px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.trace-heading-copy {
  min-width: 0;
  padding-top: 5px;
}

.trace-product-title {
  margin: 0;
  color: #f2f3f5;
  font-family: var(--shell-display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.trace-checked {
  margin-top: 4px;
  color: #747d89;
  font-size: 10px;
  line-height: 1.3;
}

.trace-heading-row .trace-model-row {
  width: auto;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  align-items: center;
  margin: 0;
  padding: 0;
  gap: 9px;
}

.trace-heading-row .trace-field {
  gap: 0;
}

.trace-heading-row .trace-field > span:first-child {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.trace-stability {
  width: 74px;
  height: 44px;
  flex: 0 0 auto;
}

.trace-controls {
  min-height: 52px;
  align-items: flex-start;
  gap: 10px;
  margin-top: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  flex-wrap: nowrap;
}

.trace-field,
.trace-range {
  font-size: 10px;
  font-weight: 520;
  letter-spacing: 0;
  text-transform: none;
}

.trace-field {
  gap: 6px;
}

.trace-controls .trace-field {
  display: flex;
  flex-direction: column-reverse;
}

.trace-field .tsel,
.trace-field .dinput {
  min-height: 40px;
  border-color: #2b6864;
  border-radius: 4px;
  background: #101317;
  font-size: 11px;
}

.trace-field .tsel {
  min-width: 0;
  padding: 8px 28px 8px 11px;
}

.trace-field:has([data-ctl="plot"]) .tsel { width: 72px; }
.trace-field:has([data-ctl="actor"]) .tsel { width: 118px; }
.trace-field:has([data-ctl="candleDur"]) .tsel { width: 76px; }
.trace-field:has([data-ctl="lens"]) .tsel { width: 126px; }
.trace-field.trace-date .dinput { width: 136px; min-width: 136px; }

.trace-switch {
  min-height: 40px;
  flex-direction: column;
  justify-content: flex-start;
  gap: 5px;
  padding: 0 2px;
}

.trace-switch .switch-track {
  width: 40px;
  height: 20px;
  border-color: #303740;
}

.trace-switch .switch-track::after {
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
}

.trace-switch input:checked + .switch-track::after {
  transform: translateX(19px);
}

.trace-switch b {
  font-size: 10px;
  font-weight: 520;
}

.trace-range {
  width: 108px;
  min-width: 108px;
  flex-direction: column;
  gap: 6px;
}

.trace-range input[type="range"] {
  width: 108px;
  height: 20px;
}

.trace-iconbtn {
  width: 40px;
  height: 40px;
  border-color: #2b6864;
  background: #101317;
  font-size: 15px;
}

.trace-controls .trace-iconbtn,
.trace-controls .popwrap {
  align-self: flex-start;
}

.trace-spacer {
  min-width: 4px;
  flex: 1 1 auto;
}

/* Keep the native selects legible at the compact desktop width used by the
   in-app browser.  The previous 28px right inset left only a few pixels for
   the selected label ("GEX" became visually "GI"). */
@media (min-width: 641px) and (max-width: 1300px) {
  .trace-controls {
    gap: 8px 9px;
    flex-wrap: wrap;
    align-items: flex-start;
    overflow: visible;
    padding-bottom: 4px;
  }
  .trace-controls > * { flex: 0 0 auto; }
  /* Keep the two product-control groups on deterministic rows.  A natural
     flex wrap lets the participant and zoom controls steal the first row at
     925px, which is what caused the labels/buttons to shift and overlap. */
  .trace-controls .trace-spacer {
    display: block;
    flex: 0 0 100%;
    width: 100%;
    min-width: 100%;
    height: 0;
    min-height: 0;
    margin: -2px 0 0;
    padding: 0;
  }
  .trace-controls .trace-iconbtn,
  .trace-controls .trace-switch,
  .trace-controls .trace-range,
  .trace-controls .trace-field,
  .trace-controls .popwrap { align-self: flex-start; }
  .trace-field .tsel {
    font-size: 10px;
    padding-right: 18px;
    padding-left: 8px;
  }
  .trace-field:has([data-ctl="plot"]) .tsel { width: 80px; }
  .trace-field:has([data-ctl="actor"]) .tsel { width: 130px; }
  .trace-field:has([data-ctl="candleDur"]) .tsel { width: 80px; }
  .trace-range,
  .trace-range input[type="range"] { width: 92px; min-width: 92px; }
  .trace-switch b { font-size: 9px; }
}

.trace-stage {
  position: relative;
  width: 100%;
  min-width: 0;
}

.trace-stage .chartwrap > div:first-child {
  scrollbar-color: #3ca9a5 transparent;
  scrollbar-width: thin;
}

.trace-zoom-reset {
  position: absolute;
  top: 6px;
  left: 7px;
  z-index: 3;
}

.trace-status:empty {
  display: none;
}

.workspace-content .sliderrow {
  min-height: 55px;
  flex-wrap: nowrap;
  gap: 8px;
  margin-top: 7px;
  overflow: visible;
}

.trace-slider-track {
  min-width: 0;
  flex: 1 1 auto;
  padding: 17px 0 20px;
}

.trace-timeline-marks {
  right: 2px;
  bottom: 1px;
  left: 2px;
  height: 12px;
  color: #8d96a2;
  font-size: 9px;
}

.trace-timeline-current {
  position: absolute;
  top: -12px;
  padding: 5px 8px;
  border-radius: 2px;
  background: #777b82;
  color: #fff;
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
  transform: translateX(-50%);
}

.trace-timeline-current::after {
  position: absolute;
  top: 100%;
  left: 50%;
  border: 4px solid transparent;
  border-top-color: #777b82;
  content: "";
  transform: translateX(-50%);
}

.sliderrow > .sbtn,
.trace-time-cutoff {
  flex: 0 0 auto;
}

.trace-settings-pop {
  width: min(350px, calc(100vw - 32px));
}

.trace-settings-pop .poprow {
  min-height: 38px;
  align-items: center;
}

@media (min-width: 1101px) {
  .trace-settings-pop,
  .trace-colors-pop {
    top: 0;
  }
}

.trace-settings-pop {
  padding: 13px 16px 14px;
}

.trace-settings-pop h4 {
  margin: 10px 0 7px;
  color: #4bb9b3;
  font-size: 10px;
  font-weight: 520;
  letter-spacing: 0;
  text-align: center;
  text-transform: none;
}

.trace-settings-pop h4:first-child {
  margin-top: 0;
}

.trace-settings-pop > .trace-pop-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
}

.trace-settings-pop > .trace-pop-grid .poprow {
  min-height: 45px;
  justify-content: center;
  gap: 8px;
  text-align: center;
}

.trace-settings-pop .tglbtn {
  position: relative;
  width: 40px;
  height: 20px;
  flex: 0 0 40px;
  padding: 0;
  border-color: #555b63;
  background: #f4f5f6;
  color: transparent;
  font-size: 0;
}

.trace-settings-pop .tglbtn::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #11151a;
  content: "";
  transition: transform 120ms ease, background 120ms ease;
}

.trace-settings-pop .tglbtn.on {
  border-color: #4bb9b3;
  background: #4bb9b3;
  color: transparent;
}

.trace-settings-pop .tglbtn.on::after {
  background: #e4f7f5;
  transform: translateX(19px);
}

.trace-settings-pop .trace-setting-row {
  min-height: 34px;
  padding: 0;
}

.trace-settings-pop .trace-setting-scaleRange,
.trace-settings-pop .trace-setting-hiroSym {
  display: grid;
  width: 100%;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  border: 0;
  border-radius: 0;
  overflow: visible;
}

.trace-settings-pop .trace-setting-scaleRange button,
.trace-settings-pop .trace-setting-hiroSym button {
  position: relative;
  min-height: 30px;
  padding: 4px 3px 4px 24px;
  border: 0;
  background: transparent;
  color: #eceef1;
  text-align: left;
}

.trace-settings-pop .trace-setting-scaleRange button::before,
.trace-settings-pop .trace-setting-hiroSym button::before {
  position: absolute;
  top: 50%;
  left: 3px;
  width: 15px;
  height: 15px;
  border: 2px solid #d8dadd;
  border-radius: 50%;
  content: "";
  transform: translateY(-50%);
}

.trace-settings-pop .trace-setting-scaleRange button.on,
.trace-settings-pop .trace-setting-hiroSym button.on {
  background: transparent;
  color: #fff;
  font-weight: 600;
}

.trace-settings-pop .trace-setting-scaleRange button.on::before,
.trace-settings-pop .trace-setting-hiroSym button.on::before {
  border-color: #4bb9b3;
  box-shadow: inset 0 0 0 3px #171b21, inset 0 0 0 8px #4bb9b3;
}

.trace-settings-pop .trace-setting-statsLookback {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(3, 1fr);
}

.trace-settings-pop .trace-setting-statsLookback button {
  min-height: 33px;
}

/* Keep the existing connection dialog and account flow, but align it with the shell. */
.connect-dialog {
  font-family: var(--shell-sans);
}

.connect-dialog .connect-field input,
.connect-dialog .connect-actions button {
  font-family: var(--shell-sans);
}

@media (max-width: 1100px) {
  .market-quote {
    min-width: 102px;
    padding-right: 11px;
    padding-left: 11px;
  }

  .topmeta {
    width: auto;
    min-width: max-content;
    flex-basis: auto;
    padding-right: 10px;
    padding-left: 10px;
  }

  .topmeta .signoutbtn {
    display: none;
  }

  .trace-settings-pop,
  .trace-colors-pop {
    position: fixed;
    top: 82px;
    right: 16px;
    left: auto;
  }

  #subnav:has(+ #content.trace-fullscreen) .trace-settings-pop,
  #subnav:has(+ #content.trace-fullscreen) .trace-colors-pop {
    top: 112px;
  }
}

@media (max-width: 820px) {
  #app.app-shell {
    grid-template-columns: 78px minmax(0, 1fr);
  }

  .app-sidebar {
    width: 78px;
  }

  .workspace-product {
    display: none;
  }

  .brand-link {
    justify-content: center;
    padding: 0;
  }

  .brand-copy,
  .sidebar-section-label,
  .nav-copy,
  .nav-soon,
  .sidebar-foot-copy {
    display: none;
  }

  .sidebar-scroll {
    padding-right: 11px;
    padding-left: 11px;
  }

  .sidebar-nav-item {
    justify-content: center;
    padding-right: 0;
    padding-left: 0;
  }

  .sidebar-nav-item.active::before {
    left: -11px;
  }

  .sidebar-foot-line {
    justify-content: center;
  }

  .workspace-scroll {
    padding-right: 18px;
    padding-left: 18px;
  }
}

@media (max-width: 640px) {
  #app.app-shell {
    display: block;
  }

  .app-sidebar {
    position: sticky;
    top: 0;
    display: grid;
    width: 100%;
    height: 54px;
    grid-template-columns: 58px minmax(0, 1fr);
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand-link {
    height: 53px;
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .brand-mark {
    width: 27px;
    height: 27px;
    font-size: 18px;
  }

  .sidebar-scroll {
    padding: 7px 8px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }

  .sidebar-scroll::-webkit-scrollbar {
    display: none;
  }

  #prodnav.prodnav,
  .sidebar-section {
    display: flex;
    width: max-content;
    gap: 3px;
    margin: 0;
  }

  .sidebar-section + .sidebar-section,
  .sidebar-disabled,
  .sidebar-foot {
    display: none;
  }

  .sidebar-nav-item {
    width: 42px;
    min-height: 38px;
    margin: 0;
  }

  .sidebar-nav-item.active::before {
    top: auto;
    right: 9px;
    bottom: -7px;
    left: 9px;
    width: auto;
    height: 2px;
  }

  .market-header {
    top: 54px;
    min-height: 51px;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .market-quote {
    min-width: 96px;
    padding-top: 7px;
    padding-bottom: 7px;
  }

  .topmeta {
    padding: 0 8px;
  }

  .topmeta > .iconbtn,
  .topmeta .account-label {
    display: none;
  }

  .account-trigger {
    width: 31px;
    justify-content: center;
    padding: 0;
  }

  .account-menu {
    right: 0;
    left: auto;
  }

  .workspace-scroll {
    padding: 18px 13px 42px;
  }

  .page-heading {
    margin-bottom: 16px;
  }

  .page-title {
    font-size: 22px;
  }

  .workspace-controls.subnav {
    align-items: flex-start;
    overflow: visible;
  }

  .trace-controls {
    width: 100%;
    max-width: 100%;
    padding-bottom: 7px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-color: #3ca9a5 transparent;
    scrollbar-width: thin;
  }

  .trace-controls > * {
    flex: 0 0 auto;
  }

  .trace-controls .trace-spacer {
    display: none;
  }

  .trace-pop-grid,
  .color-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .trace-settings-pop,
  .trace-colors-pop {
    top: 116px;
    right: 10px;
    width: calc(100vw - 20px);
    max-width: none;
  }

  #content.trace-fullscreen {
    padding: 150px 10px 12px;
  }

  #subnav:has(+ #content.trace-fullscreen) {
    max-height: 140px;
    padding: 8px 10px;
  }

  #login .pwline {
    flex-direction: column;
  }

  #login .pwline button {
    width: 100%;
  }

  .login-card {
    padding: 24px 20px;
  }
}
