:root {
  color-scheme: dark;
  --bg: #0d1118;
  --surface: #151a23;
  --surface-strong: #0f141c;
  --surface-soft: #1b202b;
  --text: #e7eaf0;
  --muted: #9aa3b2;
  --line: #303845;
  --line-soft: #242b36;
  --accent: #34c486;
  --accent-soft: rgba(52, 196, 134, 0.16);
  --amber: #e0a938;
  --chart-bg: #111620;
  --chart-grid: #27303d;
  --chart-text: #d7dde7;
  --sidebar: 390px;
  --radius: 8px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.25);
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

select {
  color-scheme: dark;
}

select option {
  color: #f2f4f8;
  background: #111620;
}

select option:checked {
  color: #ffffff;
  background: #2b5f9f;
}

button {
  cursor: pointer;
}

.app {
  display: grid;
  grid-template-rows: 1fr;
  height: 100vh;
  min-height: 100vh;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 320px);
  gap: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  padding: 0;
}

.main-panel,
.side-panel {
  min-height: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.main-panel {
  display: grid;
  grid-template-rows: auto 1fr;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.side-panel {
  display: grid;
  grid-template-rows: auto 1fr;
  border: 0;
  border-left: 1px solid #2b2b2b;
  border-radius: 0;
  background: #0a0a0b;
  box-shadow: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.asset-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 6px 12px;
  border-bottom: 1px solid #2b2b2b;
  background: #0a0a0b;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

.tv-avatar,
.tv-round-button {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  height: 38px;
  border: 1px solid transparent;
  background: transparent;
  color: #f2f4f8;
}

.tv-avatar {
  width: 38px;
  border-radius: 50%;
  background: #516574;
  font-size: 20px;
  font-weight: 800;
}

.tv-avatar:hover,
.tv-avatar:focus-visible,
.tv-avatar[aria-expanded="true"] {
  outline: none;
  background: #6d8395;
}

.tv-round-button {
  width: 38px;
  border-radius: 50%;
  font-size: 25px;
  line-height: 1;
}

.tv-round-button:hover,
.tv-round-button:focus-visible,
.tv-select:hover,
.tv-symbol-search:hover {
  outline: none;
  background: rgba(255, 255, 255, 0.08);
}

.tv-divider {
  flex: 0 0 auto;
  width: 1px;
  height: 34px;
  background: #343434;
}

.tv-symbol-search {
  display: grid;
  grid-template-columns: minmax(92px, 150px) 32px;
  flex: 0 0 auto;
  align-items: center;
  height: 38px;
  margin: 0;
  border: 1px solid #2c2c2c;
  border-radius: 999px;
  background: #303030;
  overflow: hidden;
}

.tv-symbol-search input,
.tv-symbol-search button {
  width: 100%;
  height: 100%;
  border: 0;
  outline: none;
  color: #f2f4f8;
  background: transparent;
}

.tv-symbol-search input {
  padding: 0 10px 0 15px;
  font-size: 15px;
  font-weight: 800;
  text-transform: uppercase;
}

.tv-symbol-search button {
  display: inline-grid;
  place-items: center;
  color: #d6d9df;
  font-size: 16px;
  font-weight: 800;
}

.tv-select {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  min-width: 48px;
  height: 38px;
  border-radius: 7px;
}

.tv-select select {
  width: 100%;
  height: 100%;
  padding: 0 8px;
  border: 0;
  outline: none;
  background: transparent;
  color: #f2f4f8;
  font-size: 15px;
  font-weight: 820;
  text-align: center;
  cursor: pointer;
}

.ticker-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 5px;
}

.ticker-row h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.1;
  font-weight: 800;
}

.selected-info p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 780;
}

.rating-badge {
  background: rgba(224, 169, 56, 0.16);
  color: #f5cf73;
}

.ghost-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 11px;
  border: 1px solid #343434;
  border-radius: 7px;
  color: var(--text);
  background: transparent;
  text-decoration: none;
  font-size: 12px;
  font-weight: 740;
  white-space: nowrap;
}

.mode-tabs {
  display: flex;
  flex: 0 0 auto;
  gap: 4px;
  padding: 0;
  border-bottom: 0;
  background: transparent;
}

.mode-tab,
.market-tab,
.range-button,
.timeframe-button,
.primary-button,
.secondary-button,
.icon-button,
.indicator-edit {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 12px;
  font-weight: 780;
}

.mode-tab,
.range-button,
.timeframe-button {
  min-width: 46px;
  padding: 0 10px;
}

.mode-tab {
  min-width: 74px;
  background: transparent;
}

.mode-tab.active,
.market-tab.active,
.range-button.active,
.timeframe-button.active,
.primary-button {
  border-color: rgba(8, 127, 91, 0.38);
  background: var(--accent);
  color: #07120d;
}

.range-button:disabled,
.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.primary-button {
  padding: 0 14px;
}

.primary-button.loading {
  opacity: 0.76;
}

.secondary-button {
  padding: 0 14px;
  background: transparent;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  padding: 0;
  color: #d7dde7;
  font-size: 28px;
  line-height: 1;
}

.primary-button.wide {
  width: 100%;
  margin-top: 12px;
}

.view {
  display: none;
  min-height: 0;
  overflow: hidden;
}

.view.active {
  display: grid;
}

.view-chart {
  grid-template-rows: 1fr;
}

.control-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  padding: 10px 14px 12px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(27, 32, 43, 0.72);
}

.toolbar-label {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 820;
  letter-spacing: 0;
  white-space: nowrap;
}

.toolbar-select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 820;
  letter-spacing: 0;
  white-space: nowrap;
}

.toolbar-select select {
  min-width: 132px;
  height: 34px;
  padding: 0 34px 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 12px;
  font-weight: 780;
}

.button-strip {
  flex-wrap: nowrap;
}

.indicator-group {
  border-color: rgba(52, 196, 134, 0.26);
  background: rgba(52, 196, 134, 0.06);
}

.range-buttons,
.timeframe-buttons,
.indicator-controls {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: nowrap;
}

.indicator-controls {
  justify-content: flex-start;
  flex: 0 0 auto;
}

.indicator-subgroup {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  padding-left: 9px;
  border-left: 1px solid rgba(255, 255, 255, 0.09);
}

.indicator-subgroup:first-child {
  padding-left: 0;
  border-left: 0;
}

.indicator-edit {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 330px;
  padding: 0 11px;
  color: var(--text);
  background: rgba(27, 32, 43, 0.92);
}

.asset-head .indicator-edit {
  flex: 0 0 auto;
  min-width: 138px;
  height: 38px;
  border-color: transparent;
  background: transparent;
  font-size: 16px;
}

.indicator-edit:hover,
.indicator-edit:focus-visible,
.secondary-button:hover,
.secondary-button:focus-visible,
.icon-button:hover,
.icon-button:focus-visible {
  border-color: rgba(52, 196, 134, 0.46);
  outline: none;
  box-shadow: 0 0 0 3px rgba(52, 196, 134, 0.12);
}

.indicator-edit span {
  color: #74d39c;
  font-size: 12px;
  font-weight: 820;
}

.asset-head .indicator-edit span {
  color: #f2f4f8;
  font-size: 16px;
}

.indicator-edit strong {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-head .indicator-edit strong {
  display: none;
}

.subgroup-label {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  color: #74d39c;
  font-size: 11px;
  font-weight: 820;
  white-space: nowrap;
}

.indicator-controls label,
.modal-grid label,
.form-grid label,
.optimizer-grid label,
.optimizer-context label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
  white-space: nowrap;
}

.indicator-controls input,
.indicator-controls select,
.modal-grid input,
.modal-grid select,
.form-grid input,
.form-grid select,
.optimizer-grid input,
.optimizer-context input,
.optimizer-context select {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: var(--surface-soft);
  font-size: 12px;
  font-weight: 730;
}

.indicator-controls input:not([type="checkbox"]),
.indicator-controls select,
.modal-grid input:not([type="checkbox"]),
.modal-grid select {
  width: 64px;
  padding: 0 8px;
}

.indicator-controls select,
.modal-grid select {
  width: 150px;
}

.indicator-controls input[type="checkbox"],
.modal-grid input[type="checkbox"] {
  width: 16px;
  height: 16px;
  padding: 0;
  accent-color: #3aff17;
}

.indicator-controls .check-control,
.modal-grid .check-control {
  gap: 6px;
}

.chart-shell {
  position: relative;
  --chart-tool-width: 54px;
  --chart-bottom-height: 40px;
  --rsi-panel-height: 152px;
  min-height: 0;
  overflow: hidden;
  background: var(--chart-bg);
}

#chart {
  position: absolute;
  inset: 0 0 calc(var(--chart-bottom-height) + var(--rsi-panel-height)) var(--chart-tool-width);
  width: auto;
  height: auto;
  min-height: 0;
}

.rsi-panel {
  position: absolute;
  right: 0;
  bottom: var(--chart-bottom-height);
  left: var(--chart-tool-width);
  z-index: 3;
  height: var(--rsi-panel-height);
  overflow: hidden;
  border-top: 1px solid #2d3542;
  background: var(--chart-bg);
}

#rsi-chart {
  position: absolute;
  inset: 0;
  width: auto;
  height: auto;
  min-height: 0;
}

.rsi-legend {
  position: absolute;
  top: 8px;
  left: 14px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: calc(100% - 24px);
  color: rgba(215, 221, 231, 0.72);
  font-size: 12px;
  font-weight: 720;
  pointer-events: none;
}

.rsi-legend strong {
  color: #d8dbe4;
  font-size: 13px;
  font-weight: 820;
}

.rsi-legend span,
.rsi-legend em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rsi-legend span {
  color: rgba(184, 187, 197, 0.74);
}

.rsi-legend em {
  color: #8fb7ff;
  font-style: normal;
}

.indicator-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: 2px;
  pointer-events: auto;
}

.indicator-action {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: inherit;
  opacity: 0.72;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.indicator-action svg {
  display: block;
  width: 14px;
  height: 14px;
}

.indicator-action:hover,
.indicator-action:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  opacity: 1;
  outline: none;
}

.indicator-eye[aria-pressed="false"] {
  opacity: 0.5;
}

.indicator-eye[aria-pressed="false"]::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 17px;
  height: 1.5px;
  background: currentColor;
  border-radius: 2px;
  transform: translate(-50%, -50%) rotate(-45deg);
}

.holding-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px 0 7px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: #d4dae3;
  font-size: 11px;
  font-weight: 820;
  white-space: nowrap;
  cursor: pointer;
  pointer-events: auto;
}

.holding-toggle svg {
  display: block;
  width: 14px;
  height: 14px;
}

.holding-toggle:hover,
.holding-toggle:focus-visible {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.1);
  outline: none;
}

.holding-toggle.active {
  border-color: rgba(63, 239, 156, 0.55);
  background: rgba(63, 239, 156, 0.18);
  color: #3fef9c;
}

.modal-section.hidden {
  display: none;
}

.modal-section.hidden + .modal-section {
  border-top: 0;
  padding-top: 0;
}

.chart-shell.rsi-hidden {
  --rsi-panel-height: 0px;
}

.chart-shell.rsi-hidden .rsi-panel {
  display: none;
}

.chart-legend {
  position: absolute;
  top: 9px;
  left: 70px;
  right: 18px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  color: #b7bbc5;
  font-size: 15px;
  font-weight: 720;
  pointer-events: none;
}

.chart-legend-main {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 34px;
}

.chart-legend strong {
  color: #d8dbe4;
  font-size: 16px;
  font-weight: 780;
}

.chart-legend em {
  overflow: hidden;
  color: rgba(184, 187, 197, 0.62);
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-indicator-row {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 100%;
  font-size: 12px;
  font-weight: 720;
  line-height: 1.2;
}

.chart-indicator-row strong {
  color: #d8dbe4;
  font-size: 13px;
  font-weight: 820;
}

.chart-indicator-row span {
  color: rgba(184, 187, 197, 0.74);
}

.chart-indicator-row em {
  color: #8fb7ff;
  font-style: normal;
}

.chart-legend .badge {
  min-width: 0;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
}

.info-dot {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #64b5f6;
  color: #0a1623;
  font-size: 18px;
  font-weight: 900;
}

.chart-tools {
  position: absolute;
  top: 0;
  bottom: var(--chart-bottom-height);
  left: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 4px;
  width: 54px;
  padding: 9px 7px;
  border-right: 1px solid #262626;
  background: #080809;
}

.chart-tools button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 7px;
  color: #e8e8e8;
  background: transparent;
  font-size: 22px;
  line-height: 1;
}

.chart-tools button[data-chart-tool="measure"] {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0;
}

.chart-tools button:hover,
.chart-tools button:focus-visible {
  outline: none;
  background: #343434;
}

.chart-tools button.active {
  color: #06110c;
  background: #78d29b;
}

#chart.measure-active {
  cursor: crosshair;
}

.measure-overlay {
  mix-blend-mode: normal;
}

.chart-nav {
  position: absolute;
  left: 50%;
  bottom: calc(var(--chart-bottom-height) + var(--rsi-panel-height) + 34px);
  z-index: 4;
  display: flex;
  gap: 6px;
  transform: translateX(-50%);
}

.chart-nav button {
  display: inline-grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px;
  background: rgba(42, 42, 42, 0.92);
  color: #f0f2f5;
  font-size: 18px;
  line-height: 1;
  font-weight: 560;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
}

.chart-nav button:hover,
.chart-nav button:focus-visible {
  border-color: rgba(255, 255, 255, 0.22);
  outline: none;
  background: rgba(57, 57, 57, 0.98);
}

.tv-bottom-bar {
  position: absolute;
  right: 0;
  bottom: 0;
  left: var(--chart-tool-width);
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--chart-bottom-height);
  padding: 0 10px;
  border-top: 1px solid #2b2b2b;
  background: #0a0a0b;
}

.tv-bottom-bar .range-buttons {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.tv-bottom-bar .range-button {
  min-width: 38px;
  height: 30px;
  border: 0;
  border-radius: 5px;
  color: #f2f4f8;
  background: transparent;
  font-size: 14px;
  font-weight: 760;
}

.tv-bottom-bar .range-button.active {
  color: #64b5f6;
  background: transparent;
}

.tv-bottom-bar .range-button:disabled {
  opacity: 0.34;
}

.period-menu {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  color: #aeb4c0;
  font-size: 12px;
  font-weight: 720;
}

.period-menu select {
  height: 30px;
  padding: 0 8px;
  border: 1px solid #343434;
  border-radius: 7px;
  color: #f2f4f8;
  background: #242424;
  font-size: 12px;
  font-weight: 760;
}

.loader {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 24px;
  color: #d7dde7;
  background: rgba(21, 24, 33, 0.94);
  font-size: 14px;
  text-align: center;
  pointer-events: none;
}

.loader.hidden {
  display: none;
}

.profile-menu {
  position: fixed;
  inset: 0;
  z-index: 70;
  pointer-events: none;
}

.profile-menu.hidden {
  display: none;
}

.profile-menu-backdrop {
  position: absolute;
  inset: 0;
  background: transparent;
  pointer-events: auto;
}

.profile-card {
  position: absolute;
  top: 62px;
  left: 12px;
  z-index: 1;
  width: min(336px, calc(100vw - 24px));
  overflow: hidden;
  border: 1px solid #343434;
  border-radius: 8px;
  background: #111112;
  color: #e8ebf0;
  box-shadow: 0 22px 56px rgba(0, 0, 0, 0.58);
  pointer-events: auto;
}

.profile-card-head {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid #2b2b2b;
}

.profile-avatar-large {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  color: #ffffff;
  background: #516574;
  font-size: 24px;
  font-weight: 860;
}

.profile-heading {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.profile-heading strong {
  overflow: hidden;
  font-size: 16px;
  line-height: 1.2;
  font-weight: 820;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-heading span,
.profile-user-line span,
.profile-status,
.profile-stats small {
  color: #9299a4;
  font-size: 12px;
  line-height: 1.3;
}

.profile-close {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 7px;
  color: #d9dce2;
  background: transparent;
  font-size: 28px;
  line-height: 1;
}

.profile-close:hover,
.profile-close:focus-visible {
  outline: none;
  background: rgba(255, 255, 255, 0.08);
}

.profile-signed-in,
.profile-signed-out {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.profile-signed-in.hidden,
.profile-signed-out.hidden,
.profile-form.hidden {
  display: none;
}

.profile-user-line {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.profile-user-line strong,
.profile-user-line span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-user-line strong {
  font-size: 18px;
  line-height: 1.2;
}

.profile-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.profile-stats span {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid #2b2b2b;
  border-radius: 7px;
  background: #181819;
}

.profile-stats strong {
  color: #e7eaf0;
  font-size: 13px;
}

.profile-auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 3px;
  border: 1px solid #303030;
  border-radius: 7px;
  background: #181819;
}

.profile-auth-tabs button {
  min-height: 34px;
  border: 0;
  border-radius: 5px;
  color: #bcc2ca;
  background: transparent;
  font-size: 12px;
  font-weight: 780;
}

.profile-auth-tabs button.active {
  color: #07120d;
  background: var(--accent);
}

.profile-form {
  display: grid;
  gap: 10px;
}

.profile-form label {
  display: grid;
  gap: 5px;
  color: #9aa3b2;
  font-size: 11px;
  font-weight: 760;
}

.profile-form input {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 1px solid #303845;
  border-radius: 7px;
  outline: none;
  color: #f2f4f8;
  background: #1b202b;
  font-size: 13px;
  font-weight: 700;
}

.profile-form input:focus {
  border-color: rgba(52, 196, 134, 0.68);
  box-shadow: 0 0 0 1px rgba(52, 196, 134, 0.2);
}

.profile-wide {
  width: 100%;
  min-height: 38px;
}

.profile-status {
  min-height: 16px;
  margin: 0;
  padding: 0 14px 14px;
}

.profile-status.error {
  color: #ff8b8b;
}

.profile-status.success {
  color: #72db9d;
}

.symbol-search-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(10, 10, 10, 0.58);
  backdrop-filter: blur(2px);
}

.symbol-search-modal.hidden {
  display: none;
}

.symbol-search-backdrop {
  position: absolute;
  inset: 0;
}

.symbol-search-panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  width: min(960px, calc(100vw - 36px));
  max-height: min(760px, calc(100vh - 42px));
  overflow: hidden;
  border: 1px solid #343434;
  border-radius: 8px;
  background: #1f1f1f;
  color: #e3e5ea;
  box-shadow: 0 26px 84px rgba(0, 0, 0, 0.62);
}

.symbol-search-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 16px;
}

.symbol-search-head h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.15;
  font-weight: 820;
}

.symbol-search-close,
.symbol-search-clear {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border: 0;
  color: #d9dce2;
  background: transparent;
  cursor: pointer;
}

.symbol-search-close {
  width: 38px;
  height: 38px;
  border-radius: 7px;
  font-size: 34px;
  font-weight: 260;
  line-height: 1;
}

.symbol-search-close:hover,
.symbol-search-close:focus-visible,
.symbol-search-clear:hover,
.symbol-search-clear:focus-visible {
  outline: none;
  background: rgba(255, 255, 255, 0.09);
}

.symbol-search-form {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: center;
  min-height: 76px;
  margin: 0 24px;
  border: 1px solid #6b6c72;
  border-radius: 8px;
  background: #1e1e1e;
}

.symbol-search-form:focus-within {
  border-color: #8d8f96;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.symbol-search-icon {
  position: relative;
  width: 20px;
  height: 20px;
  margin-left: 16px;
  border: 3px solid #9a9ca3;
  border-radius: 999px;
}

.symbol-search-icon::after {
  content: "";
  position: absolute;
  right: -9px;
  bottom: -8px;
  width: 12px;
  height: 3px;
  border-radius: 999px;
  background: #9a9ca3;
  transform: rotate(45deg);
  transform-origin: left center;
}

.symbol-search-form input {
  width: 100%;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: none;
  color: #f4f5f7;
  background: transparent;
  font-size: 25px;
  font-weight: 760;
  text-transform: uppercase;
}

.symbol-search-form input::placeholder {
  color: #8c8e95;
  text-transform: none;
}

.symbol-search-clear {
  width: 32px;
  height: 32px;
  margin-right: 10px;
  border-radius: 999px;
  color: #151515;
  background: #a9abb1;
  font-size: 24px;
  line-height: 1;
}

.symbol-search-clear:hover,
.symbol-search-clear:focus-visible {
  background: #c5c7cc;
}

.symbol-search-clear:disabled {
  opacity: 0;
  pointer-events: none;
}

.symbol-search-tabs {
  display: flex;
  gap: 8px;
  padding: 22px 24px 14px;
  overflow-x: auto;
  scrollbar-width: none;
}

.symbol-search-tabs button {
  flex: 0 0 auto;
  height: 42px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  color: #d7d9df;
  background: #303030;
  font-size: 16px;
  font-weight: 760;
  cursor: pointer;
}

.symbol-search-tabs button.active {
  color: #171717;
  background: #f3f4f6;
}

.symbol-search-results {
  min-height: 0;
  overflow: auto;
  padding: 0 0 18px;
  scrollbar-width: thin;
}

.symbol-search-row {
  display: grid;
  grid-template-columns: 54px minmax(86px, 130px) minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 64px;
  padding: 9px 24px;
  border: 0;
  border-top: 1px solid #393939;
  color: #e4e6eb;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.symbol-search-row:hover,
.symbol-search-row:focus-visible {
  outline: none;
  background: #3d3d3d;
}

.symbol-search-badge {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  color: #d7defc;
  background: #4462f2;
  font-size: 16px;
  font-weight: 860;
  text-transform: uppercase;
}

.symbol-search-ticker {
  overflow: hidden;
  color: #5f75ff;
  font-size: 20px;
  font-weight: 820;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.symbol-search-name {
  overflow: hidden;
  color: #dadce2;
  font-size: 17px;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.symbol-search-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
  color: #a1a3aa;
  font-size: 15px;
  font-weight: 680;
  white-space: nowrap;
}

.symbol-search-market {
  color: #d6d8de;
  font-weight: 820;
}

.symbol-search-empty {
  display: grid;
  place-items: center;
  min-height: 220px;
  padding: 28px;
  color: #a6a8af;
  border-top: 1px solid #393939;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: block;
  padding: 0;
  pointer-events: none;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 13, 0.18);
  pointer-events: none;
}

.modal-panel {
  position: absolute;
  top: 72px;
  left: 72px;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(420px, calc(100vw - 24px));
  max-height: min(620px, calc(100vh - 92px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #1a1a1a;
  color: var(--text);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.54);
  pointer-events: auto;
}

.modal-head,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
}

.modal-head {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  cursor: grab;
  user-select: none;
}

.modal-panel.dragging .modal-head {
  cursor: grabbing;
}

.modal-head h2 {
  margin: 0;
  font-size: 15px;
  line-height: 1.2;
  font-weight: 820;
}

.modal-head p {
  display: none;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.modal-body {
  overflow: auto;
  padding: 10px 12px 4px;
  scrollbar-width: thin;
}

.modal-section {
  padding: 0 0 10px;
}

.modal-section + .modal-section {
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-section h3 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  font-weight: 820;
  text-transform: uppercase;
}

.modal-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.modal-grid label {
  align-items: stretch;
  flex-direction: column;
  gap: 5px;
  font-size: 11px;
}

.modal-grid .check-control {
  align-items: center;
  flex-direction: row;
  min-height: 32px;
}

.modal-grid input:not([type="checkbox"]),
.modal-grid select {
  width: 100%;
  height: 32px;
  font-size: 12px;
}

.compact-grid {
  grid-template-columns: 1fr;
}

.modal-grid label.rsi-height-control {
  gap: 7px;
}

.rsi-height-control .rsi-height-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.rsi-height-control .rsi-height-head output {
  color: var(--text);
  font-size: 11px;
  font-weight: 820;
  font-variant-numeric: tabular-nums;
}

.modal-grid input[type="range"].rsi-height-slider {
  width: 100%;
  height: 22px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  accent-color: #3aff17;
  cursor: pointer;
}

.modal-actions {
  justify-content: flex-end;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: #1a1a1a;
}

.modal-actions .primary-button,
.modal-actions .secondary-button {
  min-width: 96px;
  min-height: 34px;
  font-size: 12px;
}

.view-backtest {
  grid-template-rows: auto auto auto minmax(220px, 1fr);
  gap: 12px;
  overflow: auto;
  padding: 14px;
}

.view-optimizer {
  overflow: auto;
  padding: 14px;
}

.view-optimizer.active {
  display: block;
}

.view-optimizer > .tool-grid {
  margin-bottom: 12px;
}

.tool-grid {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  gap: 12px;
}

.tool-panel,
.metrics-panel,
.trades-panel,
.table-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.tool-panel,
.metrics-panel {
  padding: 14px;
}

.tool-panel h3,
.metrics-panel h3,
.trades-panel h3,
.table-panel h3 {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.2;
}

.form-grid,
.optimizer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.form-grid label,
.optimizer-grid label,
.optimizer-context label,
.optimizer-asset-form label {
  align-items: stretch;
  flex-direction: column;
}

.form-grid input,
.form-grid select,
.optimizer-grid input,
.optimizer-context input,
.optimizer-context select {
  width: 100%;
  padding: 0 9px;
}

.optimizer-context {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(120px, 0.65fr);
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}

.optimizer-asset-form {
  margin: 0;
}

.optimizer-asset-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.optimizer-asset-control .secondary-button {
  min-height: 32px;
  padding: 0 12px;
}

.optimizer-scope-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.optimizer-scope-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 32px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.optimizer-scope-toggle button {
  min-width: 0;
  border: 0;
  border-right: 1px solid var(--line-soft);
  color: var(--muted);
  background: transparent;
  font-size: 11px;
  font-weight: 820;
}

.optimizer-scope-toggle button:last-child {
  border-right: 0;
}

.optimizer-scope-toggle button:hover,
.optimizer-scope-toggle button:focus-visible,
.optimizer-scope-toggle button.active {
  color: var(--text);
  background: rgba(8, 127, 91, 0.14);
  outline: none;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
}

.metric {
  min-height: 72px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface-soft);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 18px;
  line-height: 1.1;
}

.positive {
  color: #087f5b;
}

.negative {
  color: #c92a2a;
}

.trades-panel {
  min-height: 0;
  padding: 14px;
}

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.panel-title-row h3 {
  margin: 0;
}

.panel-title-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 740;
  text-align: right;
}

.trade-timeline {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(188px, 1fr);
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 3px;
  scrollbar-width: thin;
}

.equity-chart {
  width: 100%;
  height: 260px;
  min-height: 260px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #111620;
}

.trade-card {
  min-height: 98px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-left: 4px solid #94a3b8;
  border-radius: 8px;
  color: var(--text);
  background: var(--surface-soft);
  text-align: left;
}

.trade-card:hover,
.trade-card:focus-visible,
.mini-button:hover,
.mini-button:focus-visible {
  border-color: rgba(8, 127, 91, 0.45);
  outline: none;
  box-shadow: 0 0 0 3px rgba(8, 127, 91, 0.12);
}

.trade-card.winner {
  border-left-color: #089981;
}

.trade-card.loser {
  border-left-color: #f23645;
}

.trade-card-top,
.trade-card-dates,
.trade-card-prices {
  display: block;
}

.trade-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.trade-card-top strong {
  font-size: 12px;
  line-height: 1.25;
}

.trade-card-dates {
  margin-top: 10px;
  color: var(--text);
  font-size: 12px;
  font-weight: 760;
}

.trade-card-prices {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.empty-trades {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
}

.table-panel {
  min-height: 0;
  overflow: hidden;
}

.table-panel h3 {
  padding: 14px 14px 0;
}

.optimizer-ranking-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.optimizer-ranking-toolbar span {
  margin-right: auto;
}

.optimizer-equity-panel,
.optimizer-detail-panel {
  margin-bottom: 12px;
}

.optimizer-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 0;
}

.optimizer-detail-head h3 {
  padding: 0;
}

.optimizer-detail-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 740;
  text-align: right;
}

.optimizer-detail-wrap {
  max-height: 310px;
}

.table-wrap {
  overflow: auto;
  max-height: 420px;
  padding: 0 14px 14px;
}

.view-optimizer .table-wrap {
  max-height: none;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

th,
td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 820;
}

.optimizer-sort-button {
  height: 28px;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  font-weight: 820;
  text-align: left;
  white-space: nowrap;
}

.optimizer-sort-button:hover,
.optimizer-sort-button:focus-visible,
.optimizer-sort-button.active {
  color: var(--text);
  outline: none;
}

.mini-button {
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--accent);
  background: var(--surface-soft);
  font-size: 11px;
  font-weight: 820;
}

.mini-button:disabled {
  cursor: not-allowed;
  color: var(--muted);
  opacity: 0.55;
}

.optimizer-apply {
  min-width: 48px;
}

.hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.side-head {
  position: relative;
  z-index: 4;
  padding: 0;
  border-bottom: 1px solid #2b2b2b;
  background: #0c0c0d;
}

.side-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 62px;
  padding: 10px 12px 8px;
}

.side-title-block {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.side-head h2 {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: #d7d8dd;
  font-size: 18px;
  font-weight: 780;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-head h2 span {
  color: #d7d8dd;
  font-size: 16px;
  font-weight: 700;
}

.side-title-block > span {
  color: #8e949e;
  font-size: 11px;
  font-weight: 720;
  white-space: nowrap;
}

.side-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.side-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border: 1px solid #2b2b2b;
  border-radius: 7px;
  background: #101114;
}

.side-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 1 1 78px;
  min-width: 0;
  height: 30px;
  border: 0;
  border-radius: 6px;
  color: #aeb4c0;
  background: transparent;
  font-size: 11px;
  font-weight: 820;
}

.side-tab span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  color: #07120d;
  background: #3fef9c;
  font-size: 10px;
  font-weight: 860;
}

.side-tab.active {
  color: #07120d;
  background: var(--accent);
}

.side-tab:not(.active) span {
  color: #d7dde7;
  background: #242a35;
}

.watchlist-add {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid transparent;
  border-radius: 0;
  color: #f2f4f8;
  background: transparent;
  font-size: 34px;
  font-weight: 260;
  line-height: 1;
}

.watchlist-add:hover,
.watchlist-add:focus-visible {
  outline: none;
  background: rgba(255, 255, 255, 0.08);
}

.watchlist-add:disabled {
  cursor: wait;
  opacity: 0.62;
}

.market-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border: 1px solid #2b2b2b;
  border-radius: 7px;
  background: #141415;
}

.side-market-quick {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 0 10px 8px;
  background: #0c0c0d;
}

.side-market-quick .market-tab {
  min-height: 28px;
  border-color: #24262b;
  background: #101114;
  color: #9ca3ad;
  font-size: 11px;
  font-weight: 760;
}

.side-market-quick .market-tab.active {
  border-color: transparent;
  background: #35c48a;
  color: #07120d;
}

.market-tab {
  border: 0;
  background: transparent;
}

.sector-filter {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.perennial-filter-button,
.quality-filter-button {
  width: 100%;
  height: 30px;
  padding: 0 7px;
  overflow: hidden;
  border: 1px solid #2b2f3b;
  border-radius: 7px;
  color: #aeb4c0;
  background: #141820;
  font-size: 11px;
  font-weight: 820;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.perennial-filter-button:hover,
.perennial-filter-button:focus-visible,
.quality-filter-button:hover,
.quality-filter-button:focus-visible {
  outline: none;
  color: #f2f4f8;
  border-color: #3c4454;
}

.perennial-filter-button.active,
.perennial-filter-button[aria-pressed="true"],
.quality-filter-button.active,
.quality-filter-button[aria-pressed="true"] {
  color: #07120d;
  border-color: transparent;
  background: var(--accent);
}

.watchlist-sort {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
}

.watchlist-sort.hidden,
.band-alert-controls.hidden,
.watchlist-table-head.hidden {
  display: none;
}

.sort-button {
  min-width: 0;
  height: 28px;
  padding: 0 5px;
  overflow: hidden;
  border: 1px solid #2b2f3b;
  border-radius: 7px;
  color: #aeb4c0;
  background: #141820;
  font-size: 10px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sort-button:hover,
.sort-button:focus-visible {
  color: #f2f4f8;
  border-color: #3c4454;
}

.sort-button.active {
  color: #07120d;
  border-color: transparent;
  background: var(--accent);
}

.band-alert-controls {
  display: grid;
  gap: 7px;
}

.band-alert-range {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 6px;
}

.band-alert-range label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  min-width: 0;
  height: 30px;
  padding: 0 7px;
  border: 1px solid #2b2f3b;
  border-radius: 7px;
  color: #aeb4c0;
  background: #141820;
  font-size: 10px;
  font-weight: 800;
}

.band-alert-range input {
  min-width: 0;
  width: 100%;
  height: 22px;
  padding: 0;
  border: 0;
  outline: none;
  color: #f2f4f8;
  background: transparent;
  font-size: 12px;
  font-weight: 820;
  text-align: right;
}

.band-alert-controls .mini-button {
  min-width: 52px;
  height: 30px;
}

#band-alert-status {
  color: #88909e;
  font-size: 11px;
  font-weight: 720;
}

.side-menu {
  position: relative;
}

.side-menu summary {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 0;
  color: #d7d8dd;
  list-style: none;
  cursor: pointer;
}

.side-menu summary::-webkit-details-marker {
  display: none;
}

.side-menu summary span {
  position: relative;
  top: -2px;
  font-size: 24px;
  font-weight: 760;
  letter-spacing: 2px;
}

.side-menu summary:hover,
.side-menu summary:focus-visible,
.side-menu[open] summary {
  outline: none;
  background: rgba(255, 255, 255, 0.08);
}

.side-menu-panel {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  width: min(304px, calc(100vw - 20px));
  padding: 10px;
  border: 1px solid #313131;
  border-radius: 8px;
  background: #111112;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.46);
}

.side-menu-section {
  display: grid;
  gap: 6px;
}

.side-menu-section + .side-menu-section {
  margin-top: 10px;
}

.side-menu-label {
  color: #7f858d;
  font-size: 10px;
  font-weight: 820;
  letter-spacing: 0;
  text-transform: uppercase;
}

.watchlist-table-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(84px, auto);
  align-items: center;
  gap: 5px;
  height: 36px;
  padding: 0 10px;
  border-top: 1px solid transparent;
  border-bottom: 1px solid #303030;
  background: #0c0c0d;
}

.watchlist-table-head .sort-button {
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #9a9a9f;
  font-size: 13px;
  font-weight: 620;
  text-align: right;
}

.watchlist-table-head .sort-button:first-child {
  text-align: left;
}

.watchlist-table-head .sort-button.active {
  color: #d7d8dd;
  background: transparent;
}

.filters {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  margin: 0;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface);
}

.filters input,
.filters button {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
  color: var(--text);
  background: var(--surface-soft);
  font-size: 13px;
}

.filters button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  padding: 0;
  color: var(--accent);
  font-size: 18px;
  font-weight: 820;
}

.filters span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 12px;
  font-weight: 780;
}

.side-body {
  display: grid;
  min-height: 0;
}

.side-content {
  grid-area: 1 / 1;
  min-height: 0;
}

.side-content:not(.active) {
  display: none;
}

.stock-list,
.band-alert-list {
  min-height: 0;
  overflow: auto;
  padding: 0;
  background: #0c0c0d;
  scrollbar-width: thin;
}

.rating-group {
  position: sticky;
  top: -8px;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 8px 7px;
  background: rgba(21, 26, 35, 0.96);
  color: #f5cf73;
  backdrop-filter: blur(6px);
  font-size: 12px;
  font-weight: 820;
}

.rating-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--amber);
}

.stock-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(104px, auto);
  gap: 8px;
  align-items: center;
  width: 100%;
  min-height: 62px;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: inherit;
  background: transparent;
  text-align: left;
}

.stock-row:hover {
  background: var(--surface-soft);
  border-color: var(--line-soft);
}

.stock-row:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(113, 197, 141, 0.68);
}

.stock-row.active {
  background: rgba(52, 196, 134, 0.14);
  border-color: rgba(52, 196, 134, 0.36);
  box-shadow: none;
}

.rank {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 7px;
  background: #323f91;
  color: #f2f4f8;
  font-size: 13px;
  font-weight: 900;
}

.rank[data-market="US"] {
  background: #303238;
}

.stock-row.active .rank {
  background: #4dd894;
  color: #07120d;
}

.stock-symbol {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.stock-info {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.stock-code-wrap {
  display: inline-flex;
  align-items: baseline;
  min-width: 0;
  gap: 5px;
}

.stock-market {
  color: #f2b134;
  font-size: 9px;
  font-weight: 860;
  line-height: 1;
}

.stock-name {
  display: none;
}

.stock-name-inline {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: #d8d9de;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-meta-line {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: #9ba8bd;
  font-size: 11px;
  font-weight: 760;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-rating-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 22px;
  justify-self: end;
  padding: 0 8px;
  border-radius: 999px;
  color: #f5cf73;
  background: rgba(224, 169, 56, 0.16);
  font-size: 12px;
  font-weight: 860;
  line-height: 1;
  white-space: nowrap;
}

.stock-code {
  display: block;
  min-width: 0;
  max-width: 92px;
  height: auto;
  padding: 0;
  overflow: hidden;
  border-radius: 0;
  background: transparent;
  color: #d8d9de;
  font-size: 16px;
  font-weight: 720;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-row.active .stock-code {
  color: #f2f4f8;
}

.stock-row.active .stock-name-inline {
  color: #f2f4f8;
}

.symbol-search-rating {
  color: #f7d37c;
  font-weight: 820;
}

.stock-quote {
  display: grid;
  gap: 5px;
  justify-items: end;
  min-width: 0;
}

.stock-price,
.stock-change {
  display: block;
  min-width: 0;
  overflow: hidden;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 760;
  line-height: 1;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-price {
  color: #d8d9de;
  font-size: 14px;
  font-weight: 820;
}

.stock-change.positive {
  color: #6fbda8;
}

.stock-change.negative {
  color: #ff5963;
}

.stock-change.neutral,
.stock-change.muted,
.stock-price.muted {
  color: #747b89;
}

.band-alert-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  border: 1px solid transparent;
  border-radius: 8px;
}

.band-alert-row:hover,
.band-alert-row:focus-within {
  outline: none;
  background: var(--surface-soft);
  border-color: var(--line-soft);
}

.band-alert-row.active {
  background: rgba(52, 196, 134, 0.14);
  border-color: rgba(52, 196, 134, 0.36);
}

.band-alert-open {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) minmax(92px, auto);
  gap: 8px;
  align-items: center;
  min-width: 0;
  min-height: 62px;
  padding: 8px 4px 8px 9px;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.band-alert-buy {
  align-self: center;
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-right: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.05);
  color: #c4cad6;
  cursor: pointer;
}

.band-alert-buy svg {
  width: 15px;
  height: 15px;
}

.band-alert-buy:hover,
.band-alert-buy:focus-visible {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.12);
  outline: none;
}

.band-alert-buy.active {
  border-color: rgba(63, 239, 156, 0.55);
  background: rgba(63, 239, 156, 0.18);
  color: #3fef9c;
}

.band-alert-level {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 34px;
  border-radius: 7px;
  color: #07120d;
  background: #3fef9c;
  font-size: 13px;
  font-weight: 900;
}

.band-alert-meta {
  min-width: 0;
}

.band-alert-name {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.band-alert-detail {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.band-alert-price {
  display: grid;
  justify-items: end;
  gap: 3px;
  min-width: 0;
}

.band-alert-price strong,
.band-alert-price span {
  display: block;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.band-alert-price strong {
  color: #f2f4f8;
  font-size: 11px;
  font-weight: 820;
}

.band-alert-price span {
  color: #ff6b72;
  font-size: 11px;
  font-weight: 820;
}

.band-alert-price .band-alert-distance {
  color: #7ee5a2;
}

.band-alert-price .stock-rating-chip {
  display: inline-flex;
  max-width: none;
  color: #f5cf73;
  font-size: 12px;
  font-weight: 860;
}

.band-alert-hint {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0 0 4px;
  padding: 9px 11px;
  border: 1px solid rgba(63, 239, 156, 0.24);
  border-radius: 8px;
  background: rgba(12, 20, 16, 0.97);
  color: #c1cad6;
  font-size: 11px;
  font-weight: 640;
  line-height: 1.45;
}

.band-alert-hint strong {
  color: #8ff0c0;
  font-weight: 820;
}

.holding-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px;
}

.holding-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  align-items: stretch;
  border: 1px solid transparent;
  border-radius: 8px;
}

.holding-row:hover,
.holding-row:focus-within {
  background: var(--surface-soft);
  border-color: var(--line-soft);
}

.holding-row.active {
  background: rgba(52, 196, 134, 0.14);
  border-color: rgba(52, 196, 134, 0.36);
}

.holding-open {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 9px 4px 9px 9px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.holding-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.holding-head .stock-rating-chip {
  flex: 0 0 auto;
  min-width: 42px;
  color: #f5cf73;
  font-size: 12px;
  font-weight: 860;
}

.holding-name {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.holding-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.holding-stat {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.holding-stat small {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.holding-stat b {
  color: #f2f4f8;
  font-size: 12px;
  font-weight: 820;
  font-variant-numeric: tabular-nums;
}

.holding-stat i {
  color: var(--muted);
  font-size: 10px;
  font-weight: 760;
  font-style: normal;
}

.holding-stat i.pos {
  color: #3fef9c;
}

.holding-stat i.neg {
  color: #f2616a;
}

.holding-exit small {
  color: #8fb7ff;
}

.holding-exit b {
  color: #cfe0ff;
}

.holding-remove {
  align-self: stretch;
  width: 30px;
  border: 0;
  border-radius: 0 8px 8px 0;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.holding-remove:hover,
.holding-remove:focus-visible {
  background: rgba(242, 97, 106, 0.16);
  color: #f2616a;
  outline: none;
}

.empty {
  padding: 28px 16px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 16px;
}

.confirm-modal.hidden {
  display: none;
}

.confirm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 13, 0.62);
}

.confirm-card {
  position: relative;
  z-index: 1;
  width: min(420px, calc(100vw - 32px));
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #16181d;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
}

.confirm-head {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 12px;
}

.confirm-icon {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 10px;
  background: rgba(63, 239, 156, 0.16);
  color: #3fef9c;
}

.confirm-icon svg {
  width: 20px;
  height: 20px;
}

.confirm-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 820;
}

.confirm-text {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.confirm-text strong {
  color: var(--text);
  font-weight: 780;
}

.confirm-examples {
  display: grid;
  gap: 3px;
  margin: 0 0 18px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
}

.confirm-examples span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 720;
}

.confirm-examples strong {
  color: #8ff0c0;
  font-size: 14px;
  font-weight: 820;
  letter-spacing: 0.3px;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.confirm-actions .secondary-button,
.confirm-actions .primary-button {
  min-width: 120px;
  min-height: 38px;
}

.mobile-back {
  display: none;
}

@media (max-width: 1100px) {
  body,
  .app {
    height: 100vh;
  }

  body {
    overflow: hidden;
  }

  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) minmax(170px, 24vh);
    height: 100%;
    overflow: hidden;
  }

  .side-panel {
    border-left: 0;
    border-top: 1px solid #2b2b2b;
    overflow: visible;
  }

  .side-menu-panel {
    top: auto;
    bottom: calc(100% + 9px);
    max-height: min(58vh, 380px);
    overflow: auto;
  }

  .tool-grid,
  .metrics {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 660px) {
  .symbol-search-modal {
    align-items: start;
    padding: 10px;
  }

  .symbol-search-panel {
    width: 100%;
    max-height: calc(100vh - 20px);
  }

  .symbol-search-head {
    padding: 16px 14px 12px;
  }

  .symbol-search-head h2 {
    font-size: 22px;
  }

  .symbol-search-form {
    grid-template-columns: 38px minmax(0, 1fr) 38px;
    min-height: 58px;
    margin: 0 14px;
  }

  .symbol-search-form input {
    font-size: 20px;
  }

  .symbol-search-tabs {
    padding: 14px 14px 10px;
  }

  .symbol-search-tabs button {
    height: 36px;
    padding: 0 14px;
    font-size: 14px;
  }

  .symbol-search-row {
    grid-template-columns: 38px minmax(72px, 96px) minmax(0, 1fr);
    gap: 10px;
    min-height: 58px;
    padding: 8px 14px;
  }

  .symbol-search-badge {
    width: 30px;
    height: 30px;
    font-size: 14px;
  }

  .symbol-search-ticker {
    font-size: 17px;
  }

  .symbol-search-name {
    font-size: 15px;
  }

  .symbol-search-meta {
    grid-column: 2 / -1;
    justify-content: flex-start;
    gap: 8px;
    overflow: hidden;
    font-size: 12px;
  }

  .asset-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .workspace {
    padding: 0;
    gap: 0;
    grid-template-rows: minmax(0, 1fr) 180px;
  }

  .asset-head {
    align-items: center;
    flex-direction: row;
    min-height: 52px;
    padding: 10px 12px;
  }

  .tv-symbol-search {
    grid-template-columns: minmax(82px, 1fr) 30px;
  }

  .ghost-link {
    display: none;
  }

  .mode-tabs {
    overflow-x: auto;
  }

  .control-bar {
    align-items: center;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .toolbar-group {
    align-items: center;
  }

  .indicator-controls {
    align-items: center;
    justify-content: flex-start;
  }

  .indicator-subgroup {
    align-items: center;
  }

  .indicator-controls label {
    width: auto;
  }

  .indicator-edit {
    min-width: 122px;
  }

  .toolbar-select select {
    min-width: 124px;
  }

  .modal {
    padding: 10px;
  }

  .modal-panel {
    width: min(360px, calc(100vw - 16px));
    max-height: calc(100vh - 70px);
  }

  .modal-head,
  .modal-actions {
    padding: 14px;
  }

  .modal-body {
    padding: 14px 14px 4px;
  }

  .modal-grid,
  .compact-grid {
    grid-template-columns: 1fr;
  }

  .profile-card {
    top: 58px;
    left: 10px;
    width: min(336px, calc(100vw - 20px));
  }

  .form-grid,
  .optimizer-grid,
  .optimizer-context {
    grid-template-columns: 1fr;
  }

  .optimizer-detail-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .optimizer-detail-head span {
    text-align: left;
  }

  .chart-nav {
    gap: 5px;
    bottom: calc(var(--chart-bottom-height) + var(--rsi-panel-height) + 26px);
  }

  .chart-nav button {
    width: 27px;
    height: 27px;
    border-radius: 7px;
    font-size: 17px;
  }

  #chart {
    inset: 0 0 calc(var(--chart-bottom-height) + var(--rsi-panel-height)) var(--chart-tool-width);
  }

  .chart-tools {
    bottom: var(--chart-bottom-height);
    width: var(--chart-tool-width);
    padding: 7px 5px;
  }

  .chart-tools button {
    width: 36px;
    height: 36px;
    font-size: 20px;
  }

  .chart-legend {
    left: 58px;
    right: 8px;
    gap: 6px;
    row-gap: 3px;
    font-size: 12px;
  }

  .chart-legend strong {
    font-size: 13px;
  }

  .chart-legend #selected-name,
  .chart-legend #chart-status,
  .period-menu {
    display: none;
  }

  .chart-legend .rating-badge {
    display: inline-flex;
  }

  .tv-bottom-bar {
    left: var(--chart-tool-width);
    height: var(--chart-bottom-height);
    padding: 0 8px;
  }

  .chart-shell {
    --chart-tool-width: 46px;
    --chart-bottom-height: 38px;
    --rsi-panel-height: 130px;
  }

  .rsi-panel {
    left: var(--chart-tool-width);
    bottom: var(--chart-bottom-height);
    height: var(--rsi-panel-height);
  }

  .rsi-legend {
    left: 10px;
    gap: 7px;
    font-size: 11px;
  }

  .rsi-legend strong {
    font-size: 12px;
  }
}

/* Mobile bottom tab bar + menu sheet (phone navigation). */
.mobile-tabbar {
  display: none;
}

.mobile-menu-sheet {
  position: fixed;
  inset: 0;
  z-index: 35;
}

.mobile-menu-sheet.hidden {
  display: none;
}

.mobile-menu-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 13, 0.5);
}

.mobile-menu-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  gap: 4px;
  padding: 10px 12px calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #23262d;
  border-radius: 16px 16px 0 0;
  background: #16181d;
  box-shadow: 0 -16px 40px rgba(0, 0, 0, 0.5);
}

.mobile-menu-grabber {
  justify-self: center;
  width: 40px;
  height: 4px;
  margin-bottom: 8px;
  border-radius: 999px;
  background: #3a3f48;
}

.mobile-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  font-weight: 720;
  text-align: left;
  cursor: pointer;
}

.mobile-menu-item svg {
  width: 20px;
  height: 20px;
  color: #9ca3ad;
}

.mobile-menu-item:hover,
.mobile-menu-item:focus-visible {
  background: var(--surface-soft);
  outline: none;
}

/* Phone master-detail + bottom tab bar: the list pane fills the screen; the
   bottom bar navigates between Alertas/Comprados/Gráfico/Otimizador/Menu.
   Kept last so it overrides the stacked layout from the queries above. */
@media (max-width: 760px) {
  .workspace {
    display: block;
    grid-template-rows: none;
    grid-template-columns: none;
    height: calc(100% - 56px - env(safe-area-inset-bottom, 0px));
    overflow: hidden;
  }

  .main-panel,
  .side-panel {
    height: 100%;
  }

  .side-panel {
    border-top: 0;
    overflow: visible;
  }

  /* Default = list mode: alerts/list visible, chart pane out of flow. */
  .main-panel {
    display: none;
  }

  /* Detail mode: chart fills the screen, list hidden. */
  body.mobile-show-chart .main-panel {
    display: grid;
  }

  body.mobile-show-chart .side-panel {
    display: none;
  }

  /* The •••menu sits at the top of the screen, so it must drop downward. */
  .side-menu-panel {
    top: calc(100% + 9px);
    bottom: auto;
    max-height: min(70vh, 460px);
  }

  /* Navigation handled by the bottom tab bar + menu sheet. */
  .mobile-back,
  .mode-tabs {
    display: none;
  }

  .mobile-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 25;
    display: flex;
    box-sizing: content-box;
    height: 56px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    border-top: 1px solid #23262d;
    background: #0a0a0b;
  }

  .tabbar-btn {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    padding: 0 2px;
    border: 0;
    background: transparent;
    color: #868d98;
    font-size: 10px;
    font-weight: 760;
    cursor: pointer;
  }

  .tabbar-btn svg {
    width: 22px;
    height: 22px;
  }

  .tabbar-btn span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .tabbar-btn.active {
    color: #3fef9c;
  }

  /* Drop the left vertical toolbar; the chart now uses the full width and the
     two tools (cursor + régua) sit in a horizontal strip above the tab bar. */
  .chart-shell {
    --chart-tool-width: 0px;
    --chart-tools-height: 40px;
  }

  #chart {
    inset: 0 0 calc(var(--chart-bottom-height) + var(--rsi-panel-height) + var(--chart-tools-height)) 0;
  }

  .rsi-panel {
    bottom: calc(var(--chart-bottom-height) + var(--chart-tools-height));
  }

  .tv-bottom-bar {
    bottom: var(--chart-tools-height);
  }

  .chart-nav {
    bottom: calc(var(--chart-bottom-height) + var(--rsi-panel-height) + var(--chart-tools-height) + 22px);
  }

  .chart-legend {
    left: 12px;
  }

  .chart-tools {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: auto;
    height: var(--chart-tools-height);
    padding: 0 10px;
    border-right: 0;
    border-top: 1px solid #23262d;
    background: #0a0a0b;
  }

  .chart-tools button {
    width: 38px;
    height: 30px;
    font-size: 19px;
  }

  /* --- Backtest + Otimizador: denser layout, no page-level horizontal scroll,
         wide tables scroll horizontally with a sticky first column. --- */
  .view-backtest,
  .view-optimizer {
    padding: 10px;
    overflow-x: hidden;
  }

  .view-backtest {
    grid-template-rows: none;
    gap: 10px;
  }

  .tool-panel,
  .metrics-panel,
  .trades-panel {
    padding: 11px;
  }

  .tool-panel h3,
  .metrics-panel h3,
  .trades-panel h3,
  .table-panel h3 {
    margin-bottom: 9px;
    font-size: 13px;
  }

  .optimizer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .metric {
    min-height: 58px;
    padding: 8px;
  }

  .metric strong {
    margin-top: 5px;
    font-size: 15px;
  }

  .equity-chart {
    height: 200px;
    min-height: 200px;
  }

  .table-panel h3 {
    padding: 11px 11px 0;
  }

  .optimizer-ranking-toolbar {
    flex-wrap: wrap;
    padding: 8px 11px 4px;
  }

  .optimizer-detail-head {
    padding: 11px 11px 0;
  }

  .table-wrap,
  .view-optimizer .table-wrap {
    max-height: none;
    overflow: auto;
    padding: 0 0 12px;
  }

  table {
    font-size: 11px;
  }

  th,
  td {
    padding: 7px 7px;
  }

  .table-wrap th:first-child,
  .table-wrap td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--surface);
  }
}
