/* ========================================================================== */
/* BTI · CSS REBUILD · PHASE 1                                                */
/* Base nuova: foundation + app shell + top menu + dashboard grid + blocks    */
/* Nota: file di ricostruzione, NON ancora sostitutivo completo di styles.css  */
/* ========================================================================== */

:root {
  --app-bg: #001122;
  --panel-bg: #001122;
  --panel-border: #333333;
  --sidebar-w: clamp(220px, 20vw, 300px);
  --sidebar-drawer-w: min(86vw, 320px);
  --top-menu-min-h: clamp(44px, 5.2vh, 56px);
  --page-pad-y: clamp(8px, 1.2vw, 14px);
  --page-pad-x: clamp(10px, 1.8vw, 18px);
  --grid-gap: clamp(4px, 0.7vw, 10px);
  --shell-gap: clamp(8px, 1vw, 14px);
  --card-radius: 14px;
  --control-h: clamp(30px, 3.2vw, 36px);
  --content-max-w: 1800px;
  --text-main: #ffffff;
  --text-muted: rgba(255,255,255,0.75);
  --accent: #FFA500;
  --menu-border: #163247;
  --shadow-soft: 0 0 0 1px rgba(255,255,255,0.03);
  --viewport-h: 100svh;
}

@supports (height: 100dvh) {
  :root {
    --viewport-h: 100dvh;
  }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  display: flex;
  min-height: var(--viewport-h);
  height: var(--viewport-h);
  font-family: Arial, sans-serif;
  background: var(--app-bg);
  color: var(--text-main);
  overflow-x: hidden;
  overflow-y: hidden;
}


/* ==================== BTi startup loading overlay ==================== */
.bti-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9900;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--viewport-h);
  padding: clamp(20px, 5vw, 48px);
  background: #001122;
  font-family: Arial, sans-serif;
  color: #ffffff;
  opacity: 1;
  visibility: visible;
  transition: opacity 360ms ease, visibility 360ms ease;
}

.bti-loading-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: none;
}

.bti-loading-overlay.is-fading {
  opacity: 0;
  visibility: hidden;
}

.bti-bootstrap-notice {
  margin: 12px 16px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 165, 0, 0.35);
  border-radius: 2px;
  background: rgba(255, 165, 0, 0.08);
  color: #f5d7a1;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
}

.bti-loading-panel {
  position: relative;
  width: min(92vw, 440px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 0 clamp(22px, 6vw, 42px);
  border: 0;
  background: transparent;
  box-shadow: none;
  text-align: center;
}

.bti-loading-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.bti-loading-brand-mark {
  font-size: clamp(2.5rem, 12vw, 4.4rem);
  line-height: 0.9;
  font-weight: 800;
  letter-spacing: -0.06em;
  color: #ffffff;
  text-transform: none;
}

.bti-loading-brand-rule {
  width: min(150px, 42vw);
  height: 2px;
  background: linear-gradient(90deg, transparent, #FFA500 18%, #FFA500 82%, transparent);
  box-shadow: 0 0 18px rgba(255, 165, 0, 0.28);
}

.bti-loading-title {
  margin: 0;
  color: rgba(255, 255, 255, 0.92);
  font-size: clamp(0.86rem, 2.4vw, 1rem);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.bti-loading-spinner {
  width: 34px;
  height: 34px;
  border: 2px solid rgba(255, 255, 255, 0.13);
  border-top-color: #FFA500;
  border-right-color: rgba(255, 165, 0, 0.62);
  border-radius: 50%;
  animation: bti-loading-spin 820ms linear infinite;
}


@keyframes bti-loading-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 520px) {
  .bti-loading-panel {
    width: min(100%, 360px);
    gap: 16px;
  }

  .bti-loading-title {
    letter-spacing: 0.1em;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bti-loading-overlay {
    transition-duration: 1ms;
  }

  .bti-loading-spinner {
    animation-duration: 1.6s;
  }
}

/* ==================== Sidebar ==================== */
#sidebar {
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  min-width: min(100%, var(--sidebar-w));
  min-height: var(--viewport-h);
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: linear-gradient(180deg, rgba(0, 17, 34, 0.98) 0%, rgba(1, 20, 38, 0.98) 100%);
  color: var(--text-main);
  overflow-y: auto;
  overflow-x: hidden;
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 10px 0 16px;
  border-right: 1px solid rgba(255,255,255,0.05);
  box-shadow: inset -1px 0 0 rgba(255,255,255,0.02);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,165,0,0.24) transparent;
}

#sidebar-title {
  width: 100%;
  padding: 6px 18px 0;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.96);
}

#sidebar-search-container {
  position: relative;
  margin: 0 12px;
}

#sidebar-search {
  width: 100%;
  min-height: 34px;
  padding: 7px 32px 7px 12px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  font-size: 12px;
  color: rgba(255,255,255,0.94);
  background: rgba(255,255,255,0.05);
  outline: none;
  transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

#sidebar-search::placeholder {
  color: rgba(255,255,255,0.45);
}

#sidebar-search:focus {
  border-color: rgba(255,165,0,0.55);
  background: rgba(255,255,255,0.07);
  box-shadow: 0 0 0 1px rgba(255,165,0,0.22);
}

#sidebar-search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: rgba(255,255,255,0.62);
  cursor: pointer;
  transition: color 0.18s ease, background-color 0.18s ease;
}

#sidebar-search-clear:hover {
  color: rgba(255,255,255,0.92);
  background: rgba(255,255,255,0.08);
}

/* ==================== Main shell ==================== */
#main-content {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  height: var(--viewport-h);
  display: flex;
  flex-direction: column;
  gap: var(--shell-gap);
  background: var(--app-bg);
  padding: var(--page-pad-y) var(--page-pad-x);
  overflow-x: hidden;
  overflow-y: auto;
}

/* ==================== Top menu ==================== */
#top-menu {
  width: 100%;
  max-width: none;
  min-height: var(--top-menu-min-h);
  background: var(--app-bg);
  border-bottom: 1px solid var(--menu-border);
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 0;
  flex-shrink: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

#top-menu::-webkit-scrollbar {
  height: 0;
}

#top-menu .menu-item {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  line-height: 0.95;
  font-size: 10px;
  letter-spacing: 0;
  padding: 2px 2px;
  position: relative;
  white-space: normal;
  color: var(--text-muted);
}

#top-menu .menu-item span:first-child {
  font-weight: 600;
}

#top-menu .menu-item span:last-child {
  font-weight: 400;
  opacity: 0.82;
}

#top-menu .menu-item:hover {
  color: #ffffff;
}

#top-menu .menu-item.active {
  color: var(--accent);
  font-weight: 700;
}

#top-menu .menu-item.active::after {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

/* ==================== Dashboard grid ==================== */
#grid-content {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: var(--grid-gap);
  align-content: stretch;
  overflow: hidden;
}

/* ==================== Sections / templates ==================== */
.main-section,
.content-block {
  min-width: 0;
  min-height: 0;
}

.content-block {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.main-section {
  width: 100%;
  max-width: none;
  align-self: stretch;
}

/* ==================== Dashboard blocks ==================== */
#block1,
#block2,
#block3,
#block4,
#block5 {
  width: 100%;
  min-width: 0;
  min-height: 0;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--card-radius);
  padding: 0;
  margin: 0;
  box-shadow: var(--shadow-soft);
}

#block1,
#block2,
#block3 {
  overflow: hidden;
}

#block4 {
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
}

#block5 {
  grid-column: 1 / -1;
  grid-row: 1 / -1;
  overflow: hidden;
}

#block2 {
  padding: 8px;
}

#block3,
#block4 {
  font-size: 12px;
}

#block1-wrapper,
#block3-content,
#spread-page,
#spread-chart,
#block4chart,
.tradingview-widget-container,
#symbol-info-container {
  width: 100%;
  height: 100%;
  min-height: 0;
}

#block3-content {
  display: flex;
  flex-direction: column;
}

#block3-trendscore,
#block3-tradingview {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  display: none;
  overflow: auto;
}


/* ==================== Responsive foundation utilities ==================== */
.responsive-page {
  width: 100%;
  max-width: none;
  margin-inline: auto;
  padding: clamp(10px, 1.4vw, 16px);
}

.responsive-toolbar,
.responsive-field-row,
.responsive-inline-list {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(8px, 1vw, 12px);
  align-items: center;
}

.responsive-toolbar > *,
.responsive-field-row > * {
  min-width: 0;
}

.responsive-grow {
  flex: 1 1 16rem;
}

.responsive-select,
.responsive-input,
.responsive-button {
  min-height: var(--control-h);
}

.responsive-select,
.responsive-input {
  width: min(100%, 100%);
  min-width: 0;
}

.responsive-stack {
  display: grid;
  gap: clamp(10px, 1.2vw, 14px);
}

@media (max-width: 760px), (max-height: 640px), ((max-width: 980px) and (max-aspect-ratio: 1/1)) {
  #grid-content {
    height: auto;
    min-height: 0;
    grid-template-columns: 1fr;
    grid-template-rows: none;
    grid-auto-rows: minmax(13rem, auto);
    overflow: visible;
  }

  #block5 {
    grid-column: auto;
    grid-row: auto;
  }
}

/* ==================== Sidebar drawer controls ==================== */
#sidebar-toggle-mobile {
  position: fixed;
  left: 10px;
  top: 10px;
  z-index: 1300;
  width: 32px;
  height: 32px;
  border: 1px solid #29465c;
  border-radius: 8px;
  background: rgba(0, 17, 34, 0.92);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

#sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
  z-index: 1100;
  display: none;
}

/* ==================== Laptop / drawer mode ==================== */
@media (max-width: 1366px), (max-height: 900px), (max-aspect-ratio: 5/4) {
  :root {
    --page-pad-y: clamp(8px, 1vw, 10px);
    --page-pad-x: clamp(8px, 1vw, 10px);
    --grid-gap: clamp(4px, 0.5vw, 8px);
  }

  #sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-drawer-w);
    min-width: var(--sidebar-drawer-w);
    height: var(--viewport-h);
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    z-index: 1200;
  }

  body.sidebar-open #sidebar {
    transform: translateX(0);
  }

   #main-content {
    width: 100%;
    min-width: 0;
  }

  #top-menu {
    padding-left: 42px;
  }

  #top-menu,
  .main-section {
    max-width: none;
  }

  #grid-content {
    max-width: 100%;
    height: auto;
  }

  #sidebar-toggle-mobile {
    display: inline-flex;
  }

  #sidebar-backdrop {
    opacity: 0;
    pointer-events: none;
    display: block;
    transition: opacity 0.22s ease;
  }

  body.sidebar-open #sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
}

/* ==================== Tablet ==================== */
@media (max-width: 1024px) {
  #top-menu .menu-item {
    flex: 0 0 clamp(124px, 30vw, 156px);
    padding: 6px 4px;
  }

  .responsive-field-row {
    align-items: stretch;
  }

  .responsive-field-row > * {
    flex: 1 1 100%;
  }
}

/* ==================== Mobile ==================== */
@media (max-width: 640px) {
  :root {
    --page-pad-y: 6px;
    --page-pad-x: 6px;
    --grid-gap: 6px;
    --card-radius: 12px;
  }

  #top-menu {
    min-height: 54px;
  }

  #top-menu .menu-item {
    flex: 0 0 min(78vw, 132px);
    font-size: 10px;
  }

  .responsive-page {
    padding-inline: 0;
  }
}

/* ==================== Desktop wide only ==================== */
@media (min-width: 1367px) and (min-height: 901px) {
  #sidebar-backdrop {
    display: none !important;
  }
}

/* ==================== Optimiser page ==================== */
.optimiser-wrap {
  width: 100%;
  min-height: calc(var(--viewport-h) - (var(--page-pad-y) * 2));
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 0 0;
}

.optimiser-header {
  display: flex;
  align-items: center;
  min-height: 28px;
}

.optimiser-title {
  color: var(--accent);
  font-size: 2rem;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.optimiser-grid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.optimiser-card {
  min-width: 0;
  min-height: 0;
  background: #10273d;
  border: 1px solid #1a4262;
  border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
}

.optimiser-sidebar-card {
  display: flex;
  flex-direction: column;
  padding: 12px;
}

.optimiser-chart-card {
  display: flex;
  flex-direction: column;
  padding: 14px 14px 12px;
  background:
    radial-gradient(circle at 84% 8%, rgba(32, 105, 161, 0.14), transparent 30%),
    #10273d;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.03),
    0 18px 44px rgba(2, 12, 20, 0.18);
}

.optimiser-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.optimiser-card-title {
  margin: 0;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.optimiser-sidebar-card > .optimiser-card-title {
  margin-bottom: 10px;
}

.optimiser-info-button {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 159, 28, 0.72);
  border-radius: 50%;
  background: rgba(255, 159, 28, 0.08);
  color: #ffb347;
  font: 700 1rem/1 Georgia, serif;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

.optimiser-info-button:hover {
  border-color: #ff9f1c;
  background: rgba(255, 159, 28, 0.18);
  color: #ffffff;
  transform: translateY(-1px);
}

.optimiser-info-button:focus-visible,
.optimiser-info-close:focus-visible {
  outline: 2px solid #ff9f1c;
  outline-offset: 3px;
}

.optimiser-typeahead {
  position: relative;
}

.optimiser-input {
  width: 100%;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid #183958;
  border-radius: 12px;
  background: #10263b;
  color: rgba(255,255,255,0.9);
  font-size: 0.98rem;
  outline: none;
}

.optimiser-input::placeholder {
  color: rgba(255,255,255,0.42);
}

.optimiser-input:focus {
  border-color: #2d5d82;
  box-shadow: 0 0 0 1px rgba(255,165,0,0.24);
}

.optimiser-suggest {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 5;
  display: grid;
  gap: 4px;
  max-height: 16rem;
  overflow: auto;
  padding: 6px;
  border: 1px solid #1a4262;
  border-radius: 12px;
  background: #0e2235;
}

.opt-suggest-item {
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
}

.opt-suggest-item:hover {
  background: rgba(255,255,255,0.05);
}

.opt-suggest-name {
  color: rgba(255,255,255,0.92);
  font-size: 0.9rem;
}

.optimiser-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: flex-start;
  min-height: 22px;
  margin-top: 10px;
  color: rgba(255,255,255,0.72);
  font-size: 0.9rem;
}

.optimiser-selected-empty {
  color: rgba(255,255,255,0.72);
  font-size: 0.92rem;
}

.opt-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid #1a4262;
  border-radius: 999px;
  background: #0e2235;
  color: rgba(255,255,255,0.9);
  font-size: 0.85rem;
}

.opt-chip-x {
  border: 0;
  background: transparent;
  color: rgba(255,255,255,0.72);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.optimiser-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.optimiser-actions .tab-btn {
  min-height: 28px;
  padding: 0 14px;
  font-size: 0.9rem;
  border-radius: 999px;
}

.optimiser-message {
  min-height: 16px;
  margin-top: 8px;
  color: rgba(255,255,255,0.72);
  font-size: 0.82rem;
}

.optimiser-kpi {
  display: grid;
  grid-template-columns: repeat(2, minmax(176px, 1fr));
  gap: 10px 8px;
  margin-top: 10px;
}

.optimiser-kpi-pill {
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  column-gap: 12px;
  row-gap: 4px;
  padding: 6px 11px;
  border: 1px solid #1a4262;
  border-radius: 12px;
  background: #10263b;
  color: rgba(255,255,255,0.72);
  font-size: 0.88rem;
}

.optimiser-kpi-pill span {
  flex: 1 1 140px;
  min-width: 0;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
}

.optimiser-kpi-pill strong {
  flex: 0 0 auto;
  margin-left: auto;
  white-space: nowrap;
  color: rgba(255,255,255,0.92);
  font-size: 0.92rem;
  font-weight: 600;
}

.optimiser-weights {
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-content: start;
  overflow: auto;
}

.optimiser-results-card {
  border: 1px solid #1a4262;
  border-radius: 14px;
  background: #0e2235;
  padding: 10px;
}

.optimiser-results-title {
  margin-bottom: 10px;
  color: rgba(255,255,255,0.86);
  font-size: 0.92rem;
  font-weight: 700;
  text-transform: uppercase;
}

.optimiser-export-confirm {
  min-height: 16px;
  margin-top: 6px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  opacity: 0;
  transition: opacity .18s ease;
}

.optimiser-export-confirm.is-visible {
  opacity: 1;
}

.optimiser-results-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.optimiser-results-metric {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 9px;
  border: 1px solid #1a4262;
  border-radius: 10px;
  background: #10263b;
}

.optimiser-results-metric span {
  color: rgba(255,255,255,0.68);
  font-size: 0.8rem;
}

.optimiser-results-metric strong {
  color: rgba(255,255,255,0.92);
  font-size: 0.86rem;
  font-weight: 600;
  white-space: nowrap;
}

.optimiser-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.optimiser-table th,
.optimiser-table td {
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.82);
  text-align: left;
}

.optimiser-table th {
  color: rgba(255,255,255,0.58);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
}

.optimiser-table .num {
  text-align: right;
}

.optimiser-chart-wrap {
  height: calc(var(--viewport-h) - var(--top-menu-min-h) - 90px);
  min-height: 520px;
  padding: 10px;
  border: 1px solid rgba(55, 126, 180, 0.52);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(12, 38, 60, 0.98), rgba(7, 25, 40, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.025),
    inset 0 0 34px rgba(4, 16, 27, 0.24);
  overflow: hidden;
}

.optimiser-chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.optimiser-info-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(2, 10, 17, 0.78);
  backdrop-filter: blur(7px);
}

.optimiser-info-modal[hidden] {
  display: none;
}

.optimiser-info-dialog {
  width: min(760px, 100%);
  max-height: min(88vh, 820px);
  overflow: auto;
  border: 1px solid rgba(54, 126, 180, 0.74);
  border-radius: 18px;
  background:
    radial-gradient(circle at 90% 0, rgba(35, 111, 169, 0.18), transparent 34%),
    #0b2032;
  color: #ffffff;
  box-shadow: 0 28px 90px rgba(0,0,0,0.52);
}

.optimiser-info-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid rgba(76, 142, 190, 0.28);
  background: rgba(11, 32, 50, 0.96);
  backdrop-filter: blur(10px);
}

.optimiser-info-eyebrow {
  display: block;
  margin-bottom: 5px;
  color: #ffad3d;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .12em;
}

.optimiser-info-header h3 {
  margin: 0;
  color: #ffffff;
  font-size: 1.35rem;
  line-height: 1.25;
}

.optimiser-info-close {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  color: #ffffff;
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease;
}

.optimiser-info-close:hover {
  border-color: rgba(255,255,255,0.52);
  background: rgba(255,255,255,0.11);
}

.optimiser-info-content {
  display: grid;
  gap: 22px;
  padding: 22px 24px 26px;
}

.optimiser-info-content section {
  display: grid;
  gap: 10px;
}

.optimiser-info-content h4 {
  margin: 0;
  color: #ffffff;
  font-size: .98rem;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.optimiser-info-content p,
.optimiser-info-content li {
  color: rgba(255,255,255,0.86);
  font-size: .92rem;
  line-height: 1.6;
}

.optimiser-info-content p {
  margin: 0;
}

.optimiser-info-content ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 20px;
}

.optimiser-info-content strong {
  color: #ffffff;
}

.optimiser-info-legend {
  display: grid;
  gap: 9px;
}

.optimiser-info-legend-item {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(76, 142, 190, 0.26);
  border-radius: 12px;
  background: rgba(255,255,255,0.025);
}

.optimiser-info-legend-item p {
  margin-top: 3px;
  font-size: .86rem;
}

.optimiser-info-swatch {
  width: 11px;
  height: 11px;
  margin-top: 5px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.85);
}

.optimiser-info-swatch.is-simulated {
  background: #419dff;
  box-shadow: 0 0 0 1px rgba(111,188,255,0.92);
}

.optimiser-info-swatch.is-minimum {
  background: #22c55e;
}

.optimiser-info-swatch.is-sharpe {
  background: #ff9f1c;
}

.optimiser-info-notice {
  padding: 14px 16px;
  border: 1px solid rgba(255, 159, 28, 0.42);
  border-radius: 12px;
  background: rgba(255, 159, 28, 0.065);
}

.optimiser-info-dialog,
.optimiser-wrap,
.optimiser-weights,
.optimiser-suggest {
  scrollbar-width: thin;
  scrollbar-color: #35566f #071521;
}

.optimiser-info-dialog::-webkit-scrollbar,
.optimiser-wrap::-webkit-scrollbar,
.optimiser-weights::-webkit-scrollbar,
.optimiser-suggest::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.optimiser-info-dialog::-webkit-scrollbar-track,
.optimiser-wrap::-webkit-scrollbar-track,
.optimiser-weights::-webkit-scrollbar-track,
.optimiser-suggest::-webkit-scrollbar-track {
  background: #071521;
  border-radius: 999px;
}

.optimiser-info-dialog::-webkit-scrollbar-thumb,
.optimiser-wrap::-webkit-scrollbar-thumb,
.optimiser-weights::-webkit-scrollbar-thumb,
.optimiser-suggest::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #3f6784 0%, #2a4860 100%);
  border-radius: 999px;
  border: 2px solid #071521;
}

.optimiser-info-dialog::-webkit-scrollbar-thumb:hover,
.optimiser-wrap::-webkit-scrollbar-thumb:hover,
.optimiser-weights::-webkit-scrollbar-thumb:hover,
.optimiser-suggest::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #4d7a99 0%, #35566f 100%);
}

@media (max-width: 980px) {
  .optimiser-grid {
    grid-template-columns: 1fr;
  }

  .optimiser-chart-wrap {
    min-height: 520px;
  }

  .optimiser-weights {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .optimiser-title {
    font-size: 1.6rem;
  }

  .optimiser-kpi {
    grid-template-columns: 1fr;
  }

  .optimiser-chart-card {
    padding: 12px 10px 10px;
  }

  .optimiser-chart-wrap {
    padding: 4px;
  }

  .optimiser-info-modal {
    align-items: flex-end;
    padding: 10px;
  }

  .optimiser-info-dialog {
    max-height: 92vh;
    border-radius: 16px;
  }

  .optimiser-info-header,
  .optimiser-info-content {
    padding-left: 18px;
    padding-right: 18px;
  }
}

/* ==================== Strategic Asset Allocation portfolio overview ==================== */
.strategic-portfolios-summary {
  margin-top: 4px;
  padding: 20px;
  border: 1px solid rgba(54, 126, 180, 0.5);
  border-radius: 16px;
  background:
    radial-gradient(circle at 92% 0, rgba(35, 111, 169, 0.13), transparent 34%),
    linear-gradient(180deg, rgba(11, 31, 51, 0.98), rgba(8, 25, 41, 0.98));
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.025);
}

.strategic-portfolios-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.strategic-portfolios-heading h3 {
  margin: 0;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: .055em;
  text-transform: uppercase;
}

.strategic-portfolios-heading p {
  margin: 6px 0 0;
  color: rgba(255,255,255,0.68);
  font-size: .82rem;
  line-height: 1.45;
}

.strategic-portfolios-table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(76, 142, 190, 0.25);
  border-radius: 12px;
  background: rgba(3, 15, 25, 0.22);
  scrollbar-width: thin;
  scrollbar-color: #35566f #071521;
}

.strategic-portfolios-table-wrap::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

.strategic-portfolios-table-wrap::-webkit-scrollbar-track {
  background: #071521;
  border-radius: 999px;
}

.strategic-portfolios-table-wrap::-webkit-scrollbar-thumb {
  border: 2px solid #071521;
  border-radius: 999px;
  background: linear-gradient(180deg, #3f6784 0%, #2a4860 100%);
}

.strategic-portfolios-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  table-layout: auto;
}

.strategic-portfolios-table th {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(76, 142, 190, 0.3);
  color: rgba(255,255,255,0.62);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .075em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.strategic-portfolios-table th.num,
.strategic-portfolios-table td.num {
  text-align: right;
}

.strategic-portfolios-table td {
  padding: 15px 14px;
  border-bottom: 1px solid rgba(76, 142, 190, 0.16);
  color: rgba(255,255,255,0.92);
  font-size: .82rem;
  white-space: nowrap;
  transition: background .18s ease, color .18s ease;
}

.strategic-portfolios-table tbody tr:last-child td {
  border-bottom: 0;
}

.strategic-portfolio-row {
  cursor: pointer;
  outline: none;
}

.strategic-portfolio-row:hover td,
.strategic-portfolio-row:focus-visible td {
  background: rgba(39, 103, 151, 0.16);
}

.strategic-portfolio-row:focus-visible {
  box-shadow: inset 0 0 0 1px rgba(255, 165, 0, 0.76);
}

.strategic-portfolio-name {
  display: block;
  max-width: 240px;
  overflow: hidden;
  color: #ffffff;
  font-weight: 800;
  text-overflow: ellipsis;
}

.strategic-portfolio-alpha {
  display: inline-flex;
  min-width: 72px;
  align-items: center;
  justify-content: flex-end;
  padding: 5px 9px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px;
  color: rgba(255,255,255,0.78);
  background: rgba(255,255,255,0.045);
  font-weight: 850;
}

.strategic-portfolio-alpha.is-positive {
  border-color: rgba(49, 208, 127, 0.4);
  color: #5de0a0;
  background: rgba(49, 208, 127, 0.1);
}

.strategic-portfolio-alpha.is-negative {
  border-color: rgba(255, 92, 92, 0.4);
  color: #ff7b7b;
  background: rgba(255, 92, 92, 0.1);
}

.strategic-portfolio-alpha.is-neutral {
  border-color: rgba(255, 173, 61, 0.34);
  color: #ffbd62;
  background: rgba(255, 173, 61, 0.08);
}

.strategic-portfolio-open {
  width: 24px;
  color: #ffad3d !important;
  font-size: 1.1rem !important;
  font-weight: 900;
  text-align: right;
}

.strategic-portfolio-row:hover .strategic-portfolio-open,
.strategic-portfolio-row:focus-visible .strategic-portfolio-open {
  color: #ffffff !important;
  transform: translateX(2px);
}

.strategic-portfolios-empty {
  display: grid;
  gap: 5px;
  padding: 24px;
  border: 1px dashed rgba(76, 142, 190, 0.35);
  border-radius: 12px;
  background: rgba(255,255,255,0.018);
  text-align: center;
}

.strategic-portfolios-empty strong {
  color: #ffffff;
  font-size: .9rem;
}

.strategic-portfolios-empty span {
  color: rgba(255,255,255,0.62);
  font-size: .8rem;
}

@media (max-width: 760px) {
  .strategic-portfolios-summary {
    padding: 15px;
  }

  .strategic-portfolios-table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .strategic-portfolios-table {
    min-width: 0;
  }

  .strategic-portfolios-table,
  .strategic-portfolios-table tbody,
  .strategic-portfolios-table tr,
  .strategic-portfolios-table td {
    display: block;
    width: 100%;
  }

  .strategic-portfolios-table thead {
    display: none;
  }

  .strategic-portfolios-table tbody {
    display: grid;
    gap: 10px;
  }

  .strategic-portfolios-table tr {
    padding: 13px 14px;
    border: 1px solid rgba(76, 142, 190, 0.28);
    border-radius: 12px;
    background: rgba(3, 15, 25, 0.25);
  }

  .strategic-portfolios-table td,
  .strategic-portfolios-table td.num {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 7px 0;
    border: 0;
    text-align: right;
    white-space: normal;
  }

  .strategic-portfolios-table td::before {
    content: attr(data-label);
    color: rgba(255,255,255,0.56);
    font-size: .67rem;
    font-weight: 800;
    letter-spacing: .055em;
    text-align: left;
    text-transform: uppercase;
  }

  .strategic-portfolios-table td:first-child {
    padding-bottom: 11px;
    border-bottom: 1px solid rgba(76, 142, 190, 0.18);
  }

  .strategic-portfolios-table td:first-child::before,
  .strategic-portfolios-table .strategic-portfolio-open::before {
    display: none;
  }

  .strategic-portfolio-name {
    max-width: 100%;
    text-align: left;
  }

  .strategic-portfolio-open {
    justify-content: flex-end !important;
    padding-top: 10px !important;
  }
}

/* ==================== Portfolio Analysis page ==================== */
.portfolio-analysis-page {
  width: 100%;
  min-height: calc(var(--viewport-h) - (var(--page-pad-y) * 2));
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 4px;
}

.portfolio-analysis-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.portfolio-analysis-title {
  color: var(--accent);
  font-size: 2rem;
  line-height: 1;
  font-weight: 700;
  text-transform: uppercase;
}

.portfolio-analysis-subtitle {
  color: rgba(255,255,255,0.82);
  font-size: 1rem;
}

.portfolio-analysis-grid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 12px;
}

.portfolio-analysis-card {
  min-width: 0;
  min-height: 0;
  background: #10273d;
  border: 1px solid #1a4262;
  border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
}

.portfolio-analysis-input-card {
  padding: 12px;
}

.portfolio-analysis-metrics-card,
.portfolio-analysis-performance-card {
  display: flex;
  flex-direction: column;
  padding: 12px;
}

.portfolio-analysis-card-title {
  margin-bottom: 10px;
  color: rgba(255,255,255,0.84);
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
}

.portfolio-analysis-card-heading .portfolio-analysis-card-title {
  margin-bottom: 0;
}

.portfolio-analysis-search {
  position: relative;
}

.portfolio-analysis-input,
.portfolio-analysis-select,
.portfolio-analysis-table-input {
  min-height: 38px;
  border: 1px solid #183958;
  border-radius: 12px;
  background: #10263b;
  color: rgba(255,255,255,0.9);
  font-size: 0.96rem;
  outline: none;
}

.portfolio-analysis-input,
.portfolio-analysis-select {
  width: 100%;
  padding: 0 14px;
}

.portfolio-analysis-input::placeholder {
  color: rgba(255,255,255,0.42);
}

.portfolio-analysis-input:focus,
.portfolio-analysis-select:focus,
.portfolio-analysis-table-input:focus {
  border-color: #2d5d82;
  box-shadow: 0 0 0 1px rgba(255,165,0,0.24);
}

.portfolio-analysis-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 5;
  display: none;
  grid-auto-rows: minmax(0, auto);
  max-height: 24rem;
  overflow: auto;
  padding: 6px;
  border: 1px solid #1a4262;
  border-radius: 12px;
  background: #0e2235;
}

.portfolio-analysis-suggestions > div {
  padding: 9px 10px;
  border-radius: 10px;
  color: rgba(255,255,255,0.9);
  cursor: pointer;
}

.portfolio-analysis-suggestions > div:hover {
  background: rgba(255,255,255,0.05);
}

.portfolio-analysis-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.portfolio-analysis-name-input {
  flex: 0 1 260px;
}

.portfolio-analysis-select {
  flex: 0 1 260px;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(255,255,255,0.7) 50%),
    linear-gradient(135deg, rgba(255,255,255,0.7) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 2px),
    calc(100% - 12px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 28px;
}

.portfolio-analysis-message {
  min-height: 16px;
  color: rgba(255,255,255,0.72);
  font-size: 0.82rem;
  flex: 1 1 100%;
}

.portfolio-analysis-table {
  width: 100%;
  margin-top: 4px;
  border-collapse: collapse;
}

.portfolio-analysis-table thead th {
  padding: 0 4px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.58);
  font-size: 0.84rem;
  font-weight: 700;
  text-transform: uppercase;
  text-align: left;
}

.portfolio-analysis-table tbody td {
  padding: 10px 4px 0;
  color: rgba(255,255,255,0.86);
  font-size: 0.92rem;
  vertical-align: middle;
}

.portfolio-analysis-table .num {
  text-align: right;
}

.portfolio-analysis-liquidity-field {
  display: grid;
  gap: 6px;
  margin: 12px 0;
}

.portfolio-analysis-liquidity-field label {
  color: rgba(255,255,255,0.72);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
}

.portfolio-analysis-liquidity-field input {
  max-width: 240px;
}

.portfolio-analysis-holdings-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0 10px;
}

.portfolio-analysis-holdings-toolbar label {
  color: rgba(255,255,255,0.72);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
}

.portfolio-analysis-page input[type="number"]::-webkit-outer-spin-button,
.portfolio-analysis-page input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.portfolio-analysis-page input[type="number"] {
  -moz-appearance: textfield;
}

.portfolio-analysis-allocation-warning {
  margin-left: 8px;
  color: #ff4d4d;
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
}

.portfolio-analysis-table-input {
  width: min(100%, 140px);
  padding: 0 10px;
  text-align: right;
}

.portfolio-analysis-remove-btn {
  width: 28px;
  height: 28px;
  border: 1px solid #1a4262;
  border-radius: 999px;
  background: #10263b;
  color: rgba(255,255,255,0.74);
  cursor: pointer;
}

.portfolio-analysis-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.portfolio-analysis-actions .tab-btn,
.portfolio-analysis-tabs .tab-btn,
.portfolio-analysis-toolbar .tab-btn {
  min-height: 28px;
  padding: 0 14px;
  font-size: 0.9rem;
  border-radius: 999px;
}

.portfolio-analysis-panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.portfolio-analysis-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.portfolio-analysis-comparison-control {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  margin-top: 10px;
}

.portfolio-analysis-compare-btn {
  margin-left: auto;
}

.portfolio-analysis-comparison-control .portfolio-analysis-hint {
  width: 100%;
}

.portfolio-analysis-panel-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.portfolio-analysis-pane {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
}

.portfolio-analysis-pane.is-active {
  display: flex;
  flex-direction: column;
}

.portfolio-analysis-metrics {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.portfolio-analysis-metrics .rm-section {
  margin: 0;
}

.portfolio-analysis-metrics .rm-section-title {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: rgba(255,255,255,0.92);
  text-transform: uppercase;
}

.portfolio-analysis-metrics .rm-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.portfolio-analysis-metrics .rm-grid > div {
  min-width: 0;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  background: #0b1f33;
  padding: 7px 8px;
  min-height: 52px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
  gap: 5px;
}

.portfolio-analysis-metrics .rm-grid span {
  min-width: 0;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
  color: rgba(255,255,255,0.76);
  font-size: 0.72rem;
  line-height: 1.2;
}

.portfolio-analysis-metrics .rm-grid strong {
  flex: 0 0 auto;
  width: 100%;
  align-self: flex-end;
  white-space: nowrap;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.1;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.pa-metric-better {
  outline: 1px solid rgba(49,208,127,0.18);
}

.pa-metric-worse {
  outline: 1px solid rgba(255,92,92,0.18);
}

.pa-metric-better strong {
  color: #31d07f !important;
}

.pa-metric-worse strong {
  color: #ff5c5c !important;
}

.portfolio-analysis-chart-wrap {
  flex: 1 1 auto;
  min-height: 28rem;
  border-radius: 14px;
  background: #10273d;
  overflow: hidden;
}

.portfolio-analysis-chart-wrap.portfolio-analysis-contribution-chart-wrap {
  min-height: var(--portfolio-contribution-height, 28rem);
  position: relative;
  background:
    radial-gradient(circle at 12% 10%, rgba(49,208,127,0.035), transparent 34%),
    radial-gradient(circle at 88% 90%, rgba(255,92,92,0.035), transparent 34%),
    #10273d;
}

#pa-contribution-info[hidden] {
  display: none;
}

.portfolio-analysis-chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.portfolio-analysis-hint {
  min-height: 16px;
  margin-top: 8px;
  color: rgba(255,255,255,0.72);
  font-size: 0.82rem;
}

@media (max-width: 980px) {
  .portfolio-analysis-grid {
    grid-template-columns: 1fr;
  }

  .portfolio-analysis-chart-wrap {
    min-height: 24rem;
  }
}

@media (max-width: 640px) {
  .portfolio-analysis-title {
    font-size: 1.6rem;
  }

  .portfolio-analysis-metrics .rm-grid {
    grid-template-columns: 1fr;
  }

  .portfolio-analysis-name-input,
  .portfolio-analysis-select {
    flex-basis: 100%;
  }
}

/* ==================== Support page ==================== */
.support-page {
  width: 100%;
  min-height: calc(var(--viewport-h) - (var(--page-pad-y) * 2));
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 4px;
}

.support-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.support-title {
  color: var(--accent);
  font-size: 2rem;
  line-height: 1;
  font-weight: 700;
}

.support-subtitle {
  margin-top: 6px;
  color: rgba(255,255,255,0.78);
  font-size: 0.96rem;
}

.support-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.support-header-actions .tab-btn {
  min-height: 30px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 0.9rem;
}

.support-grid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(300px, 420px) minmax(340px, 360px) minmax(0, 1fr);
  gap: 12px;
}

.support-card {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #10273d;
  border: 1px solid #1a4262;
  border-radius: 16px;
  overflow: hidden;
}

.support-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.support-card-title {
  color: rgba(255,255,255,0.94);
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
}

.support-card-kpi {
  color: rgba(255,255,255,0.68);
  font-size: 0.9rem;
}

.support-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
}

.support-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.support-form label span {
  color: rgba(255,255,255,0.84);
  font-size: 0.9rem;
}

.support-form input,
.support-form select,
.support-form textarea,
.support-search input,
.support-reply textarea {
  width: 100%;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid #183958;
  border-radius: 12px;
  background: #10263b;
  color: rgba(255,255,255,0.92);
  font-size: 0.96rem;
  outline: none;
  font-family: inherit;
}

.support-form textarea,
.support-reply textarea {
  min-height: 130px;
  padding: 12px;
  resize: vertical;
}

.support-form input::placeholder,
.support-form textarea::placeholder,
.support-search input::placeholder,
.support-reply textarea::placeholder {
  color: rgba(255,255,255,0.42);
}

.support-form input:focus,
.support-form select:focus,
.support-form textarea:focus,
.support-search input:focus,
.support-reply textarea:focus {
  border-color: #2d5d82;
  box-shadow: 0 0 0 1px rgba(255,165,0,0.22);
}

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

.support-form-actions,
.support-reply-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.support-form-actions .tab-btn,
.support-reply-actions .tab-btn,
.support-thread-actions .tab-btn {
  min-height: 28px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 0.9rem;
}

.support-hint {
  color: rgba(255,255,255,0.56);
  font-size: 0.82rem;
}

.support-form-msg {
  min-height: 16px;
  color: rgba(255,255,255,0.8);
  font-size: 0.84rem;
}

.support-history-card {
  grid-column: 2 / 4;
}

.support-history {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
}

.support-history-list {
  min-width: 0;
  min-height: 0;
  border-right: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
}

.support-search {
  padding: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.support-ticket-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.support-ticket-item {
  width: 100%;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  background: #06182a;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.support-ticket-item:hover {
  border-color: #2d5d82;
  background: #0b1f33;
}

.support-ticket-item-top,
.support-thread-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.support-ticket-subject,
.support-thread-title {
  color: rgba(255,255,255,0.96);
  font-size: 0.96rem;
  font-weight: 700;
}

.support-ticket-meta,
.support-ticket-preview,
.support-ticket-updated,
.support-thread-meta {
  margin-top: 6px;
  color: rgba(255,255,255,0.72);
  font-size: 0.84rem;
  line-height: 1.4;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.support-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
}

.support-badge.open {
  background: rgba(255,165,0,0.14);
  color: #ffb132;
}

.support-badge.closed {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.8);
}

.support-history-thread {
  min-width: 0;
  min-height: 0;
  padding: 12px;
  display: flex;
  flex-direction: column;
}

.support-thread-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.support-thread-body {
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 12px;
  padding-right: 4px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.support-msg {
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  background: #06182a;
}

.support-msg.user {
  background: #0d2336;
}

.support-msg.support {
  background: #132b41;
}

.support-msg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: rgba(255,255,255,0.74);
  font-size: 0.82rem;
}

.support-msg-body {
  margin-top: 8px;
  color: rgba(255,255,255,0.92);
  font-size: 0.94rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.support-reply {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.support-empty,
.support-empty-thread,
.support-thread-empty {
  padding: 14px 16px;
  border: 1px dashed rgba(255,255,255,0.12);
  border-radius: 14px;
  color: rgba(255,255,255,0.76);
  background: rgba(255,255,255,0.02);
}

@media (max-width: 1180px) {
  .support-grid {
    grid-template-columns: 1fr;
  }

  .support-history-card {
    grid-column: auto;
  }
}

@media (max-width: 900px) {
  .support-header,
  .support-history,
  .support-thread-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .support-history {
    display: flex;
  }
}

@media (max-width: 640px) {
  .support-title {
    font-size: 1.6rem;
  }

  .support-form-row {
    grid-template-columns: 1fr;
  }
}

/* ==================== AI Market Navigator page ==================== */
#ai-template {
  width: 100%;
}

.bti-ai-page {
  width: 100%;
  max-width: 1100px;
  min-height: 0;
  height: min(44rem, calc(var(--viewport-h) - var(--top-menu-min-h) - (var(--page-pad-y) * 2) - var(--shell-gap)));
  margin: 0 auto;
  padding: 22px 20px 20px;
  background: #031425;
  border: 1px solid #1a4262;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.bti-ai-page-title {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 12px;
  margin: 0 0 14px;
  color: #ffffff;
  font-size: 2rem;
  line-height: 1;
  font-weight: 700;
  text-transform: uppercase;
}

.bti-ai-chat-shell {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.bti-ai-intro-card,
.bti-ai-answer-panel,
.bti-ai-composer {
  background: #10273d;
  border: 1px solid #1a4262;
  border-radius: 14px;
}

.bti-ai-intro-card {
  padding: 16px 18px;
}

.bti-ai-intro-label {
  color: rgba(255,255,255,0.72);
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
}

.bti-ai-intro-body {
  margin-top: 12px;
  color: rgba(255,255,255,0.94);
  font-size: 1rem;
  line-height: 1.55;
}

.bti-ai-answer-panel {
  min-height: 0;
  flex: 1 1 auto;
  padding: 16px 18px;
  overflow: auto;
}

.bti-ai-composer {
  padding: 0;
}

#bti-ai-question {
  width: 100%;
  min-height: 6.5rem;
  padding: 14px 16px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: rgba(255,255,255,0.92);
  resize: vertical;
  outline: none;
  font-size: 0.98rem;
  font-family: inherit;
}

#bti-ai-question::placeholder {
  color: rgba(255,255,255,0.42);
}

.bti-ai-actions {
  display: flex;
  justify-content: flex-start;
  padding-bottom: max(2px, env(safe-area-inset-bottom));
}

#bti-ai-ask {
  min-width: 78px;
  min-height: 36px;
  padding: 0 22px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffb132 0%, #f59b1e 100%);
  color: #111;
  font-size: 0.98rem;
  font-weight: 700;
  cursor: pointer;
}

.bti-ai-msg {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bti-ai-msg + .bti-ai-msg {
  margin-top: 14px;
}

.bti-ai-msg-role {
  color: rgba(255,255,255,0.72);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
}

.bti-ai-msg-body {
  color: rgba(255,255,255,0.92);
  font-size: 0.96rem;
  line-height: 1.55;
}

.bti-ai-portfolio-actions {
  margin-top: 12px;
}

.bti-ai-save-portfolio-btn {
  min-width: 120px;
  min-height: 34px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffb132 0%, #f59b1e 100%);
  color: #111;
  font-size: 0.94rem;
  font-weight: 700;
  cursor: pointer;
}

@media (max-width: 900px) {
  .bti-ai-page {
    padding: 18px 16px 14px;
  }

  .bti-ai-page-title {
    font-size: 1.6rem;
  }
}

/* ==================== Market Radar / Spotlight page ==================== */
.spotlight-wrap {
  width: 100%;
  min-height: calc(var(--viewport-h) - (var(--page-pad-y) * 2));
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 4px;
}

.spotlight-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.spotlight-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.spotlight-title .kicker {
  color: var(--accent);
  font-size: 2rem;
  line-height: 1;
  font-weight: 700;
  text-transform: uppercase;
}

.spotlight-title .main {
  color: #ffffff;
  font-size: 2rem;
  line-height: 1;
  font-weight: 700;
}

.spotlight-meta {
  color: rgba(255,255,255,0.82);
  font-size: 0.95rem;
  white-space: nowrap;
}

.spotlight-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.spotlight-asset-banner,
.spotlight-group-card {
  background: #10273d;
  border: 1px solid #1a4262;
  border-radius: 16px;
}

.spotlight-asset-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
}

.spotlight-asset-left {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.spotlight-asset-banner .asset {
  color: var(--accent);
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
}

.spotlight-asset-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.spotlight-asset-tab,
.spotlight-group-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 14px;
  border: 1px solid #1a4262;
  border-radius: 999px;
  background: #0b1f33;
  color: rgba(255,255,255,0.84);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  text-transform: uppercase;
}

.spotlight-asset-tab:hover {
  border-color: #2d5d82;
  color: #ffffff;
}

.spotlight-asset-tab.active,
.spotlight-group-pill {
  border-color: var(--accent);
  color: var(--accent);
}

.spotlight-group-card {
  overflow: hidden;
}

.spotlight-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: #031425;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.spotlight-group-count {
  color: rgba(255,255,255,0.84);
  font-size: 0.94rem;
}

.spotlight-group-body {
  padding: 12px 16px 16px;
}

.spotlight-group-desc {
  color: rgba(255,255,255,0.88);
  font-size: 0.92rem;
  font-weight: 700;
  text-transform: uppercase;
}

.spotlight-group-cond,
.spotlight-note {
  margin-top: 8px;
  color: rgba(255,255,255,0.78);
  font-size: 0.88rem;
}

.spotlight-group-cond strong {
  color: rgba(255,255,255,0.92);
}

.spotlight-empty {
  margin-top: 10px;
  color: rgba(255,255,255,0.72);
  font-size: 0.92rem;
}

.spotlight-table-wrap {
  margin-top: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  overflow: hidden;
  background: #06182a;
}

.spotlight-table-scroll {
  max-height: 26.5rem;
  overflow: auto;
}

.spotlight-table {
  width: 100%;
  border-collapse: collapse;
}

.spotlight-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #031425;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.96);
  font-size: 0.84rem;
  font-weight: 700;
  text-align: left;
}

.spotlight-col-name {
  width: 32%;
}

.spotlight-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.9);
  font-size: 0.84rem;
  vertical-align: top;
}

.spotlight-table tbody tr:nth-child(odd) {
  background: rgba(255,255,255,0.01);
}

.spotlight-table tbody tr:hover {
  background: rgba(255,255,255,0.04);
}

.spotlight-link {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  cursor: pointer;
  font-weight: 700;
}

.spotlight-name-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.spotlight-add-btn {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255,165,0,0.38);
  border-radius: 999px;
  background: transparent;
  color: #ffa500;
  font-size: 16px;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
}

.spotlight-add-btn:hover {
  background: rgba(255,165,0,0.12);
  border-color: #ffa500;
}

.spotlight-ai-cell {
  min-width: 22rem;
  font-weight: 700;
}

.spotlight-ai-cell.loading::after{
  content: "...";
  display: inline-block;
  width: 1.2em;
  overflow: hidden;
  vertical-align: bottom;
  animation: btiLoadingDots 1.2s steps(4, end) infinite;
}

@keyframes btiLoadingDots{
  0%   { width: 0; }
  25%  { width: 0.4em; }
  50%  { width: 0.8em; }
  75%  { width: 1.2em; }
  100% { width: 0; }
}

.spotlight-table tbody td.spotlight-ai-cell--positive {
  color: #57d37d;
}

.spotlight-table tbody td.spotlight-ai-cell--negative {
  color: #ff6b6b;
}

.spotlight-table tbody td.spotlight-ai-cell--neutral {
  color: #ffffff;
}

body.spotlight-portfolio-popup-open {
  overflow: hidden;
}

.spotlight-portfolio-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.52);
  z-index: 9500;
}

.spotlight-portfolio-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(92vw, 420px);
  background: #06182a;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.45);
  z-index: 9501;
  color: #fff;
  overflow: hidden;
}

.spotlight-portfolio-popup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.spotlight-portfolio-popup-title {
  font-size: 15px;
  font-weight: 800;
  color: #ffa500;
}

.spotlight-portfolio-popup-close {
  border: 0;
  background: transparent;
  color: rgba(255,255,255,0.78);
  cursor: pointer;
  font-size: 18px;
}

.spotlight-portfolio-popup-body {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.spotlight-portfolio-popup-instrument {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
  color: rgba(255,255,255,0.72);
}

.spotlight-portfolio-popup-instrument strong {
  color: #fff;
  font-size: 14px;
}

.spotlight-portfolio-popup-field {
  display: grid;
  gap: 6px;
}

.spotlight-portfolio-popup-field label {
  font-size: 12px;
  color: rgba(255,255,255,0.74);
  font-weight: 700;
}

.spotlight-portfolio-input {
  width: 100%;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 10px;
  background: #0b1f33;
  color: #fff;
  outline: none;
}

.spotlight-portfolio-input.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.spotlight-portfolio-popup-msg {
  min-height: 16px;
  font-size: 12px;
  color: #ff8f8f;
}

.spotlight-portfolio-popup-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 16px 16px;
}

.spotlight-portfolio-btn {
  min-width: 100px;
  height: 36px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}

.spotlight-portfolio-btn-secondary {
  border: 1px solid rgba(255,255,255,0.10);
  background: transparent;
  color: #fff;
}

.spotlight-portfolio-btn-primary {
  border: 1px solid #ffa500;
  background: #ffa500;
  color: #001122;
}

@media (max-width: 900px) {
  .spotlight-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .spotlight-title .kicker,
  .spotlight-title .main {
    font-size: 1.6rem;
  }

  .spotlight-table-scroll {
    max-height: none;
  }
}

/* ==================== Shared Strategies pages ==================== */
.strat-page {
  width: 100%;
  min-height: calc(var(--viewport-h) - (var(--page-pad-y) * 2));
  display: grid;
  grid-template-columns: minmax(280px, 310px) minmax(0, 1fr);
  gap: 10px;
  padding-top: 4px;
}

.strat-left,
.strat-right {
  min-width: 0;
  min-height: 0;
}

.strat-left {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 9px 12px;
  background: #02111f;
  border: 1px solid #1a4262;
  border-radius: 14px;
}

.strat-left-head {
  color: rgba(255,255,255,0.92);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.strat-menu {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.strat-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.strat-section-head {
  min-height: 32px;
  width: 100%;
  padding: 0 10px;
  border: 1px solid rgba(255,165,0,0.12);
  border-radius: 9px;
  background: rgba(255,165,0,0.055);
  color: rgba(255,255,255,0.92);
  text-align: left;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.035em;
  text-transform: uppercase;
  cursor: pointer;
}

.strat-section-head.collapsed {
  opacity: 0.82;
}

.strat-section-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.strat-section-body.collapsed {
  display: none;
}

.strat-theme {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.strat-theme-title {
  padding: 0 8px;
  color: rgba(255,255,255,0.7);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.strat-item {
  min-height: 33px;
  width: 100%;
  padding: 7px 10px 7px 12px;
  border: 1px solid #1a4262;
  border-radius: 9px;
  background: rgba(11,31,51,0.78);
  color: rgba(255,255,255,0.88);
  text-align: left;
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, color .16s ease, box-shadow .16s ease;
}

.strat-item:hover {
  border-color: #2d5d82;
  background: rgba(16,38,59,0.9);
  color: rgba(255,255,255,0.98);
}

.strat-item.active {
  border-color: #1a4262;
  background: rgba(255,165,0,0.045);
  color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.strat-right {
  overflow: hidden;
}

.strat-content {
  width: 100%;
  height: 100%;
}

.strat-content-card {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  background: #10273d;
  border: 1px solid #1a4262;
  border-radius: 16px;
}

.strat-content-title {
  color: rgba(255,255,255,0.95);
  font-size: 1.05rem;
  font-weight: 700;
  text-transform: uppercase;
}

.strat-row {
  display: grid;
  gap: 12px;
}

.strat-row-top {
  grid-template-columns: 1fr;
}

.strat-row-bottom {
  grid-template-columns: 1fr;
}

.strat-col {
  min-width: 0;
}

.strat-panel {
  min-width: 0;
  min-height: 0;
  padding: 12px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
}

.strat-panel-title {
  margin-bottom: 10px;
  color: rgba(255,255,255,0.92);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

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

.strat-kpi {
  min-height: 78px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 14px;
  background: rgba(255,255,255,0.03);
}

.strat-kpi-label {
  color: rgba(255,255,255,0.8);
  font-size: 0.76rem;
  line-height: 1.25;
  overflow-wrap: normal;
}

.strat-kpi-value {
  color: #ffffff;
  font-size: 0.96rem;
  font-weight: 700;
  line-height: 1.25;
}

.strat-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.strat-tabs .tab-btn {
  min-height: 34px;
  padding: 0 2px 8px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: rgba(255,255,255,0.72);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.045em;
  text-align: left;
  text-transform: uppercase;
  white-space: normal;
  box-shadow: none;
}

.strat-tabs .tab-btn:hover {
  border-color: transparent;
  border-bottom-color: rgba(255,165,0,0.45);
  background: transparent;
  color: rgba(255,255,255,0.94);
}

.strat-tabs .tab-btn.active {
  border-color: transparent;
  border-bottom-color: var(--accent);
  background: transparent;
  color: var(--accent);
}

.strat-chart-wrap {
  position: relative;
  height: 300px !important;
  min-height: 300px;
  border-radius: 14px;
  overflow: hidden;
}

.strat-chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.strat-muted {
  color: rgba(255,255,255,0.72);
  font-size: 0.84rem;
}

.strat-table-wrap {
  margin-top: 10px;
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-gutter: stable;
}

.strat-model-notice {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-left: 3px solid rgba(255,165,0,0.72);
  border-radius: 0 10px 10px 0;
  background: rgba(255,165,0,0.06);
  color: rgba(255,255,255,0.76);
  font-size: 0.8rem;
  line-height: 1.5;
}

.strat-table-wrap .report-table {
  min-width: 1010px;
}

.report-table {
  width: 100% !important;
  border-collapse: collapse !important;
}

.report-table th,
.report-table td {
  padding: 7px 10px;
  white-space: nowrap;
  text-align: left;
}

.report-table thead th {
  min-width: 88px;
  color: rgba(255,255,255,0.92);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.25;
  white-space: normal;
  vertical-align: bottom;
}

.strat-th-line {
  display: block;
  white-space: nowrap;
}

.strat-table-wrap .report-table th,
.strat-table-wrap .report-table td {
  padding-right: 7px;
  padding-left: 7px;
}

.strat-table-wrap .report-table thead th:first-child {
  min-width: 160px;
}

.strat-table-wrap .report-table thead th:nth-child(2) {
  min-width: 125px;
}

.strat-table-wrap .report-table thead th:nth-child(3),
.strat-table-wrap .report-table thead th:nth-child(4) {
  min-width: 92px;
}

.strat-table-wrap .report-table thead th:nth-child(5),
.strat-table-wrap .report-table thead th:nth-child(6),
.strat-table-wrap .report-table thead th:nth-child(7),
.strat-table-wrap .report-table thead th:nth-child(8) {
  min-width: 104px;
}

.strat-table-wrap .report-table thead th:last-child {
  min-width: 118px;
}

.strat-table-wrap .report-table tbody td:first-child,
.strat-table-wrap .report-table tbody td:nth-child(2),
.strat-table-wrap .report-table tbody td:last-child {
  line-height: 1.3;
  white-space: normal;
  overflow-wrap: anywhere;
}

.report-table tbody td {
  color: rgba(255,255,255,0.86);
  font-size: 0.84rem;
}

.report-table tbody tr:hover {
  background: rgba(255,255,255,0.03);
}

@media (max-width: 1100px) {
  .strat-page {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 720px) {
  .strat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .strat-grid {
    grid-template-columns: 1fr;
  }
}


/* ========================================================================== */
/* BTI · CSS REBUILD · PHASE 2                                                */
/* Dashboard internals rebuilt to match current visual structure              */
/* Scope: Block 2 / Block 3 / Block 4 + sidebar list + reusable dashboard UI */
/* ========================================================================== */

/* ==================== Sidebar instrument tree ==================== */
#sidebar ul,
#sidebar ol {
  list-style: none;
}

#sidebar-list {
  flex: 1 1 auto;
  min-height: 0;
}

#sidebar-list,
#sidebar .sidebar-root-list,
#sidebar .children,
#sidebar .instrument-list,
#sidebar-search-results,
#instrument-list {
  width: 100%;
}

#sidebar .sidebar-root-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 6px 8px;
}

#sidebar .sidebar-category,
#sidebar .submenu-item,
#sidebar .menu-item,
#sidebar .sidebar-item,
#sidebar .asset-class,
#sidebar .instrument-item {
  min-width: 0;
}

#sidebar .sidebar-category {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#sidebar .sidebar-category-header,
#sidebar .instrument-item,
#sidebar-search-results li {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 7px 8px;
  border-radius: 4px;
  color: rgba(255,255,255,0.88);
  font-size: 11px;
  line-height: 1.25;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

#sidebar .sidebar-category-header::before,
#sidebar .instrument-item::before,
#sidebar-search-results li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  bottom: 7px;
  width: 0;
  border-radius: 999px;
  background: var(--accent);
  opacity: 0;
  transition: width 0.14s ease, opacity 0.14s ease;
}

#sidebar .sidebar-category-header:hover,
#sidebar .instrument-item:hover,
#sidebar-search-results li:hover {
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.98);
}

#sidebar .sidebar-category-header:hover::before,
#sidebar .instrument-item:hover::before,
#sidebar-search-results li:hover::before {
  width: 3px;
  opacity: 0.92;
}

#sidebar .sidebar-category-header.clickable {
  cursor: pointer;
}

#sidebar .toggle {
  flex: 0 0 14px;
  width: 14px;
  color: rgba(255,255,255,0.66);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

#sidebar .label,
#sidebar .instrument-item,
#sidebar-search-results li {
  min-width: 0;
}

#sidebar .label {
  flex: 1 1 auto;
  overflow-wrap: anywhere;
}

#sidebar .children,
#sidebar .instrument-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-left: 8px;
  padding-left: 8px;
  border-left: 1px solid rgba(255,255,255,0.08);
}

#sidebar .children {
  margin-top: 2px;
}

#sidebar .sidebar-root-list > .sidebar-category > .sidebar-category-header,
#sidebar .sidebar-category-header.sidebar-depth-0 {
  background: #031426;
  border-left: 2px solid rgba(95, 196, 255, 0.20);
  box-shadow: none;
}

#sidebar .sidebar-category-header.sidebar-depth-1,
#sidebar .children > .sidebar-category > .sidebar-category-header.sidebar-depth-1 {
  background: #08233a;
  border-left: 2px solid rgba(58, 166, 255, 0.28);
}

#sidebar .sidebar-category-header.sidebar-depth-2,
#sidebar .children .children > .sidebar-category > .sidebar-category-header.sidebar-depth-2,
#sidebar .children .instrument-item,
#sidebar .instrument-list > .instrument-item {
  background: #10314a;
  border-left: 2px solid rgba(255,255,255,0.12);
}

#sidebar .children .children > .sidebar-category:nth-child(even) > .sidebar-category-header.sidebar-depth-2,
#sidebar .children .instrument-item:nth-child(even),
#sidebar .instrument-list > .instrument-item:nth-child(even) {
  background: #153a55;
}

#sidebar .instrument-list {
  margin-top: 1px;
}

#sidebar .children .sidebar-category-header,
#sidebar .children .instrument-item,
#sidebar .instrument-list .instrument-item {
  min-height: 30px;
  padding-top: 6px;
  padding-bottom: 6px;
  font-size: 10.5px;
  letter-spacing: 0.05em;
}

#sidebar .children .children,
#sidebar .children .instrument-list {
  margin-left: 8px;
  padding-left: 8px;
}

#sidebar .children .sidebar-category-header::before,
#sidebar .children .instrument-item::before {
  top: 6px;
  bottom: 6px;
}

#sidebar .children .sidebar-category-header:hover::before,
#sidebar .children .instrument-item:hover::before {
  width: 2px;
  opacity: 0.7;
}

#sidebar .children .children .sidebar-category-header:hover::before,
#sidebar .children .children .instrument-item:hover::before {
  width: 1px;
  opacity: 0.45;
}

#sidebar .instrument-item {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  color: rgba(255,255,255,0.78);
}

#sidebar .instrument-item.selected,
#sidebar .instrument-item.active,
#sidebar .sidebar-category-header.active,
#sidebar-search-results li.selected {
  color: var(--accent);
  background: linear-gradient(90deg, rgba(255,165,0,0.12), rgba(255,165,0,0.02));
}

#sidebar .instrument-item.selected::before,
#sidebar .instrument-item.active::before,
#sidebar .sidebar-category-header.active::before,
#sidebar-search-results li.selected::before {
  width: 4px;
  opacity: 1;
}

#sidebar .instrument-item.selected:hover,
#sidebar .instrument-item.active:hover,
#sidebar-search-results li.selected:hover {
  color: var(--accent);
}

#sidebar a,
#sidebar button,
#sidebar .sidebar-link,
#sidebar .sidebar-node {
  color: inherit;
  text-decoration: none;
}

#sidebar-search-results {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 8px 0;
}

#sidebar-search-results li {
  list-style: none;
  text-transform: none;
  letter-spacing: 0.01em;
  font-size: 11px;
}

/* ==================== Shared dashboard tabs ==================== */
.sim-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.sim-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.tab-btn,
.sim-tab,
.pill-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid #163247;
  background: #0b1f33;
  color: #d7e6f2;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
}

.tab-btn:hover,
.sim-tab:hover,
.pill-tab:hover {
  background: #12304a;
  border-color: #214866;
}

.tab-btn.active,
.sim-tab.active,
.pill-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
}
/* ==================== Block 2 ==================== */
#block2 {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 8px;
}

#block2 #symbol-info-container {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#block2 .sim-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#block2 .sim-pane {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#block2 .sim-pane.hidden {
  display: none;
}

#block2 .sim-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
}

#block2 .sim-chart-wrap,
#block2 .chart-panel,
#block2 .benchmark-panel,
#block2 #sim-chart-host {
  flex: 1 1 auto;
  min-height: 0;
  overflow: visible;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255,255,255,0.06);
  background: #04182a;
}

#block2 .bench-picker {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
  width: min(100%, 100%);
}

#block2 .bench-picker input,
#block2 .bench-picker select {
  min-width: min(100%, 150px);
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid #163247;
  background: #0b1f33;
  color: #e6edf3;
}

#block2 .bench-picker button {
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid #163247;
  background: #0b1f33;
  color: #e6edf3;
}

#block2 .bench-picker .bench-input-wrap{
  position: relative;
  display: flex;
  align-items: stretch;
  height: 28px;
  min-width: min(100%, 220px);
  width: 260px;
  max-width: 260px;
  flex: 0 0 260px;
  border: 1px solid #30363d;
  border-radius: 999px;
  background: #0d1117;
  overflow: visible;
}

#block2 .bench-picker input#bench-input{
  flex: 1 1 auto;
  height: 100% !important;
  border: none !important;
  background: transparent !important;
  color: #e6edf3 !important;
  padding: 6px 12px !important;
  outline: none !important;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#block2 .bench-picker .bench-input-wrap:focus-within{
  border-color: #ffa500;
  box-shadow: 0 0 0 2px rgba(255,165,0,0.15);
}

#block2 .bench-picker button.bench-dd{
  flex: 0 0 34px;
  height: 100%;
  border: none;
  background: transparent;
  color: #e6edf3;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-left: 1px solid rgba(255,255,255,0.10);
}

#block2 .bench-picker button.bench-dd:hover{
  background: rgba(255,165,0,0.10);
  color: #ffb400;
}

#block2 .bench-picker .bench-dropdown{
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 2000;
  max-height: 260px;
  overflow: auto;
  border-radius: 12px;
  border: 1px solid #163247;
  background: #0b1f33;
  box-shadow: 0 10px 24px rgba(0,0,0,0.35);
  padding: 6px;
  backdrop-filter: blur(6px);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,165,0,0.35) rgba(0,17,34,0.55);
}

#block2 .bench-picker .bench-dropdown::-webkit-scrollbar {
  width: 8px;
}

#block2 .bench-picker .bench-dropdown::-webkit-scrollbar-track {
  background: rgba(0,17,34,0.55);
  border-radius: 999px;
}

#block2 .bench-picker .bench-dropdown::-webkit-scrollbar-thumb {
  background: rgba(255,165,0,0.35);
  border-radius: 999px;
  border: 2px solid rgba(0,17,34,0.55);
}

#block2 .bench-picker .bench-dropdown::-webkit-scrollbar-thumb:hover {
  background: rgba(255,165,0,0.55);
}

#block2 .bench-picker .bench-dropdown.hidden{
  display: none;
}

#block2 .bench-picker .bench-opt{
  width: 100%;
  border: 1px solid #163247;
  background: #0b1f33;
  color: #e6edf3;
  border-radius: 10px;
  padding: 8px 10px;
  margin: 6px 0;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

#block2 .bench-picker .bench-opt:hover{
  border-color: rgba(255,165,0,0.35);
  background: rgba(255,165,0,0.10);
}

#block2 .bench-picker .bench-opt-label{
  font-weight: 650;
  letter-spacing: .2px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#block2 .bench-picker .bench-opt-key{
  font-size: 11px;
  color: rgba(200,210,220,0.75);
  font-variant-numeric: tabular-nums;
}

#block2 #bench-canvas,
#block2 #sim-canvas,
#block2 #capm-canvas {
  flex: 1 1 auto;
  min-height: 0 !important;
  max-height: 100% !important;
  width: 100% !important;
  display: block;
}

#block2 canvas,
#block2 svg {
  width: 100% !important;
  max-width: 100%;
  min-height: 0;
  display: block;
}

/* =========================
   SINGLE-INDEX — layout vero
   ========================= */

#pane-sim {
  overflow: auto;
  padding-bottom: 10px;
}

.sim-sim-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.sim-chart-wrap {
  height: clamp(180px, 28vh, 280px);
  flex: 0 0 auto;
  min-height: 180px;
}

.sim-explain-card {
  flex: 0 0 auto;
  border: 1px solid #163247;
  border-radius: 14px;
  background: #0b1f33;
  padding: 12px;
}

.sim-explain-title {
  font-weight: 700;
  letter-spacing: 0.2px;
  margin-bottom: 2px;
}

.sim-explain-sub {
  opacity: 0.85;
  font-size: 12px;
  margin-bottom: 8px;
}

.sim-note {
  opacity: 0.75;
  font-size: 12px;
  margin: 4px 0 10px 0;
}

.sim-explain-box {
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(0,0,0,0.14);
  border-radius: 12px;
  padding: 10px;
}

.sim-explain-section {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.2px;
  margin-bottom: 8px;
  opacity: 0.95;
}

.sim-explain-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(0,0,0,0.10);
  border: 1px solid rgba(255,255,255,0.05);
  margin-bottom: 8px;
}

.sim-explain-row:last-child {
  margin-bottom: 0;
}

.sim-explain-row span {
  opacity: 0.82;
  font-size: 12px;
}

.sim-explain-row strong {
  text-align: right;
  font-weight: 700;
  font-size: 12px;
}

@media (min-width: 1100px) {
  #pane-sim {
    overflow: hidden;
  }

  .sim-sim-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(320px, 1fr);
    gap: 14px;
    align-items: stretch;
  }

  .sim-chart-wrap {
    height: 100%;
    min-height: 300px;
    max-height: 100%;
  }

  .sim-explain-card {
    height: 100%;
    overflow: auto;
    display: flex;
    flex-direction: column;
  }
}
/* ==================== Block 3 ==================== */
#block3 {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 10px;
}

#block3 .sim-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#block3 .sim-pane {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

#block3 .sim-pane.hidden {
  display: none;
}

#block3 .st-sec-title {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.3px;
  color: rgba(255,255,255,0.92);
  text-transform: uppercase;
}

#block3 .st-asym-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 6px;
}

#block3 .st-bottom-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 6px;
}

#block3 .st-metric {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  background: #0b1f33;
  padding: 9px 10px 8px;
  min-width: 0;
}

#block3 .st-metric-val {
  font-size: 15px;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 6px;
}

#block3 .st-metric-val {
  font-size: 15px;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 6px;
}

#block3 .st-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid rgba(0,255,140,0.38);
  background: rgba(0,255,140,0.14);
  color: #f3fffb;
  font-size: 10px;
  font-weight: 800;
}

#block3 .st-chip.bullish {
  border-color: rgba(0,255,140,0.45);
  background: rgba(0,255,140,0.18);
  color: #eafff7;
}

#block3 .st-chip.red {
  border-color: rgba(255,70,70,0.42);
  background: rgba(255,70,70,0.18);
  color: #fff3f3;
}

#block3 .st-chip.gray {
  border-color: rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.90);
}

#block3 .st-bar-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 64px;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
}

#block3 .st-bar-lbl,
#block3 .st-bar-val {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,0.88);
}

#block3 .st-bar-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  overflow: hidden;
  position: relative;
}

#block3 .st-bar-zero {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: rgba(255,255,255,0.22);
  z-index: 1;
}

#block3 .st-bar-fill {
  position: absolute;
  top: 0;
  height: 100%;
  border-radius: 999px;
  z-index: 2;
}

#block3 .st-bar-fill.pos {
  background: linear-gradient(90deg, #17b26a 0%, #2dd881 100%);
  box-shadow: 0 0 10px rgba(45,216,129,0.38);
}

#block3 .st-bar-fill.neg {
  background: linear-gradient(90deg, #d84c4c 0%, #ff6b6b 100%);
  box-shadow: 0 0 10px rgba(255,107,107,0.32);
}

#block3 .st-bar-fill.st-bar-pos {
  background: linear-gradient(90deg, #17b26a 0%, #2dd881 100%);
  box-shadow: 0 0 10px rgba(45,216,129,0.38);
}

#block3 .st-bar-fill.st-bar-neg {
  background: linear-gradient(90deg, #d84c4c 0%, #ff6b6b 100%);
  box-shadow: 0 0 10px rgba(255,107,107,0.32);
}

#block3 .st-bar-fill.st-bar-none {
  background: transparent;
  box-shadow: none;
}

#block3 .st-techbox,
#block3 .st-volbox {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  background: #0b1f33;
  padding: 7px 9px;
  min-width: 0;
}

#block3 .st-vol-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.92);
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 8px;
}

#block3 .st-tech-title {
  font-weight: 800;
  letter-spacing: 0.2px;
  opacity: 0.92;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  white-space: nowrap;
}

#block3 .st-tech-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

#block3 .st-tech-lbl,
#block3 .st-vol-lbl {
  font-size: 11px;
  opacity: 0.75;
  font-weight: 700;
  margin-bottom: 4px;
}

#block3 .st-tech-val,
#block3 .st-vol-val {
  font-size: 15px;
  font-weight: 800;
}

#block3 .st-tech-sub {
  font-size: 11px;
  opacity: 0.72;
  font-weight: 700;
}

#block3 .st-vol-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 6px;
}

#block3 .st-vol-item {
  min-width: 0;
}

#block3 .st-vol-status {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.2px;
  opacity: 0.92;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
}
/* ==================== Block 3 · RISK & RETURN + FUNDAMENTALS ==================== */

#block3 .sim-pane[data-pane="rr"],
#block3 .sim-pane[data-pane="fund"] {
  padding-top: 2px;
}

#block3 .sim-pane[data-pane="st"] {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#block3 .sim-pane[data-pane="st"] .risk-metrics.st-new {
  width: 100%;
  height: 100%;
  min-height: 0;
  flex: 1 1 auto;
  display: grid;
  grid-template-rows: minmax(0, 0.85fr) minmax(0, 1fr) minmax(0, 0.85fr);
  gap: clamp(4px, 0.7vh, 8px);
  overflow: hidden;
}

#block3 .sim-pane[data-pane="st"] .rm-section {
  min-height: 0;
  overflow: hidden;
}

#block3 .sim-pane[data-pane="st"] .st-asym-grid,
#block3 .sim-pane[data-pane="st"] .st-bottom-split {
  height: 100%;
  min-height: 0;
  gap: clamp(4px, 0.6vh, 8px);
}

#block3 .sim-pane[data-pane="st"] .st-metric,
#block3 .sim-pane[data-pane="st"] .st-techbox,
#block3 .sim-pane[data-pane="st"] .st-volbox {
  height: 100%;
  min-height: 0;
  padding: clamp(6px, 0.8vh, 10px);
  overflow: hidden;
}

#block3 .sim-pane[data-pane="st"] .st-volbox {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-top: clamp(5px, 0.6vh, 8px);
  padding-bottom: clamp(5px, 0.6vh, 8px);
}

#block3 .sim-pane[data-pane="st"] .st-vol-row {
  align-items: flex-start;
  line-height: 1.05;
}

#block3 .sim-pane[data-pane="st"] .st-tech-title {
  white-space: normal;
  line-height: 1.1;
}

#block3 .risk-metrics {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

#block3 .rm-section {
  margin: 0;
}

#block3 .rm-section-title,
#block3 .fund-section-title {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: rgba(255,255,255,0.92);
  text-transform: uppercase;
}

#block3 .rm-grid,
#block3 .fund-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

#block3 .rm-grid > div,
#block3 .fund-row {
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  background: #0b1f33;
  padding: 6px 8px;
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#block3 .rm-grid span,
#block3 .fund-row span {
  color: rgba(255,255,255,0.76);
  font-size: 11px;
  line-height: 1.1;
}

#block3 .rm-grid strong,
#block3 .fund-row strong {
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#block3 #eq-fund-host,
#block3 #eq-fund-host .fund-card,
#block3 #eq-fund-host .sim-body,
#block3 #eq-fund-host .sim-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

#block3 #eq-fund-host .sim-toolbar {
  margin: 0 0 8px;
  padding: 0;
  border: 0;
}

#block3 #eq-fund-host .fund-tabs {
  margin: 0 0 8px;
}

#block3 #eq-fund-host .fund-grid {
  align-content: start;
}

#block3 #eq-fund-host .fund-row {
  min-height: 30px;
}

#block3 #eq-fund-host .fund-row strong {
  font-size: 11px;
}

#block3 #eq-fund-host .fund-grid + div + .fund-section-title {
  margin-top: 12px;
}

/* ==================== Block 4 AI panel ==================== */
#block4 {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 8px;
}

#block4 .ai-assistant,
#block4 .fund-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

#block4 .ai-assistant,
#block4 .ai-panel,
#block4 .ai-chat,
#block4 .ai-scroll,
#block4 .ai-history,
#block4 .ai-bubble,
#block4 .ai-message,
#block4 .chat-message,
#block4 .ai-bubble-role,
#block4 .chat-role,
#block4 .ai-bubble-content,
#block4 .chat-content,
#block4 .ai-text,
#block4 textarea,
#block4 input[type="text"],
#block4 .ai-input,
#block4 .ai-send,
#block4 button[type="submit"],
#block4 .send-btn {
  font-family: Arial, sans-serif;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#block4 .ai-panel {
  min-height: 0;
  height: auto;
}

#block4 .ai-chat,
#block4 .ai-scroll,
#block4 .ai-history {
  flex: 1 1 auto;
  min-height: 0;
  border: 1px solid #163247;
  border-radius: 16px;
  background: #0b1f33;
  padding: 12px;
  overflow-y: auto;
  overflow-x: hidden;
}


#block4 .ai-chat,
#block4 .ai-scroll,
#block4 .ai-history,
.spotlight-table-scroll {
  scrollbar-width: thin;
  scrollbar-color: #35566f #071521;
}

#block4 .ai-chat::-webkit-scrollbar,
#block4 .ai-scroll::-webkit-scrollbar,
#block4 .ai-history::-webkit-scrollbar,
.spotlight-table-scroll::-webkit-scrollbar {
  width: 10px;
}

#block4 .ai-chat::-webkit-scrollbar-track,
#block4 .ai-scroll::-webkit-scrollbar-track,
#block4 .ai-history::-webkit-scrollbar-track,
.spotlight-table-scroll::-webkit-scrollbar-track {
  background: #071521;
  border-radius: 999px;
}

#block4 .ai-chat::-webkit-scrollbar-thumb,
#block4 .ai-scroll::-webkit-scrollbar-thumb,
#block4 .ai-history::-webkit-scrollbar-thumb,
.spotlight-table-scroll::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #3f6784 0%, #2a4860 100%);
  border-radius: 999px;
  border: 2px solid #071521;
}

#block4 .ai-chat::-webkit-scrollbar-thumb:hover,
#block4 .ai-scroll::-webkit-scrollbar-thumb:hover,
#block4 .ai-history::-webkit-scrollbar-thumb:hover,
.spotlight-table-scroll::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #4d7a99 0%, #35566f 100%);
}

#block4 .sim-tabs {
  margin-bottom: 6px;
}

#block4 .ai-bubble,
#block4 .ai-message,
#block4 .chat-message {
  border-radius: 14px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
}

#block4 .ai-bubble-user,
#block4 .chat-message.user {
  background: rgba(255,165,0,0.10);
  border-color: rgba(255,165,0,0.18);
}

#block4 .ai-bubble-ai,
#block4 .chat-message.ai {
  background: rgba(255,255,255,0.03);
}

#block4 .ai-bubble-role,
#block4 .chat-role {
  display: block;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.15;
  text-transform: uppercase;
  color: rgba(255,255,255,0.72);
  margin-bottom: 6px;
}

#block4 .ai-bubble-content,
#block4 .chat-content,
#block4 .ai-text {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.62;
  color: rgba(255,255,255,0.94);
}

#block4 #ai-auto {
  white-space: pre-wrap;
}

#block4 #ai-auto .ai-auto-section + .ai-auto-section {
  margin-top: 12px;
}

#block4 #ai-auto .ai-auto-body {
  white-space: pre-wrap;
}

#block4 .ai-bubble-role,
#block4 .chat-role,
#block4 .ai-bubble-content,
#block4 .chat-content,
#block4 .ai-text,
#block4 textarea,
#block4 input[type="text"],
#block4 .ai-input,
#block4 .ai-send,
#block4 button[type="submit"],
#block4 .send-btn {
  font-family: inherit;;
}

#block4 .ai-composer,
#block4 .ai-input-wrap,
#block4 .composer {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1px solid #163247;
  border-radius: 16px;
  background: #0b1f33;
  padding: 6px 8px;
  flex: 0 0 auto;
  margin-top: 4px;
}

#block4 textarea,
#block4 input[type="text"],
#block4 .ai-input {
  width: 100%;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  background: transparent;
  color: #ffffff;
  padding: 8px 10px;
  font-size: 12px;
  resize: vertical;
  min-height: 44px;
}

#block4 .ai-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

#block4 .ai-send,
#block4 button[type="submit"],
#block4 .send-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--accent);
  color: #000;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

#block4 .fund-card {
  height: 100%;
  display: flex;
  flex-direction: column;
}

#block4 .fund-title {
  height: 30px;
  display: flex;
  align-items: center;
  font-weight: 700;
  color: #ffa500;
  margin-bottom: 4px;
  border-bottom: none;
  padding-bottom: 0;
}

#block4 .fund-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-content: start;
}

#block4 .fund-row {
  border: 1px solid #163247;
  border-radius: 8px;
  background: #0b1f33;
  padding: 8px;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#block4 .fund-row span {
  color: #aaa;
  font-size: 12px;
}

#block4 .fund-row strong {
  color: #fff;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: .2px;
}

#block4 .fund-section-title {
  color: #ddd;
  font-weight: 600;
  font-size: 13px;
  margin: 6px 0 6px 0;
  text-transform: uppercase;
  letter-spacing: .02em;
}

#block4 .sim-toolbar {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 6px;
}

#block4 .sim-toolbar .sim-tabs {
  margin-bottom: 0 !important;
}

#block4 .fund-card.eq-val-card {
  display: flex !important;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

#block4 .fund-card.eq-val-card .sim-body {
  flex: 1 1 auto;
  min-height: 0;
}

#block4 .fund-card.eq-val-card .sim-pane[data-pane="capm"] {
  flex: 1 1 auto;
  min-height: 0;
}

#block4 .fund-card.eq-val-card .sim-pane[data-pane="capm"] > div {
  flex: 1 1 auto;
  min-height: 0;
}

#block4 .fund-grid,
#block4 .fund-avg-tabs,
#block4 .fund-avg-grid {
  margin: 0 !important;
}

#block4 .fund-avg-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  min-height: 36px;
}

#block4 .fund-avg-tab {
  padding: 7px 12px;
  line-height: 1;
  font-size: 12px;
}

#block4 .fund-row {
  padding: 6px 8px !important;
  min-height: 36px !important;
}

/* ==================== Commodity / FX dashboard block layout (merged responsive + control refinements) ==================== */
#block2 .commodity-block2,
#block3 .commodity-block3 {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#block2 .commodity-block2-header,
#block3 .commodity-block3-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: nowrap;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

#block2 .commodity-block2-header::-webkit-scrollbar,
#block3 .commodity-block3-header::-webkit-scrollbar,
#block2 .cot-toggle.cot-pills::-webkit-scrollbar,
#block3 .cot-toggle.cot-pills::-webkit-scrollbar {
  display: none;
}

#block2 .commodity-block2-header > *,
#block3 .commodity-block3-header > * {
  min-width: 0;
}

#block2 .cot-toggle.cot-pills,
#block3 .cot-toggle.cot-pills {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

#block2 .commodity-block2 .cot-btn,
#block3 .commodity-block3 .cot-btn {
  flex: 0 0 auto;
  min-width: 0;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid rgba(255,165,0,0.88);
  border-radius: 10px;
  background: transparent;
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  text-align: center;
  box-shadow: inset 0 -1px 0 rgba(0,0,0,0.12);
}

#block2 .commodity-block2 .cot-btn.active-tab,
#block3 .commodity-block3 .cot-btn.active-tab {
  background: transparent;
  border-color: #ffb11f;
  color: #ffffff;
}

#block2 .commodity-block2 .cot-btn:not(.active-tab),
#block3 .commodity-block3 .cot-btn:not(.active-tab) {
  background: transparent;
}


#block2 .commodity-chart-wrapper,
#block3 .commodity-chart-wrapper {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

#block2 .commodity-chart-wrapper canvas,
#block3 .commodity-chart-wrapper canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

#block2 .fx-cot-header {
  justify-content: flex-start;
}

#block2 .fx-cot-header-right {
  flex: 0 0 auto;
  min-width: 0;
  width: auto;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
}

#block2 .fx-currency-toggle,
#block2 .fx-segment-toggle,
#block3 .season-toggle,
#block2 .commodity-block2 > .commodity-block2-header > .cot-toggle {
  justify-content: flex-start;
}

/* ==================== Commodity / FX / Property dashboard helpers ==================== */
.dashboard-split,
.cot-seasonality-layout,
.fx-seasonality-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  min-height: 0;
}

.dashboard-panel,
.cot-panel,
.seasonality-panel,
.market-panel {
  border: 1px solid rgba(255,255,255,0.06);
  background: #04182a;
  min-height: 0;
}

/* ==================== Dashboard responsive only ==================== */
@media (max-width: 1366px), (max-height: 900px) {
  #block3 .st-asym-grid {
    gap: 8px;
  }

  #block3 .st-bottom-split {
    gap: 8px;
  }

  #block4 .ai-chat,
  #block4 .ai-scroll,
  #block4 .ai-history {
    min-height: 140px;
  }
}

@media (max-width: 1024px) {
  #block3 {
    padding: 8px;
  }

  #block4 {
    padding: 7px;
  }

  #block3 .st-asym-grid,
  #block3 .st-bottom-split,
  #block3 .rm-grid,
  #block3 .fund-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  #block3 .st-asym-grid,
  #block3 .st-bottom-split,
  #block3 .rm-grid,
  #block3 .fund-grid,
  .dashboard-split,
  .cot-seasonality-layout,
  .fx-seasonality-layout {
    grid-template-columns: 1fr;
  }

  #block4 textarea,
  #block4 input[type="text"],
  #block4 .ai-input {
    min-height: 72px;
  }
}

#block4 .ai-assistant .ai-scroll{
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 6px; /* prima 8px */
}

#block4 .ai-assistant .ai-composer{
  flex: 0 0 auto;
  padding: 4px 6px;   /* prima 6px 8px */
  margin-top: 2px;    /* prima 6px */
}

#block4 .ai-assistant #ai-auto{
  margin-bottom: 2px; /* prima 6px */
}

#block4 .ai-assistant .ai-input{
  min-height: 44px;   /* prima 56px */
  font-family: inherit;
}

#block4 .ai-assistant .ai-actions{
  gap: 4px;           /* prima 6px */
  margin-top: 2px;    /* prima 6px */
}


@media (max-width: 820px) {
  #block2 .bench-picker {
    margin-left: 0;
    justify-content: stretch;
  }

  #block2 .bench-picker > * {
    flex: 1 1 100%;
  }

  #block2 .bench-picker .bench-input-wrap {
    width: 100%;
  }

  #block3 .st-tech-grid,
  #block3 .st-vol-row {
    grid-template-columns: 1fr;
  }
}

/* === BTI AI buttons fix === */
.bti-ai-answer-panel button {
  background: var(--accent);
  color: #001122;
  border: none;
  border-radius: 8px;
  padding: 6px 10px;
  font-weight: 700;
  cursor: pointer;
}

.bti-ai-answer-panel button:hover {
  filter: brightness(1.1);
}


/* Block 3 - Short Term: Upside Alpha "LAGS RALLIES" must be red */
.sim-pane[data-pane="st"] .st-asym-grid .st-metric:first-child .st-chip.st-chip-bad {
  background: rgba(255, 77, 79, 0.18) !important;
  border: 1px solid rgba(255, 77, 79, 0.55) !important;
  color: #ffffff !important;
}

.bti-legal-lock {
  overflow: hidden;
}

.bti-legal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 10, 22, 0.84);
  backdrop-filter: blur(2px);
}

.bti-legal-modal {
  width: min(720px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid rgba(255, 165, 0, 0.45);
  border-radius: 14px;
  background: #081424;
  color: #e8f0ff;
  padding: 22px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.bti-legal-title {
  margin: 0 0 12px;
  color: #FFA500;
  font-size: 1.3rem;
}

.bti-legal-text {
  margin: 0 0 14px;
  line-height: 1.5;
}

.bti-legal-docs {
  margin: 0 0 16px 18px;
  padding: 0;
}

.bti-legal-docs li + li {
  margin-top: 8px;
}

.bti-legal-docs a {
  color: #9fcbff;
  text-decoration: underline;
}

.bti-legal-docs a:hover {
  color: #cfe5ff;
}

.bti-legal-check {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  margin-bottom: 12px;
}

.bti-legal-check input {
  margin-top: 2px;
}

.bti-legal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.bti-legal-actions button {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 700;
  color: #101010;
  background: #FFA500;
  cursor: pointer;
}

.bti-legal-actions button:disabled {
  cursor: not-allowed;
  background: #5e5e5e;
  color: #cfcfcf;
}

.bti-legal-error {
  min-height: 20px;
  color: #ff8f8f;
  font-weight: 600;
}

@media (max-width: 640px) {
  .bti-legal-overlay {
    padding: 12px;
  }

  .bti-legal-modal {
    padding: 16px;
    border-radius: 12px;
  }

  .bti-legal-title {
    font-size: 1.15rem;
  }

  .bti-legal-actions {
    justify-content: stretch;
  }

  .bti-legal-actions button {
    width: 100%;
  }
}

.cot-intel-wrap { padding: 16px; color: #e6eef7; font-family: inherit; }
.cot-intel-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; align-items: start; }
.cot-card { background: #0b1f33; border: 1px solid #163247; border-radius: 10px; padding: 12px; }
.cot-full { grid-column: 1 / -1; }
.cot-table-wrap { overflow-x: auto; }
.cot-card table { width: 100%; border-collapse: collapse; font-size: 12px; }
.cot-card th, .cot-card td { border-bottom: 1px solid #163247; padding: 6px; text-align: left; }
.cot-card th { font-weight: 700; }
.cot-card td { font-weight: 400; }
.cot-chart-card { display: flex; flex-direction: column; }
.cot-chart-card .cot-chart { flex: 1; min-height: 0; }
.cot-chart { height: 260px; }
.cot-chart canvas { width: 100% !important; height: 100% !important; display: block; }
.cot-empty { padding: 16px; color: #ffb347; }
.cot-note { margin-top: 8px; font-size: 11px; color: #8aa0b8; line-height: 1.35; font-weight: 400; }

#cot-commodity-select {
  width: 100%;
  background: #0f263d;
  color: #ffffff;
  border: 1px solid #1d3a52;
  border-radius: 8px;
  height: 36px;
  padding: 0 10px;
  outline: none;
}
#cot-commodity-select:focus {
  border-color: #ff9f40;
  box-shadow: 0 0 0 2px rgba(255, 159, 64, 0.2);
}

.cot-top-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; align-items: stretch; }
.cot-top-grid .cot-top-card { height: 100%; display: flex; flex-direction: column; min-height: 0; }
.cot-top-grid .cot-top-card .cot-table-wrap { flex: 1; min-height: 0; overflow: auto; }

.cot-interpret-grid { display:grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap:10px; }
.cot-pill { background:#102a42; border:1px solid #1f3f5a; border-radius:10px; padding:10px; }
.cot-pill h4 { margin:0 0 6px 0; font-size:12px; color:#9fb5cc; }
.cot-pill p { margin:0; font-size:12px; color:#e6eef7; line-height:1.35; }

/* COT Intelligence section heading normalization */
.cot-intel-wrap .cot-card > h3,
.cot-intel-wrap .cot-card > label {
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #9fb5cc;
  margin: 0 0 8px 0;
  display: inline-block;
}

.cot-exposure-tabs { margin: 0 0 8px 0; }

.cot-positioning-tabs { margin: 0 0 8px 0; }

.cot-price-positioning-tabs { margin: 0 0 8px 0; }

/* COT Intelligence tabs aligned with the primary navigation language */
.cot-intel-wrap .cot-positioning-tabs,
.cot-intel-wrap .cot-exposure-tabs,
.cot-intel-wrap .cot-price-positioning-tabs {
  gap: 8px;
}

.cot-intel-wrap .cot-positioning-tabs .tab-btn,
.cot-intel-wrap .cot-exposure-tabs .tab-btn,
.cot-intel-wrap .cot-price-positioning-tabs .tab-btn {
  min-height: 34px;
  padding: 0 2px 8px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: rgba(255,255,255,0.72);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.045em;
  text-align: left;
  text-transform: uppercase;
  white-space: normal;
  box-shadow: none;
}

.cot-intel-wrap .cot-positioning-tabs .tab-btn:hover,
.cot-intel-wrap .cot-exposure-tabs .tab-btn:hover,
.cot-intel-wrap .cot-price-positioning-tabs .tab-btn:hover {
  border-color: transparent;
  border-bottom-color: rgba(255,165,0,0.45);
  background: transparent;
  color: rgba(255,255,255,0.94);
}

.cot-intel-wrap .cot-positioning-tabs .tab-btn.active,
.cot-intel-wrap .cot-exposure-tabs .tab-btn.active,
.cot-intel-wrap .cot-price-positioning-tabs .tab-btn.active {
  border-color: transparent;
  border-bottom-color: var(--accent);
  background: transparent;
  color: var(--accent);
}

.cot-chart-tabs-spacer { min-height: 34px; visibility: hidden; pointer-events: none; }

.cot-historical-analysis h4 {
  margin: 0 0 8px 0;
  color: #9fb5cc;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.02em;
}

.cot-historical-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 12px;
  align-items: start;
}

.cot-historical-analysis table {
  font-size: 11px;
}

.cot-historical-analysis th,
.cot-historical-analysis td {
  padding: 5px 6px;
}

.cot-positive {
  color: #45d483;
}

.cot-negative {
  color: #ff6b6b;
}

@media (max-width: 900px) {
  .cot-historical-grid {
    grid-template-columns: 1fr;
  }
}

/* ==================== Spread Intelligence V1 ==================== */
.spread-intel-wrap {
  padding: 10px 16px 12px;
  color: #e6eef7;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.spread-intel-tabs,
.spread-intel-prova-tabs {
  display: flex;
  align-items: center;
  margin: 0 0 8px 0 !important;
  gap: 6px !important;
  flex-wrap: wrap;
}

.spread-intel-tab,
.spread-intel-prova-tab {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 26px !important;
  padding: 0 10px !important;
  border-radius: 999px !important;
  border: 1px solid #163247 !important;
  background: #0b1f33 !important;
  color: #d7e6f2 !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  letter-spacing: 0 !important;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
}

.spread-intel-tab:hover,
.spread-intel-prova-tab:hover {
  background: #12304a !important;
  border-color: #214866 !important;
}

.spread-intel-tab.active,
.spread-intel-prova-tab.active {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: #000 !important;
}

/* Spread Intelligence tabs aligned with the primary navigation language */
.spread-intel-tabs {
  gap: 8px !important;
}

.spread-intel-tabs .spread-intel-tab {
  min-height: 34px !important;
  padding: 0 2px 8px !important;
  border: 0 !important;
  border-bottom: 2px solid transparent !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: rgba(255,255,255,0.72) !important;
  font-size: 0.78rem !important;
  font-weight: 700 !important;
  line-height: 1.25;
  letter-spacing: 0.045em !important;
  text-align: left;
  text-transform: uppercase;
  white-space: normal;
  box-shadow: none !important;
}

.spread-intel-tabs .spread-intel-tab:hover {
  border-color: transparent !important;
  border-bottom-color: rgba(255,165,0,0.45) !important;
  background: transparent !important;
  color: rgba(255,255,255,0.94) !important;
}

.spread-intel-tabs .spread-intel-tab.active {
  border-color: transparent !important;
  border-bottom-color: var(--accent) !important;
  background: transparent !important;
  color: var(--accent) !important;
}

.spread-intel-alert {
  border: 1px solid rgba(255, 179, 71, .36);
  background: rgba(255, 179, 71, .08);
  color: #ffcc86;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.35;
}

.spread-intel-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-top: 4px;
}

.spread-intel-card {
  background: #0b1f33;
  border: 1px solid #163247;
  border-radius: 10px;
  padding: 10px 12px;
}

.spread-intel-kpi-overview {
  border-color: rgba(255, 165, 0, .22);
  padding-top: 8px;
  padding-bottom: 8px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .16);
}

.spread-intel-kpi {
  min-height: 38px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 4px;
  padding: 1px 10px 1px 0;
  border-right: 1px solid rgba(22, 50, 71, .72);
}

.spread-intel-kpi:last-child {
  border-right: 0;
  padding-right: 0;
}

.spread-intel-kpi-label,
.spread-intel-card-title {
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.35;
  color: #9fb5cc;
}

.spread-intel-card-title {
  display: inline-block;
}

.spread-intel-kpi-label {
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.spread-intel-kpi-value {
  font-size: 18px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0;
  color: #e6eef7;
}

.spread-intel-kpi-positive .spread-intel-kpi-value,
.spread-intel-positive { color: #45d483; }
.spread-intel-kpi-negative .spread-intel-kpi-value,
.spread-intel-negative { color: #ff6b6b; }
.spread-intel-kpi-accent .spread-intel-kpi-value { color: #ffa500; }
.spread-intel-kpi-neutral .spread-intel-kpi-value { color: #c8d6e5; }

.spread-intel-table-wrap {
  overflow-x: auto;
  margin-top: 6px;
}

.spread-intel-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  line-height: normal;
}

.spread-intel-table th,
.spread-intel-table td {
  border-bottom: 1px solid #163247;
  padding: 6px;
  text-align: left;
  white-space: nowrap;
}

.spread-intel-table td {
  color: #e6eef7;
  font-size: 12px;
  font-weight: 400;
  line-height: normal;
}

.spread-intel-table th {
  color: #e6eef7;
  font-size: 12px;
  font-weight: 700;
  line-height: normal;
  letter-spacing: 0;
  text-transform: none;
}

.spread-intel-table .spread-intel-col-separator {
  border-left: 1px solid rgba(255,255,255,0.08);
}

.spread-intel-sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  text-align: left;
  cursor: pointer;
}

.spread-intel-sort-btn:hover,
.spread-intel-sort-btn.active {
  color: #ffa500;
}

.spread-intel-sort-arrow {
  min-width: 9px;
  color: #ffa500;
  font-size: 10px;
  line-height: 1;
}

.spread-intel-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.spread-intel-info-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
  color: #d7e6f2;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.spread-intel-info-button:hover {
  border-color: rgba(255, 165, 0, .62);
  color: #ffa500;
}

.spread-intel-info-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0, 10, 20, .62);
}

.spread-intel-info-modal {
  position: relative;
  width: min(680px, 100%);
  max-height: min(82vh, 760px);
  overflow: auto;
  border: 1px solid #24465f;
  border-radius: 14px;
  background: #071827;
  color: #e6eef7;
  padding: 18px 20px;
  box-shadow: 0 18px 46px rgba(0, 0, 0, .38);
}

.spread-intel-info-modal h3 {
  margin: 0 34px 14px 0;
  color: #ffa500;
  font-size: 16px;
}

.spread-intel-info-content {
  display: grid;
  gap: 12px;
}

.spread-intel-info-content h4 {
  margin: 0 0 4px;
  color: #e6eef7;
  font-size: 13px;
}

.spread-intel-info-content p {
  margin: 0;
  color: #d7e6f2;
  font-size: 13px;
  line-height: 1.45;
}

.spread-intel-info-close {
  position: absolute;
  top: 10px;
  right: 10px;
  border: 0;
  background: transparent;
  color: #9fb5cc;
  cursor: pointer;
  font-size: 20px;
}

.spread-intel-info-close:hover {
  color: #ffa500;
}

.spread-intel-row {
  cursor: pointer;
  transition: background .16s ease, opacity .16s ease;
}

.spread-intel-row:hover,
.spread-intel-row.selected {
  background: rgba(255, 165, 0, .08);
}

.spread-intel-row.selected .spread-intel-spread-name {
  color: #ffa500;
}

.spread-intel-row.muted {
  opacity: .58;
}

.spread-intel-spread-name {
  color: #e6eef7;
  font-size: 12px;
  font-weight: 400;
  line-height: normal;
}

.spread-intel-signal {
  display: inline;
  color: #e6eef7;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: normal;
  text-transform: none;
}

.spread-intel-signal-long {
  color: #45d483;
}

.spread-intel-signal-short {
  color: #ff6b6b;
}

.spread-intel-signal-neutral {
  color: #e6eef7;
}

.spread-intel-signal-no-opportunity {
  color: #8fa4ba;
}

.spread-intel-main-grid {
  display: grid;
  grid-template-columns: minmax(320px, .9fr) minmax(0, 1.3fr);
  gap: 10px;
  align-items: stretch;
}

.spread-intel-detail-card h3 {
  margin: 6px 0 10px 0;
  color: #e6eef7;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.35;
}

.spread-intel-detail-section {
  margin-top: 10px;
}

.spread-intel-detail-section:first-of-type {
  margin-top: 0;
}

.spread-intel-detail-section-title {
  margin-bottom: 6px;
  color: #9fb5cc;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: normal;
  text-transform: uppercase;
}

.spread-intel-detail-section-description {
  margin: -2px 0 8px;
  color: #8aa0b8;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.35;
}

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

.spread-intel-detail-metric {
  background: #102a42;
  border: 1px solid #1d3a52;
  border-radius: 9px;
  padding: 8px;
  min-height: 50px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 5px;
}

.spread-intel-detail-metric span {
  color: #9fb5cc;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.spread-intel-detail-metric strong {
  color: #e6eef7;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.35;
}

.spread-intel-chart-card {
  min-height: 360px;
  display: flex;
  flex-direction: column;
}

.spread-intel-chart-box {
  position: relative;
  flex: 1;
  min-height: 300px;
  margin-top: 6px;
}

.spread-intel-chart-box canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.spread-intel-chart-empty::after {
  content: "Ratio history not available.";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #8fa4ba;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.35;
}

.spread-intel-empty {
  padding: 16px;
  color: #ffb347;
  background: rgba(255, 179, 71, .06);
  border: 1px solid rgba(255, 179, 71, .22);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.35;
}

.spread-intel-empty.subtle {
  margin-top: 10px;
  color: #8fa4ba;
  background: rgba(143, 164, 186, .05);
  border-color: rgba(143, 164, 186, .16);
}

.spread-intel-table.compact {
  font-size: 11px;
}

@media (max-width: 1180px) {
  .spread-intel-kpis {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .spread-intel-main-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .spread-intel-wrap {
    padding: 10px;
  }

  .spread-intel-header {
    flex-direction: column;
  }

  .spread-intel-detail-grid {
    grid-template-columns: 1fr;
  }

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

  .spread-intel-kpi,
  .spread-intel-kpi:last-child {
    padding-right: 0;
    border-right: 0;
  }

  .spread-intel-card-heading {
    align-items: flex-start;
  }

  .spread-intel-info-modal {
    max-height: 86vh;
    padding: 16px;
  }
}

@media (max-width: 420px) {
  .spread-intel-kpis {
    grid-template-columns: 1fr;
  }
}

/* Spread Intelligence Prova pre-release visibility controls */
#top-menu .menu-item[data-page="spread-intelligence-prova"] {
  flex: 0 0 48px;
  margin-left: 8px;
  color: #203040;
  opacity: 0.38;
  font-size: 6px;
  line-height: 0.9;
  letter-spacing: -0.03em;
  font-weight: 400;
}

#top-menu .menu-item[data-page="spread-intelligence-prova"] span:first-child,
#top-menu .menu-item[data-page="spread-intelligence-prova"] span:last-child {
  font-weight: 400;
  opacity: 0.55;
}

#top-menu .menu-item[data-page="spread-intelligence-prova"]:hover,
#top-menu .menu-item[data-page="spread-intelligence-prova"].active {
  color: #2b3b4b;
  opacity: 0.5;
  font-weight: 400;
}

#top-menu .menu-item[data-page="spread-intelligence-prova"].active::after {
  display: none;
}

.spread-intel-unavailable {
  min-height: clamp(220px, 36vh, 420px);
  display: grid;
  place-items: center;
  text-align: center;
  color: #ffa500;
  font-size: clamp(34px, 6vw, 76px);
  line-height: 0.95;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.spread-intel-gated-spacer {
  min-height: clamp(520px, 85vh, 900px);
}

/* ==================== Equities Intelligence Prova (hidden preview) ==================== */
#top-menu .menu-item[data-page="equities-intelligence-prova"] {
  flex: 0 0 48px;
  margin-left: 4px;
  color: #203040;
  opacity: 0.38;
  font-size: 6px;
  line-height: 0.9;
  letter-spacing: -0.03em;
  font-weight: 400;
}

#top-menu .menu-item[data-page="equities-intelligence-prova"] span:first-child,
#top-menu .menu-item[data-page="equities-intelligence-prova"] span:last-child {
  font-weight: 400;
  opacity: 0.55;
}

#top-menu .menu-item[data-page="equities-intelligence-prova"]:hover,
#top-menu .menu-item[data-page="equities-intelligence-prova"].active {
  color: #2b3b4b;
  opacity: 0.5;
  font-weight: 400;
}

#top-menu .menu-item[data-page="equities-intelligence-prova"].active::after {
  display: none;
}

.equities-intel-wrap {
  gap: 10px;
}


.equities-intel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 4px 0 8px;
}

.equities-intel-header h1 {
  margin: 0;
  color: #8fa4ba;
  font-size: clamp(18px, 2.2vw, 28px);
  line-height: 1.12;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.equities-intel-header p {
  margin: 6px 0 0;
  color: #9fb5cc;
  font-size: 12px;
  line-height: 1.4;
}

.equities-intel-preview-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 10px;
  border: 1px solid rgba(255, 165, 0, .34);
  border-radius: 999px;
  background: rgba(255, 165, 0, .08);
  color: #ffa500;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
}

.equities-intel-control-group {
  margin: 0;
}

.equities-intel-selector-title,
.equities-intel-block-title {
  color: #8fa4ba;
}

.equities-intel-tabs {
  display: flex;
  align-items: center;
  gap: 6px !important;
  flex-wrap: wrap;
  margin: 0 0 8px 0 !important;
}

.equities-intel-tab {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 26px !important;
  padding: 0 10px !important;
  border-radius: 999px !important;
  border: 1px solid #163247 !important;
  background: #0b1f33 !important;
  color: #d7e6f2 !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  letter-spacing: 0 !important;
  text-transform: none;
}

.equities-intel-tab:hover {
  background: #12304a !important;
  border-color: #214866 !important;
}

.equities-intel-tab.active {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: #000 !important;
}

.equities-intel-context-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  border: 1px solid #163247;
  border-radius: 999px;
  background: rgba(11, 31, 51, .72);
  padding: 5px 10px;
}

.equities-intel-context-line span {
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
}

.equities-intel-context-line strong {
  color: #ffa500;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
}

.equities-intel-card {
  margin-top: 2px;
}

.equities-intel-card-title {
  color: #9fb5cc;
}

.equities-intel-card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.equities-intel-info-btn {
  border: 1px solid #24465f;
  border-radius: 999px;
  background: #0b1f33;
  color: #9fb5cc;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  width: 22px;
  height: 22px;
}

.equities-intel-info-btn:hover {
  border-color: #ffa500;
  color: #ffa500;
}

.equities-intel-info-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0, 10, 20, .62);
}

.equities-intel-info-modal {
  position: relative;
  width: min(520px, 100%);
  border: 1px solid #24465f;
  border-radius: 14px;
  background: #071827;
  color: #e6eef7;
  padding: 18px 20px;
  box-shadow: 0 18px 46px rgba(0, 0, 0, .38);
}

.equities-intel-info-modal h3 {
  margin: 0 28px 12px 0;
  color: #ffa500;
  font-size: 16px;
}

.equities-intel-info-modal p {
  margin: 0 0 10px;
  color: #d7e6f2;
  font-size: 13px;
  line-height: 1.45;
}

.equities-intel-info-close {
  position: absolute;
  top: 10px;
  right: 10px;
  border: 0;
  background: transparent;
  color: #9fb5cc;
  cursor: pointer;
  font-size: 20px;
}

.equities-intel-value-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.equities-intel-value-block {
  min-height: 116px;
  margin-top: 0;
  border: 1px solid #1d3a52;
  border-radius: 10px;
  background: #102a42;
  padding: 10px;
}

.equities-intel-block-copy {
  margin: 0;
  color: #ffffff;
  font-size: 12px;
  line-height: 1.45;
}

.equities-intel-coming-soon {
  min-height: clamp(160px, 28vh, 280px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  text-align: center;
}

.equities-intel-coming-soon p {
  margin: 0;
  color: #ffffff;
  font-size: clamp(24px, 4vw, 46px);
  line-height: 1;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

@media (max-width: 980px) {
  .equities-intel-value-grid {
    grid-template-columns: 1fr;
  }
}

.equities-intel-operational-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}


.equities-intel-ranking-card,
.equities-intel-price-chart-card {
  width: 100%;
}

.equities-intel-detail-card {
  min-height: 390px;
}

.equities-intel-table {
  font-size: 12px;
  line-height: normal;
}

.equities-intel-table th,
.equities-intel-table td {
  vertical-align: top;
  border-bottom: 1px solid #163247;
  padding: 6px;
  text-align: left;
}

.equities-intel-table th {
  color: #e6eef7;
  font-size: 12px;
  font-weight: 700;
  line-height: normal;
}

.equities-intel-sort-header {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  font: inherit;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.equities-intel-sort-icon {
  color: #8fa4ba;
  font-size: 12px;
  line-height: 1;
}

.equities-intel-sort-header.is-asc .equities-intel-sort-icon,
.equities-intel-sort-header.is-desc .equities-intel-sort-icon {
  color: #ffa500;
}

.equities-intel-table td,
.equities-intel-table small,
.equities-intel-company-name,
.equities-intel-score,
.equities-intel-interpretation {
  color: #e6eef7;
  font-size: 12px;
  font-weight: 400;
  line-height: normal;
}

.equities-intel-table small {
  display: block;
  margin-top: 2px;
  color: #8fa4ba;
  font-size: 11px;
}

.equities-intel-table .equities-intel-interpretation {
  color: #ffffff !important;
}

.equities-intel-score-with-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
}

.equities-intel-score-with-bar .equities-intel-score {
  min-width: 26px;
}

.equities-intel-score-bar {
  display: inline-block;
  width: 82px;
  height: 6px;
  border-radius: 999px;
  background: rgba(143, 164, 186, .12);
  overflow: hidden;
}

.equities-intel-score-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--score-bar-start, #2fbf58), var(--score-bar-end, #a8ff3e));
  opacity: .86;
}

.equities-intel-score-with-bar .equities-intel-score {
  color: #ffffff !important;
}

.equities-intel-bar-value .equities-intel-score-bar span {
  background: linear-gradient(90deg, rgba(255, 165, 0, 0), rgba(255, 165, 0, .98));
}

.equities-intel-bar-quantitative .equities-intel-score-bar span {
  background: linear-gradient(90deg, rgba(46, 232, 111, 0), rgba(46, 232, 111, .98));
}

.equities-intel-bar-fundamental .equities-intel-score-bar span,
.equities-intel-bar-momentum .equities-intel-score-bar span {
  background: linear-gradient(90deg, rgba(242, 160, 0, .16), rgba(46, 232, 111, .92));
}

.equities-intel-price-percentile {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
  color: #fff;
  font-weight: 700;
}

.equities-intel-price-percentile-value {
  min-width: 42px;
  color: #fff;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.equities-intel-price-percentile-bar {
  position: relative;
  display: inline-block;
  width: 82px;
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255,255,255,0.10);
}

.equities-intel-price-percentile-bar span {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--price-percentile-width, 0%);
  border-radius: inherit;
  background: rgba(220, 24, 24, var(--price-percentile-alpha, 0.45));
}



.equities-intel-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 10px;
}

.equities-intel-detail-head h2 {
  margin: 7px 0 2px;
  color: #ffffff;
  font-size: 16px;
  line-height: 1.2;
  font-weight: 800;
}

.equities-intel-detail-head p {
  margin: 0;
  color: #9fb5cc;
  font-size: 11px;
  line-height: 1.35;
}

.equities-intel-company-selector {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: min(280px, 46%);
}

.equities-intel-company-selector span {
  color: #9fb5cc;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.equities-intel-company-selector select {
  width: 100%;
  min-height: 30px;
  border: 1px solid #1d3a52;
  border-radius: 8px;
  background: #102a42;
  color: #e6eef7;
  padding: 0 8px;
  font: inherit;
  font-size: 11px;
}

.equities-intel-detail-groups {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.equities-intel-detail-group {
  padding-top: 8px;
  border-top: 1px solid rgba(255, 165, 0, 0.14);
}

.equities-intel-detail-group:first-child {
  padding-top: 0;
  border-top: 0;
}

.equities-intel-detail-group-title {
  margin: 0 0 6px;
  color: #f5d7a1;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.25;
  text-transform: uppercase;
}

.equities-intel-detail-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.equities-intel-detail-metric span {
  color: #9fb5cc;
}

.equities-intel-empty {
  min-height: clamp(180px, 30vh, 320px);
  display: grid;
  place-items: center;
  text-align: center;
}

.equities-intel-empty p {
  margin: 0;
  color: #ffffff;
  font-size: clamp(18px, 3vw, 30px);
  line-height: 1.15;
  font-weight: 800;
}

@media (max-width: 1180px) {
  .equities-intel-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .equities-intel-detail-head {
    flex-direction: column;
  }

  .equities-intel-company-selector {
    min-width: 100%;
  }

  .equities-intel-detail-grid {
    grid-template-columns: 1fr;
  }
}

.equities-intel-price-chart-card {
  min-height: 390px;
  display: flex;
  flex-direction: column;
  border-color: rgba(45, 91, 128, .86);
  background: linear-gradient(180deg, rgba(0, 25, 42, .98) 0%, #001122 100%);
  box-shadow: 0 16px 42px rgba(0, 0, 0, .28);
}

.equities-intel-etf-identity-bar {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 0 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #dce9f5;
  line-height: 1.25;
}

.equities-intel-etf-identity-bar strong {
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

.equities-intel-etf-identity-bar span {
  color: rgba(220, 233, 245, .78);
  font-size: 11px;
}

.equities-intel-chart-subtitle {
  margin: 8px 0 10px;
  color: #dce9f5;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 700;
  letter-spacing: .01em;
}

.equities-intel-chart-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.equities-intel-chart-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(45, 91, 128, .95);
  border-radius: 999px;
  background: rgba(16, 42, 66, .72);
  color: #b9cde0;
  padding: 6px 10px;
  font-size: 11px;
  line-height: 1.2;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
}

.equities-intel-chart-meta strong {
  color: #ffa500;
  font-size: 12px;
  letter-spacing: .01em;
}

.equities-intel-chart-box {
  flex: 1;
  min-height: 272px;
  border: 1px solid rgba(45, 91, 128, .92);
  border-radius: 14px;
  background: #001122;
  overflow: hidden;
  padding: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 165, 0, .04);
}

.equities-intel-tv-chart,
.equities-intel-tv-chart .tradingview-widget-container__widget {
  width: 100%;
  height: 100%;
  min-height: 272px;
}

.equities-intel-chart-box svg {
  width: 100%;
  height: 100%;
  min-height: 252px;
  display: block;
  overflow: visible;
}

.equities-intel-chart-bg {
  fill: url(#equitiesIntelChartBg);
}

.equities-intel-chart-grid {
  stroke: rgba(143, 164, 186, .12);
  stroke-width: 1;
  stroke-dasharray: 4 8;
}

.equities-intel-chart-area {
  fill: url(#equitiesIntelAreaGradient);
}

.equities-intel-chart-line {
  fill: none;
  stroke: #ffa500;
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: url(#equitiesIntelLineGlow);
}

.equities-intel-chart-label {
  fill: #a9bfd3;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .02em;
}

.equities-intel-chart-x-label {
  fill: #7890a7;
  font-size: 9.5px;
}

.equities-intel-chart-empty {
  flex: 1;
  min-height: 272px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(45, 91, 128, .92);
  border-radius: 14px;
  background: #001122;
  color: #dce9f5;
  text-align: center;
  padding: 18px;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 800;
}

.equities-intel-score,
.equities-intel-interpretation {
  font-size: 12px;
  font-weight: 400;
  line-height: normal;
}

.equities-intel-tone-exceptional {
  color: #21d07a !important;
}

.equities-intel-tone-strong {
  color: #45d483 !important;
}

.equities-intel-tone-neutral {
  color: #ffffff !important;
}

.equities-intel-tone-weak {
  color: #ff6b6b !important;
}

.equities-intel-tone-limited {
  color: #ffd166 !important;
}

.equities-intel-tone-muted {
  color: #8fa4ba !important;
}

.equities-intel-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 2px;
  padding: 8px 10px;
  border: 1px solid #163247;
  border-radius: 12px;
  background: #071827;
}

.equities-intel-toolbar-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
}

.equities-intel-toolbar-field span {
  color: #8fa4ba;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.equities-intel-toolbar-select {
  height: 30px;
  min-width: 138px;
  border: 1px solid #24465f;
  border-radius: 8px;
  background: #0b1f33;
  color: #d7e6f2;
  padding: 0 28px 0 10px;
  font-size: 12px;
  font-weight: 700;
  outline: none;
}

.equities-intel-toolbar-select:focus {
  border-color: #ffa500;
}

.portfolio-analysis-secondary-grid {
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
}

.portfolio-analysis-exposure-card,
.portfolio-analysis-live-card {
  display: flex;
  flex-direction: column;
  padding: 12px;
}

.portfolio-analysis-exposure {
  display: grid;
  gap: 10px;
}

.portfolio-analysis-exposure-block {
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  background: #0b1f33;
  padding: 10px;
}

.portfolio-analysis-exposure-title {
  margin-bottom: 8px;
  color: rgba(255,255,255,0.92);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  text-transform: uppercase;
}

.portfolio-analysis-mini-table {
  width: 100%;
  border-collapse: collapse;
}

.portfolio-analysis-mini-table td {
  padding: 6px 0;
  border-top: 1px solid rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.86);
  font-size: 0.82rem;
}

.portfolio-analysis-mini-table td.num {
  text-align: right;
  color: #ffffff;
  font-weight: 700;
}

.portfolio-analysis-live-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.portfolio-analysis-date-field {
  display: grid;
  gap: 5px;
  min-width: 190px;
}

.portfolio-analysis-date-field span {
  color: rgba(255,255,255,0.72);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
}

.portfolio-analysis-live-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.portfolio-analysis-live-kpis > div {
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  background: #0b1f33;
  padding: 6px 8px;
}

.portfolio-analysis-live-kpis span {
  display: block;
  margin-bottom: 5px;
  color: rgba(255,255,255,0.72);
  font-size: 0.72rem;
  line-height: 1.1;
  text-transform: uppercase;
}

.portfolio-analysis-live-kpis strong {
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1;
}

.portfolio-analysis-live-chart-wrap {
  min-height: 18rem;
  flex: 0 0 18rem;
}

.portfolio-analysis-live-table-wrap {
  max-height: 18rem;
  overflow: auto;
  margin-top: 8px;
}

.portfolio-analysis-live-table {
  margin-top: 0;
}

@media (max-width: 980px) {
  .portfolio-analysis-secondary-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .portfolio-analysis-live-kpis {
    grid-template-columns: 1fr;
  }
}

.portfolio-analysis-table-caption {
  caption-side: top;
  padding: 0 0 8px;
  color: rgba(255,255,255,0.92);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  text-align: left;
  text-transform: uppercase;
}

.portfolio-analysis-alpha-month-kpi {
  display: grid;
  gap: 5px;
}

.portfolio-analysis-alpha-month-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  color: rgba(255,255,255,0.72);
  font-size: 0.72rem;
  line-height: 1.1;
}

.portfolio-analysis-alpha-month-row strong {
  margin-left: 4px;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 600;
}

.portfolio-analysis-live-table {
  table-layout: fixed;
}

.portfolio-analysis-live-table th:nth-child(1),
.portfolio-analysis-live-table td:nth-child(1) {
  width: 16%;
  text-align: left;
}

.portfolio-analysis-live-table th:nth-child(2),
.portfolio-analysis-live-table td:nth-child(2) {
  width: 22%;
  text-align: right;
}

.portfolio-analysis-live-table th:nth-child(3),
.portfolio-analysis-live-table td:nth-child(3) {
  width: 22%;
  text-align: right;
}

.portfolio-analysis-live-table th:nth-child(4),
.portfolio-analysis-live-table td:nth-child(4) {
  width: 18%;
  text-align: right;
}

.portfolio-analysis-live-table th:nth-child(5),
.portfolio-analysis-live-table td:nth-child(5) {
  width: 22%;
  text-align: left;
}
.bti-cot-chart-wrap {
  position: relative;
}

.bti-cot-toolbar {
  position: absolute;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 5;
  opacity: 0.78;
}

.bti-cot-toolbar button {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(40,40,40,0.78);
  color: #ffffff;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}

.bti-cot-toolbar button:hover {
  border-color: #ffa500;
  color: #ffa500;
  background: rgba(40,40,40,0.95);
}
.cot-chart.bti-cot-chart-wrap {
  position: relative;
  overflow: visible;
}

.cot-chart.bti-cot-chart-wrap canvas {
  position: relative;
  z-index: 1;
}

.cot-chart.bti-cot-chart-wrap .bti-cot-toolbar {
  z-index: 20;
}

.bti-cot-range-bar {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 8px;
  height: 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0, 10, 22, 0.86);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.55), 0 4px 12px rgba(0,0,0,0.22);
  z-index: 21;
  touch-action: none;
}

.bti-cot-range-bar[hidden] {
  display: none;
}

.bti-cot-range-window {
  position: absolute;
  top: 2px;
  bottom: 2px;
  min-width: 28px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 159, 64, 0.72), rgba(255, 184, 92, 0.92));
  box-shadow: 0 0 10px rgba(255, 159, 64, 0.26);
  cursor: grab;
}

.bti-cot-range-window:active {
  cursor: grabbing;
}

.bti-cot-range-handle {
  position: absolute;
  top: 50%;
  width: 10px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 213, 153, 0.95);
  background: linear-gradient(180deg, #fff2d9, #ff9f40);
  box-shadow: 0 2px 8px rgba(0,0,0,0.38);
  transform: translateY(-50%);
  cursor: ew-resize;
}

.bti-cot-range-handle-left {
  left: -5px;
}

.bti-cot-range-handle-right {
  right: -5px;
}

.bti-cot-range-grip {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255,255,255,0.62);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* ==================== Dashboard 2x2 containment guard ==================== */
#block1,
#block2,
#block3,
#block4 {
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* ==================== BTi i18n language switch ==================== */
#bti-language-switch {
  position: sticky;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 0 0 auto;
  padding: 0 8px;
  background: var(--app-bg);
  color: rgba(255,255,255,0.58);
  font-size: 10px;
  font-weight: 700;
  z-index: 2;
}

#bti-language-switch button {
  border: 0;
  background: transparent;
  color: rgba(255,255,255,0.58);
  cursor: pointer;
  font: inherit;
  padding: 2px;
}

#bti-language-switch button.active,
#bti-language-switch button:hover {
  color: #ffa500;
}

/* ETF Intelligence table scrollbars */
#etf-intelligence-template .equities-intel-table-wrap {
  scrollbar-width: thin;
  scrollbar-color: #2f4d63 rgba(0, 17, 34, 0.88);
}

#etf-intelligence-template .equities-intel-table-wrap::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

#etf-intelligence-template .equities-intel-table-wrap::-webkit-scrollbar-track {
  background: rgba(0, 17, 34, 0.88);
  border-radius: 999px;
}

#etf-intelligence-template .equities-intel-table-wrap::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg, #243d52, #35566f);
  border: 2px solid rgba(0, 17, 34, 0.88);
  border-radius: 999px;
}

#etf-intelligence-template .equities-intel-table-wrap::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(90deg, #35566f, #456f8d);
}

.equities-intel-map-chart-shell {
  position: relative;
  display: flex;
  flex: 1;
  min-height: 360px;
}

.equities-intel-map-chart-box {
  min-height: 360px;
  width: 100%;
  background:
    radial-gradient(circle at 18% 0%, rgba(56, 189, 248, .10), transparent 32%),
    radial-gradient(circle at 85% 10%, rgba(245, 158, 11, .08), transparent 30%),
    linear-gradient(180deg, rgba(2, 18, 34, .98), rgba(0, 12, 24, 1));
}

.equities-intel-map-chart-legend {
  position: absolute;
  z-index: 2;
  top: 12px;
  left: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  border: 1px solid rgba(148, 163, 184, .18);
  border-radius: 999px;
  background: rgba(1, 17, 34, .70);
  backdrop-filter: blur(10px);
  padding: 6px 9px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .24);
}

.equities-intel-map-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #dbeafe;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.equities-intel-map-chart-legend i {
  width: 16px;
  height: 3px;
  border-radius: 999px;
  box-shadow: 0 0 10px currentColor;
}

.equities-intel-map-chart-toolbar {
  bottom: 14px;
  opacity: .86;
}

#etf-intelligence-template .equities-intel-ranking-card {
  min-height: 0;
}

#etf-intelligence-template .equities-intel-ranking-card .equities-intel-table-wrap {
  max-height: 360px;
  overflow-y: auto;
}

/* Equities / ETF approved mockup layout: dominant chart + thin expandable banner */
#grid-content.equity-dashboard-layout {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: 48px minmax(0, 1fr) 50px;
  gap: 8px;
}


#grid-content.equity-dashboard-layout[data-equity-dashboard-asset="etf"] {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#grid-content.equity-dashboard-layout[data-equity-dashboard-asset="etf"] #block3 {
  grid-column: 1 / 3;
}

#grid-content.equity-dashboard-layout[data-equity-dashboard-asset="etf"] #block4 {
  grid-column: 3 / 4;
}

#grid-content.equity-dashboard-layout[data-equity-dashboard-asset="etf"] #block1 {
  display: flex;
  flex-direction: column;
}

#grid-content.equity-dashboard-layout[data-equity-dashboard-asset="etf"] #block2 .sim-toolbar {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto;
  align-items: center;
}

#grid-content.equity-dashboard-layout[data-equity-dashboard-asset="etf"] #block2 .bench-picker {
  margin-left: 0;
}

#grid-content.equity-dashboard-layout[data-equity-dashboard-asset="etf"] .cis-etf-toolbar-identity {
  justify-self: center;
  max-width: min(520px, 100%);
  margin: 0;
  padding: 0;
  text-align: center;
}

#grid-content.equity-dashboard-layout[data-equity-dashboard-asset="etf"] .equity-analysis-banner {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#grid-content.equity-dashboard-layout #block2 {
  grid-column: 1 / -1;
  grid-row: 1 / 3;
  z-index: 3;
  display: flex;
  flex-direction: column;
  padding: 0;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  pointer-events: none;
}

#grid-content.equity-dashboard-layout #block2 .sim-toolbar {
  min-height: 48px;
  padding: 0 2px 6px;
  pointer-events: auto;
}

#grid-content.equity-dashboard-layout:is(
  [data-equity-dashboard-asset="equity"],
  [data-equity-dashboard-asset="etf"]
) #block2 .sim-toolbar > .sim-tabs {
  gap: 8px;
  flex-wrap: nowrap;
}

#grid-content.equity-dashboard-layout:is(
  [data-equity-dashboard-asset="equity"],
  [data-equity-dashboard-asset="etf"]
) #block2 .sim-toolbar > .sim-tabs > .tab-btn {
  min-height: 34px;
  padding: 0 2px 8px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: rgba(255,255,255,0.72);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.025em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: none;
  transition: border-color .16s ease, color .16s ease;
}

#grid-content.equity-dashboard-layout:is(
  [data-equity-dashboard-asset="equity"],
  [data-equity-dashboard-asset="etf"]
) #block2 .sim-toolbar > .sim-tabs > .tab-btn:hover {
  border-color: transparent;
  border-bottom-color: rgba(255,165,0,0.45);
  background: transparent;
  color: rgba(255,255,255,0.94);
}

#grid-content.equity-dashboard-layout:is(
  [data-equity-dashboard-asset="equity"],
  [data-equity-dashboard-asset="etf"]
) #block2 .sim-toolbar > .sim-tabs > .tab-btn.active {
  border-color: transparent;
  border-bottom-color: var(--accent);
  background: transparent;
  color: var(--accent);
}

#grid-content.equity-dashboard-layout #block2 .sim-body {
  pointer-events: auto;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-soft);
  padding: 8px;
}

#grid-content.equity-dashboard-layout #block2.equity-content-hidden .sim-body {
  visibility: hidden;
  pointer-events: none;
}

#grid-content.equity-dashboard-layout #block1 {
  grid-column: 1 / -1;
  grid-row: 2 / 3;
  z-index: 1;
}

#grid-content.equity-dashboard-layout #block1.equity-main-hidden {
  visibility: hidden;
  pointer-events: none;
}

#grid-content.equity-dashboard-layout #block3 {
  grid-column: 1 / 4;
  grid-row: 3 / 4;
  align-self: stretch;
  height: 100%;
  min-height: 0;
  overflow: visible;
  background: transparent;
  border: 0;
  box-shadow: none;
}

#grid-content.equity-dashboard-layout #block4 {
  grid-column: 4 / 5;
  grid-row: 3 / 4;
  align-self: stretch;
  height: 100%;
  min-height: 0;
  padding: 0;
  box-sizing: border-box;
  background: #001122;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
}

#grid-content.equity-dashboard-layout .equity-single-index-tab {
  display: none;
}

#grid-content.equity-dashboard-layout .equity-analysis-banner {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  height: 100%;
}

#grid-content.equity-dashboard-layout .equity-analysis-card {
  min-height: 0;
  background: #001122;
  border: 1px solid transparent;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
  position: relative;
  pointer-events: auto;
  height: 100%;
}

#grid-content.equity-dashboard-layout .equity-analysis-card.bullish,
#grid-content.equity-dashboard-layout .equity-analysis-card.bearish,
#grid-content.equity-dashboard-layout .equity-analysis-card.neutral {
  border-color: transparent;
}

#grid-content.equity-dashboard-layout .equity-analysis-summary {
  width: 100%;
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-main);
  background: #001122;
  border: 0;
  cursor: pointer;
  text-align: left;
  pointer-events: auto;
}

#grid-content.equity-dashboard-layout .equity-analysis-summary strong,
#grid-content.equity-dashboard-layout .equity-analysis-summary em {
  display: block;
  line-height: 1.05;
  font-style: normal;
}

#grid-content.equity-dashboard-layout .equity-analysis-summary strong {
  font-size: 13px;
  font-weight: 800;
}

#grid-content.equity-dashboard-layout .equity-analysis-summary em {
  margin-top: 2px;
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

#grid-content.equity-dashboard-layout .bullish .equity-analysis-summary em { color: #00c8a0; }
#grid-content.equity-dashboard-layout .bearish .equity-analysis-summary em { color: #ff6262; }
#grid-content.equity-dashboard-layout .neutral .equity-analysis-summary em { color: #ffb84d; }

#grid-content.equity-dashboard-layout .equity-analysis-plus {
  width: 20px;
  height: 20px;
  border: 1px solid currentColor;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
}

#grid-content.equity-dashboard-layout .equity-analysis-card.expanded {
  position: relative;
  z-index: 8;
}

#grid-content.equity-dashboard-layout .equity-analysis-card.expanded .equity-analysis-plus {
  transform: none;
}

#grid-content.equity-dashboard-layout .equity-analysis-detail {
  position: absolute;
  top: auto;
  bottom: calc(100% + 6px);
  left: -1px;
  right: -1px;
  z-index: 30;
  max-height: min(46vh, 480px);
  overflow: auto;
  padding: 10px;
  background: #001122;
  border: 1px solid rgba(255,255,255,0.22);
  box-shadow: 0 16px 34px rgba(0,0,0,0.36);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,165,0,0.65) rgba(0,17,34,0.35);
}

#grid-content.equity-dashboard-layout .equity-analysis-detail::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

#grid-content.equity-dashboard-layout .equity-analysis-detail::-webkit-scrollbar-track {
  background: rgba(0,17,34,0.35);
  border-radius: 999px;
}

#grid-content.equity-dashboard-layout .equity-analysis-detail::-webkit-scrollbar-thumb {
  background: rgba(255,165,0,0.65);
  border-radius: 999px;
  border: 2px solid rgba(0,17,34,0.35);
}

#grid-content.equity-dashboard-layout .equity-analysis-detail::-webkit-scrollbar-thumb:hover {
  background: rgba(255,184,77,0.85);
}

#grid-content.equity-dashboard-layout .equity-analysis-card.bullish .equity-analysis-detail {
  border-color: rgba(0, 200, 160, 0.45);
}

#grid-content.equity-dashboard-layout .equity-analysis-card.bearish .equity-analysis-detail {
  border-color: rgba(255, 80, 80, 0.50);
}

#grid-content.equity-dashboard-layout .equity-analysis-card.neutral .equity-analysis-detail {
  border-color: rgba(255, 180, 70, 0.50);
}

#grid-content.equity-dashboard-layout .equity-shortterm-sheet {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  color: var(--text-main);
  font-size: 12px;
}

#grid-content.equity-dashboard-layout .equity-detail-sheet,
#grid-content.equity-dashboard-layout .equity-ai-sheet {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  color: var(--text-main);
  font-size: 12px;
}

#grid-content.equity-dashboard-layout .equity-detail-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

#grid-content.equity-dashboard-layout .equity-detail-title {
  margin: 0 0 4px;
  padding: 0 0 5px;
  border-bottom: 1px solid rgba(255,255,255,0.14);
  color: #e6edf3;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .055em;
  text-transform: uppercase;
}

#grid-content.equity-dashboard-layout .equity-ai-sheet .sim-tabs {
  display: none;
}

#grid-content.equity-dashboard-layout .equity-ai-sheet .ai-assistant,
#grid-content.equity-dashboard-layout .equity-ai-sheet .ai-panel,
#grid-content.equity-dashboard-layout .equity-ai-sheet .rm-section {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

#grid-content.equity-dashboard-layout .equity-ai-sheet .ai-scroll {
  max-height: none;
  overflow: visible;
}

#grid-content.equity-dashboard-layout .equity-ai-sheet .ai-composer {
  display: block;
  margin-top: 10px;
  pointer-events: auto;
}

#grid-content.equity-dashboard-layout .equity-ai-sheet .ai-input {
  pointer-events: auto;
  user-select: text;
}

#grid-content.equity-dashboard-layout .equity-analysis-detail #eq-fund-host,
#grid-content.equity-dashboard-layout .equity-analysis-detail #eq-fund-host .fund-card,
#grid-content.equity-dashboard-layout .equity-analysis-detail #eq-fund-host .sim-body,
#grid-content.equity-dashboard-layout .equity-analysis-detail #eq-fund-host .sim-pane {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

#grid-content.equity-dashboard-layout .equity-analysis-detail #eq-fund-host .fund-tabs {
  display: flex;
  gap: 6px;
  margin: 0 0 10px;
}

#grid-content.equity-dashboard-layout .equity-analysis-detail #eq-fund-host .fund-row {
  min-height: 28px;
  padding: 5px 2px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: transparent;
}

#grid-content.equity-dashboard-layout .equity-shortterm-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: center;
  gap: 12px;
  min-height: 28px;
  padding: 5px 2px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

#grid-content.equity-dashboard-layout .equity-shortterm-row:last-child {
  border-bottom: 0;
}

#grid-content.equity-dashboard-layout .equity-shortterm-row span {
  min-width: 0;
  color: rgba(230,237,243,0.78);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#grid-content.equity-dashboard-layout .equity-shortterm-row strong {
  color: #e6edf3;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* CAPM dashboard help and inline chart callout */
.capm-chart-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  height: 100%;
}

.capm-info-btn {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 4;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid rgba(255, 166, 35, 0.72);
  background: rgba(4, 15, 28, 0.86);
  color: #ffb347;
  font: 700 13px/1 Inter, system-ui, -apple-system, Segoe UI, sans-serif;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
}

.capm-info-btn:hover,
.capm-info-btn:focus-visible {
  border-color: rgba(255, 190, 92, 0.95);
  color: #ffd08a;
  outline: none;
}

.capm-info-modal.hidden {
  display: none;
}

.capm-info-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 22px;
}

.capm-info-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 6, 14, 0.72);
  backdrop-filter: blur(4px);
}

.capm-info-panel {
  position: relative;
  width: min(620px, 100%);
  max-height: min(82vh, 760px);
  overflow: auto;
  border: 1px solid rgba(255, 166, 35, 0.52);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(8, 24, 42, 0.98), rgba(3, 12, 23, 0.98));
  color: rgba(255, 255, 255, 0.9);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.48);
  padding: 24px 26px 22px;
}

.capm-info-panel h3 {
  margin: 0 34px 14px 0;
  color: #ffb347;
  font-size: 18px;
  letter-spacing: 0.01em;
}

.capm-info-panel p,
.capm-info-panel li {
  font-size: 13px;
  line-height: 1.55;
}

.capm-info-panel p {
  margin: 0 0 11px;
}

.capm-info-panel .capm-formula {
  color: #ffd08a;
  font-weight: 700;
}

.capm-info-panel h4 {
  margin: 16px 0 8px;
  color: #ffffff;
  font-size: 13px;
}

.capm-info-panel ul {
  margin: 0;
  padding-left: 18px;
}

.capm-info-panel li + li {
  margin-top: 7px;
}

.capm-info-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.86);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

/* Commodities futures: reuse equity/ETF banner style with a dominant chart and three modules */
#grid-content.equity-dashboard-layout[data-equity-dashboard-asset="commodity"] {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: minmax(0, 1fr) 50px;
  gap: 8px;
}

#grid-content.equity-dashboard-layout[data-equity-dashboard-asset="commodity"] #block1 {
  grid-column: 1 / -1;
  grid-row: 1 / 2;
}

#grid-content.equity-dashboard-layout[data-equity-dashboard-asset="commodity"] #block2 {
  display: none;
}

#grid-content.equity-dashboard-layout[data-equity-dashboard-asset="commodity"] #block3 {
  grid-column: 1 / 3;
  grid-row: 2 / 3;
}

#grid-content.equity-dashboard-layout[data-equity-dashboard-asset="commodity"] #block4 {
  grid-column: 3 / 4;
  grid-row: 2 / 3;
}

#grid-content.equity-dashboard-layout[data-equity-dashboard-asset="commodity"] .commodity-analysis-banner {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#grid-content.equity-dashboard-layout[data-equity-dashboard-asset="commodity"] .commodity-analysis-detail {
  max-height: min(72vh, 720px);
  min-width: min(760px, calc(100vw - 48px));
}

#grid-content.equity-dashboard-layout[data-equity-dashboard-asset="commodity"] #block4 .commodity-analysis-detail {
  right: 0;
  left: auto;
}

#grid-content.equity-dashboard-layout[data-equity-dashboard-asset="commodity"] .commodity-expanded-chart {
  height: 420px;
  min-height: 320px;
  margin-bottom: 12px;
}

#grid-content.equity-dashboard-layout[data-equity-dashboard-asset="commodity"] .commodity-interpretation-bti p {
  margin: 8px 0 0;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Commodities popup toggles: dedicated BTi button styling */
#grid-content.equity-dashboard-layout[data-equity-dashboard-asset="commodity"] .commodity-analysis-detail .cot-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

#grid-content.equity-dashboard-layout[data-equity-dashboard-asset="commodity"] .commodity-analysis-detail .cot-btn {
  padding: 5px 10px;
  border: 1px solid rgba(255, 165, 0, 0.78);
  border-radius: 999px;
  background: #001122;
  color: #ffffff;
  font-weight: 700;
  font-size: 12px;
  line-height: 1.15;
  cursor: pointer;
  transition: background-color .16s ease, color .16s ease, border-color .16s ease, transform .16s ease;
}

#grid-content.equity-dashboard-layout[data-equity-dashboard-asset="commodity"] .commodity-analysis-detail .cot-btn:hover {
  background: rgba(255, 165, 0, 0.16);
  border-color: #ffb84d;
}

#grid-content.equity-dashboard-layout[data-equity-dashboard-asset="commodity"] .commodity-analysis-detail .cot-btn.active-tab {
  background: #ffa500;
  border-color: #ffa500;
  color: #001122;
}

/* BTi Sensitivity Factors */
#block2 .bench-picker.hidden {
  display: none;
}

.sensitivity-pane {
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

#block2 .sim-pane.sensitivity-pane {
  overflow-x: hidden;
  overflow-y: auto;
}

.sensitivity-card {
  width: 100%;
  min-height: 100%;
  padding: 18px 20px;
  color: #e6edf3;
  background: linear-gradient(180deg, rgba(4, 20, 36, 0.98), rgba(1, 13, 25, 0.98));
}

.sensitivity-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.11);
}

.sensitivity-heading h3 {
  margin: 0 0 5px;
  color: #ffb347;
  font-size: 16px;
}

.sensitivity-heading p,
.sensitivity-method {
  margin: 0;
  color: rgba(230, 237, 243, 0.68);
  font-size: 11px;
  line-height: 1.45;
}

.sensitivity-stability {
  display: inline-flex;
  align-items: center;
  margin-top: 8px;
  padding: 3px 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  color: rgba(230, 237, 243, 0.82);
  background: rgba(255, 255, 255, 0.045);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.sensitivity-stability.high {
  border-color: rgba(85, 214, 170, 0.48);
  color: #55d6aa;
  background: rgba(85, 214, 170, 0.08);
}

.sensitivity-stability.medium {
  border-color: rgba(255, 179, 71, 0.52);
  color: #ffb347;
  background: rgba(255, 179, 71, 0.08);
}

.sensitivity-stability.low {
  border-color: rgba(255, 133, 133, 0.46);
  color: #ff8585;
  background: rgba(255, 133, 133, 0.07);
}

.sensitivity-info,
.sensitivity-overlay-close {
  flex: 0 0 auto;
  width: 25px;
  height: 25px;
  border: 1px solid rgba(255, 179, 71, 0.65);
  border-radius: 50%;
  background: rgba(255, 179, 71, 0.08);
  color: #ffb347;
  cursor: pointer;
  font-weight: 800;
}

.sensitivity-method {
  margin-top: 10px;
  padding: 9px 11px;
  border-left: 2px solid rgba(255, 179, 71, 0.7);
  background: rgba(255, 255, 255, 0.035);
}

.sensitivity-bars {
  display: grid;
  gap: 13px;
  margin-top: 20px;
}

.sensitivity-row {
  display: grid;
  grid-template-columns: minmax(330px, 500px) minmax(180px, 1fr) 62px;
  align-items: center;
  gap: 18px;
  padding: 7px 0;
}

.sensitivity-label {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.sensitivity-label span {
  display: block;
  overflow: hidden;
  color: rgba(230, 237, 243, 0.88);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sensitivity-label small {
  display: block;
  margin-top: 2px;
  color: rgba(230, 237, 243, 0.48);
  font-size: 9px;
  text-transform: uppercase;
}

.sensitivity-track {
  height: 13px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.sensitivity-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #df8617, #ffb347);
}

.sensitivity-row.specific .sensitivity-track span {
  background: linear-gradient(90deg, #46637d, #7794ad);
}

.sensitivity-row.other .sensitivity-track span {
  background: linear-gradient(90deg, #89652e, #bb8c42);
}

.sensitivity-row strong {
  color: #fff;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.sensitivity-empty {
  display: grid;
  min-height: 220px;
  place-items: center;
  padding: 28px;
  color: rgba(230, 237, 243, 0.7);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

#block1 {
  position: relative;
}

.sensitivity-shortcut {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 12;
  padding: 7px 11px;
  border: 1px solid rgba(255, 179, 71, 0.72);
  border-radius: 6px;
  background: rgba(0, 17, 34, 0.9);
  color: #ffb347;
  cursor: pointer;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.045em;
}

.sensitivity-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  overflow: hidden;
  background: #001122;
}

.sensitivity-overlay.hidden {
  display: none;
}

.sensitivity-overlay-body {
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sensitivity-pane,
.sensitivity-overlay-body {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 179, 71, 0.72) rgba(255, 255, 255, 0.06);
}

.sensitivity-pane::-webkit-scrollbar,
.sensitivity-overlay-body::-webkit-scrollbar {
  width: 8px;
}

.sensitivity-pane::-webkit-scrollbar-track,
.sensitivity-overlay-body::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
}

.sensitivity-pane::-webkit-scrollbar-thumb,
.sensitivity-overlay-body::-webkit-scrollbar-thumb {
  border: 2px solid #001122;
  border-radius: 999px;
  background: rgba(255, 179, 71, 0.72);
}

.sensitivity-pane::-webkit-scrollbar-thumb:hover,
.sensitivity-overlay-body::-webkit-scrollbar-thumb:hover {
  background: #ffb347;
}

.sensitivity-overlay-close {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 2;
  font-size: 18px;
  line-height: 1;
}

@media (max-width: 760px) {
  .sensitivity-row {
    grid-template-columns: minmax(0, 1fr) 48px;
    grid-template-areas:
      "label label"
      "track value";
    gap: 8px;
  }
  .sensitivity-label { grid-area: label; }
  .sensitivity-track { grid-area: track; }
  .sensitivity-row > strong { grid-area: value; }
}


.sensitivity-direction-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 16px;
  margin-top: 11px;
  color: rgba(230, 237, 243, 0.68);
  font-size: 10px;
  line-height: 1.4;
}
.sensitivity-direction-legend span { display: inline-flex; align-items: center; gap: 5px; }
.sensitivity-direction-legend b,
.sensitivity-direction b { font-size: 13px; line-height: 1; }
.sensitivity-direction-legend .direct,
.sensitivity-direction.direct { color: #55d6aa; }
.sensitivity-direction-legend .inverse,
.sensitivity-direction.inverse { color: #ff8585; }
.sensitivity-label-title {
  display: block;
  overflow: visible;
  color: #f1f5f9;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  white-space: normal;
}
.sensitivity-label-description {
  display: block;
  overflow: visible;
  color: rgba(230, 237, 243, 0.68);
  font-size: 10px;
  line-height: 1.4;
  white-space: normal;
}
.sensitivity-label-proxy {
  display: block;
  overflow: visible;
  color: rgba(255, 179, 71, 0.72);
  font-size: 9px;
  line-height: 1.35;
  white-space: normal;
}
.sensitivity-label .sensitivity-direction {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 9px; font-weight: 800; letter-spacing: 0.035em;
}
