﻿/* ── THEMES ── */
body.theme-dark  {
  --bg:#0b0e11; --bg2:#131722; --bg3:#0d1017; --bgi:#1c2030;
  --brd:#1e2433; --brd2:#2a3350;
  --txt:#9098a8; --txt2:#5c6680; --txth:#d1d5dc;
  --acc:#2962ff; --grn:#26a69a; --red:#ef5350;
  --nav:#0d1017;
}
body.theme-white {
  --bg:#f7f8fa; --bg2:#ffffff; --bg3:#f0f2f5; --bgi:#ebeef2;
  --brd:#dde2ec; --brd2:#c8d0e0;
  --txt:#5c6680; --txt2:#9098a8; --txth:#1a2035;
  --acc:#2962ff; --grn:#26a69a; --red:#ef5350;
  --nav:#1a2035;
}
body.theme-trader{
  --bg:#020c02; --bg2:#050f05; --bg3:#071207; --bgi:#0a1a0a;
  --brd:#0d2b0d; --brd2:#164016;
  --txt:#00d435; --txt2:#006820; --txth:#00ff41;
  --acc:#00ff41; --grn:#00ff41; --red:#ff3b3b;
  --nav:#020802;
}
body.theme-trader, body.theme-trader * { font-family: 'Courier New', monospace !important; }

* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text, var(--txt)); font-family: var(--sans, sans-serif); }

/* ── LAYOUT ── */
.page { padding: 12px 6px; max-width: 1920px; margin: 0 auto; }

/* ── PANELS ── */
.pnl { background: var(--bg2); border: 1px solid var(--brd); border-radius: 3px; margin-bottom: 10px; }
.pnl-head { background: var(--bg3); border-bottom: 1px solid var(--brd); padding: 6px 12px; font-size: 12px; font-weight: 600; color: var(--txth); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px; }
.chart-hero {
  padding: 7px 14px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: nowrap;
  overflow: visible;
}
.chart-hero-main { min-width: 0; display: flex; align-items: center; gap: 10px; flex: 0 1 auto; flex-wrap: nowrap; overflow: hidden; }
.indicator-pane-labels { position:absolute; inset:0; pointer-events:none; z-index:8; }
.indicator-pane-label { position:absolute; left:8px; padding:2px 5px; border-radius:3px; background:color-mix(in srgb,var(--bg2) 86%,transparent); color:var(--txth); font:700 11px/1.2 'Roboto Mono','Courier New',monospace; white-space:nowrap; }
.chart-panel-actions {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  flex-wrap: nowrap;
  white-space: nowrap;
  align-self: center;
}
.chart-panel-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.chart-panel-action-max { background: #1769aa; border-color: #1769aa; }
.chart-panel-action-super { background: #7b2cbf; border-color: #7b2cbf; }
.chart-panel-action-service { background: #0f766e; border-color: #0f766e; }
.chart-panel-action:hover { filter: brightness(1.08); color: #fff; }
.chart-panel-action:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.chart-panel-action[aria-pressed="true"] { box-shadow: 0 0 0 2px rgba(255,255,255,.18) inset; filter: brightness(1.14); }
.chart-panel-action i { font-size: 11px; }
.admin-service-wrap {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
}
.admin-service-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 9700;
  min-width: 260px;
  padding: 12px;
  background-color: var(--bg2);
  background-image: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,0));
  border: 1px solid var(--brd2);
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(0,0,0,.34);
  opacity: 1;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.admin-service-title {
  color: var(--txth);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 4px;
}
.admin-service-ticker {
  color: var(--txt2);
  font-size: 11px;
  margin-bottom: 10px;
  font-family: 'Roboto Mono','Courier New',monospace;
}
.admin-service-select {
  width: 100%;
  height: 32px;
  margin-bottom: 8px;
  padding: 0 10px;
  background: var(--bgi);
  border: 1px solid var(--brd);
  color: var(--txth);
  border-radius: 6px;
  font-size: 12px;
  outline: none;
}
.admin-service-select:focus {
  border-color: var(--acc);
}
.admin-service-run {
  width: 100%;
  height: 32px;
  border: 0;
  border-radius: 6px;
  background: var(--acc);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.admin-service-run:disabled {
  opacity: .65;
  cursor: wait;
}
.admin-service-run-secondary {
  background: var(--bg3);
  border: 1px solid var(--brd2);
  color: var(--txth);
}
.admin-service-state-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.admin-service-state-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border: 1px solid var(--brd2);
  border-radius: 999px;
  background: var(--bg3);
  color: var(--txt2);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.admin-service-state-pill.is-idle {
  color: var(--txt2);
}
.admin-service-state-pill.is-running {
  color: var(--acc);
  border-color: color-mix(in srgb, var(--acc) 45%, var(--brd2) 55%);
  animation: admin-service-running-pulse 2.4s ease-in-out infinite;
}
.admin-service-state-pill.is-running::before {
  content: '';
  width: 6px;
  height: 6px;
  margin-right: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--acc) 55%, transparent);
  animation: admin-service-running-dot 2.4s ease-in-out infinite;
}
@keyframes admin-service-running-pulse {
  0%, 100% {
    background: var(--bg3);
    box-shadow: none;
  }
  50% {
    background: color-mix(in srgb, var(--acc) 9%, var(--bg3) 91%);
    box-shadow: 0 0 10px color-mix(in srgb, var(--acc) 14%, transparent);
  }
}
@keyframes admin-service-running-dot {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--acc) 40%, transparent); }
  50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--acc) 0%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .admin-service-state-pill.is-running,
  .admin-service-state-pill.is-running::before {
    animation: none;
  }
}
.admin-service-state-pill.is-completed {
  color: var(--grn);
  border-color: color-mix(in srgb, var(--grn) 45%, var(--brd2) 55%);
}
.admin-service-state-pill.is-failed {
  color: var(--red);
  border-color: color-mix(in srgb, var(--red) 45%, var(--brd2) 55%);
}
.admin-service-log-link {
  color: var(--acc);
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
}
.admin-service-log-link:hover {
  text-decoration: underline;
}
.admin-service-status {
  min-height: 18px;
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--txt2);
}
.admin-service-status.success { color: var(--grn); }
.admin-service-status.error { color: var(--red); }
.admin-service-status.running { color: var(--acc); }
.admin-service-meta {
  display: block;
  margin-top: 2px;
  color: var(--txt2);
  font-family: 'Roboto Mono','Courier New',monospace;
}
.admin-service-tail {
  margin-top: 10px;
  padding: 10px;
  max-height: 180px;
  overflow: auto;
  border: 1px solid var(--brd);
  border-radius: 6px;
  background: var(--bg3);
  color: var(--txt);
  font: 11px/1.45 'Roboto Mono','Courier New',monospace;
  white-space: pre-wrap;
}
.admin-service-popup {
  width: min(460px, calc(100vw - 20px));
  max-height: min(78vh, 760px);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,0)), var(--bg2);
  border: 1px solid var(--brd);
  border-radius: 14px;
  box-shadow: 0 24px 70px rgba(0,0,0,.52);
  overflow: hidden;
}
.admin-service-popup-head {
  position: relative;
  padding: 14px 54px 12px 16px;
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,0)), var(--bg3);
  border-bottom: 1px solid var(--brd);
  flex: 0 0 auto;
}
.admin-service-popup-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--brd2);
  border-radius: 999px;
  background: var(--bg3);
  color: var(--txth);
  font-size: 14px;
  cursor: pointer;
  line-height: 1;
  transition: background .15s, color .15s, border-color .15s, transform .15s;
}
.admin-service-popup-close:hover {
  background: var(--bgi);
  color: var(--txth);
  border-color: var(--acc);
  transform: scale(1.04);
}
.admin-service-popup-body {
  padding: 14px 16px;
  overflow-y: auto;
  flex: 1 1 auto;
}
.admin-service-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.admin-service-tab {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--brd);
  border-radius: 10px;
  background: var(--bg3);
  color: var(--txt2);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.admin-service-tab:hover {
  color: var(--txth);
  border-color: var(--acc);
}
.admin-service-tab.is-active {
  background: color-mix(in srgb, var(--acc) 16%, var(--bg3) 84%);
  border-color: color-mix(in srgb, var(--acc) 48%, var(--brd) 52%);
  color: var(--txth);
}
.admin-service-tab-panels {
  margin-top: 12px;
}
.admin-service-tab-panel {
  display: none;
}
.admin-service-tab-panel.is-active {
  display: block;
}
.admin-service-card {
  padding: 14px;
  border: 1px solid var(--brd);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.01)), var(--bg3);
}
.admin-service-card-title {
  margin-bottom: 10px;
  color: var(--txth);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .02em;
}
.admin-service-ticker-state-card {
  margin-bottom: 10px;
}
.admin-service-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.admin-service-toggle-label {
  color: var(--txth);
  font-size: 12px;
  font-weight: 700;
}
.admin-service-toggle-description {
  margin-top: 4px;
  color: var(--txt2);
  font-size: 11px;
  line-height: 1.4;
}
.admin-service-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  cursor: pointer;
  user-select: none;
}
.admin-service-toggle input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}
.admin-service-toggle-track {
  position: relative;
  width: 38px;
  height: 22px;
  border: 1px solid var(--brd2);
  border-radius: 999px;
  background: var(--bgi);
  transition: background .15s, border-color .15s;
}
.admin-service-toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--txt2);
  transition: transform .15s, background .15s;
}
.admin-service-toggle input:checked + .admin-service-toggle-track {
  background: var(--grn);
  border-color: var(--grn);
}
.admin-service-toggle input:checked + .admin-service-toggle-track::after {
  transform: translateX(16px);
  background: #fff;
}
.admin-service-toggle input:focus-visible + .admin-service-toggle-track {
  outline: 2px solid var(--acc);
  outline-offset: 2px;
}
.admin-service-toggle input:disabled + .admin-service-toggle-track {
  opacity: .55;
}
.admin-service-toggle-text {
  min-width: 22px;
  color: var(--txth);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}
.admin-service-action-grid,
.admin-service-form-grid {
  display: grid;
  gap: 10px;
}
.admin-service-two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.admin-service-two-col-fit {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}
.admin-service-input {
  width: 100%;
  min-height: 38px;
  padding: 9px 10px;
  border: 1px solid var(--brd);
  border-radius: 8px;
  background: var(--bg2);
  color: var(--txth);
  font-size: 12px;
  font-family: inherit;
}
.admin-service-input:focus {
  outline: none;
  border-color: var(--acc);
}
.admin-service-input-mono {
  font-family: 'Roboto Mono','Courier New',monospace;
}
.admin-service-help {
  margin-top: 9px;
  color: var(--txt2);
  font-size: 11px;
  line-height: 1.45;
}
@media (max-width: 640px) {
  .admin-service-popup {
    width: min(460px, calc(100vw - 12px));
    max-height: calc(100vh - 18px);
  }
  .admin-service-tabs,
  .admin-service-two-col,
  .admin-service-two-col-fit {
    grid-template-columns: 1fr;
  }
}
#chartTitle { color: var(--txth); font-size: 14px; font-weight: 750; line-height: 1.1; display: inline-flex; align-items: center; gap: 7px; min-width: 0; flex: 0 1 auto; }
#chartTitle .gs-ticker-with-logo,
#chartTitle .gs-ticker-logo-only{
  display:inline-flex;
  align-items:center;
  flex:0 0 auto;
}
#chartTitle .gs-ticker-logo{
  width:16px;
  height:16px;
}
#chartTitle .chart-title-company{
  color: var(--txt2);
  font-weight: 650;
  white-space: nowrap;
}
#chartTitle .chart-logo-tooltip{
  position: relative;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  outline: none;
}
#chartTitle .chart-logo-tooltip[data-tooltip]{
  cursor: default;
}
#chartTitle .chart-logo-tooltip[data-tooltip]:hover::after,
#chartTitle .chart-logo-tooltip[data-tooltip]:focus-visible::after{
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);
  z-index: 9700;
  max-width: min(240px, calc(100vw - 24px));
  padding: 8px 10px;
  border: 1px solid rgba(245,158,11,.42);
  border-radius: 6px;
  background: #111827;
  color: #f8fafc;
  box-shadow: 0 10px 28px rgba(0,0,0,.36);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
}
#chartTitle .chart-logo-tooltip[data-tooltip]:hover::before,
#chartTitle .chart-logo-tooltip[data-tooltip]:focus-visible::before{
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(100% + 5px);
  width: 9px;
  height: 9px;
  transform: translateX(-50%) rotate(45deg);
  background: #111827;
  border-right: 1px solid rgba(245,158,11,.42);
  border-bottom: 1px solid rgba(245,158,11,.42);
  z-index: 9701;
}
.hero-price-wrap{display:flex;align-items:baseline;gap:10px;margin-top:0;flex:0 0 auto;white-space:nowrap}.hero-price{font-size:30px;line-height:1;font-weight:800;color:var(--txth);font-family:'Roboto Mono','Courier New',monospace;letter-spacing:-0.5px}.hero-change{font-size:18px;font-weight:700;font-family:'Roboto Mono','Courier New',monospace}.hero-change.up{color:var(--grn)}.hero-change.down{color:var(--red)}.hero-change.flat{color:var(--txt2)}.hero-realtime-status{align-items:center;gap:5px;height:22px;padding:0 8px;border:1px solid rgba(245,158,11,.58);border-radius:4px;background:rgba(245,158,11,.11);color:#fbbf24;font:700 10px/1 var(--sans,Arial,sans-serif);letter-spacing:.1px}.hero-realtime-status i{font-size:11px}.hero-earnings-badge{position:relative;align-items:center;gap:6px;height:26px;padding:0 9px;border:1px solid var(--brd2);border-radius:4px;background:var(--bgi);color:var(--txth);font-size:12px;font-weight:800;line-height:1;cursor:pointer;box-shadow:0 1px 0 rgba(255,255,255,.03) inset}.hero-earnings-badge i{font-size:13px;color:#f59e0b}.hero-earnings-badge.is-soon{border-color:#f59e0b;background:rgba(245,158,11,.12)}.hero-earnings-badge:hover{border-color:#f59e0b;color:var(--txth)}.hero-earnings-badge[data-tooltip]:hover:after,.hero-earnings-badge[data-tooltip]:focus-visible:after{content:attr(data-tooltip);position:absolute;left:0;top:calc(100% + 8px);z-index:9700;width:280px;white-space:pre-line;text-align:left;background:var(--bg2);color:var(--txt);border:1px solid var(--brd2);border-radius:6px;padding:10px 12px;box-shadow:0 10px 28px rgba(0,0,0,.35);font-size:12px;font-weight:500;line-height:1.45;font-family:var(--sans,sans-serif)}.hero-earnings-badge[data-tooltip]:hover:before,.hero-earnings-badge[data-tooltip]:focus-visible:before{content:"";position:absolute;left:14px;top:calc(100% + 3px);z-index:9701;border:6px solid transparent;border-bottom-color:var(--brd2)}@media(max-width:768px){.hero-price{font-size:24px}.hero-change{font-size:16px}.hero-realtime-status{height:20px;padding:0 6px;font-size:9px}.hero-earnings-badge[data-tooltip]:hover:after,.hero-earnings-badge[data-tooltip]:focus-visible:after{left:auto;right:0;width:min(280px,calc(100vw - 32px))}}
.pnl-body { padding: 8px 12px; }

/* ── SEARCH ── */
.chart-page .search-outer { position: relative; max-width: 600px; flex: 1; }
.chart-page .search-input { width: 100%; background: var(--bgi); border: 1px solid var(--brd); color: var(--txt); border-radius: 4px; padding: 7px 12px 7px 32px; font-size: 13px; outline: none; font-family: inherit; transition: border-color .15s; }
.chart-page .search-input:focus { border-color: var(--acc); }
.chart-page .search-input::placeholder { color: var(--txt2); }
.chart-page .s-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--txt2); pointer-events: none; font-size: 12px; }
.chart-page .ac-list { display: none; position: absolute; top: calc(100% + 2px); left: 0; right: 0; z-index: 9999; background: var(--bg2); border: 1px solid var(--brd); border-radius: 4px; max-height: 240px; overflow-y: auto; box-shadow: 0 6px 20px rgba(0,0,0,.4); }
.chart-page .ac-item { padding: 8px 12px; cursor: pointer; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--brd); transition: background .1s; }
.chart-page .ac-item:last-child { border-bottom: none; }
.chart-page .ac-item:hover, .chart-page .ac-item.sel { background: var(--bgi); }
.chart-page .ac-tk { flex: 0 0 104px; min-width: 104px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; color: var(--acc); font-size: 13px; }
.chart-page .ac-nm { color: var(--txt2); font-size: 11px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-page .ac-ex { background: var(--brd); color: var(--txt2); font-size: 10px; padding: 1px 5px; border-radius: 2px; flex-shrink: 0; }

/* ── OHLC BAR ── */
.ohlc-bar {
  display: none;
  align-items: center;
  position: relative;
  padding: 0;
  border-bottom: 0;
  background: transparent;
  overflow-x: hidden;
  overflow-y: hidden;
  white-space: nowrap;
  min-height: 0;
  line-height: 1.2;
  font-size: 12px;
  flex: 1 1 420px;
  min-width: 280px;
}
.ohlc-bar.show { display: flex; }
.ohlc-data { display: flex; align-items: center; width: 100%; min-width: 0; overflow-x: auto; overflow-y: hidden; gap: 0; }
.chart-ohlc-overlay {
  position: absolute;
  left: 10px;
  right: 10px;
  top: 8px;
  z-index: 34;
  min-height: 24px;
  min-width: 0;
  padding: 3px 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
  pointer-events: none;
}
.chart-header-config-btn { pointer-events:auto; position:absolute; right:8px; top:4px; border:0; border-radius:5px; background:var(--bg2); color:var(--txt2); width:25px; height:25px; cursor:pointer; opacity:.7; }
.chart-header-config-btn:hover { color:var(--acc); opacity:1; }
.chart-header-config-overlay { display:none; position:fixed; inset:0; z-index:8000; background:rgba(0,0,0,.25); }
.chart-header-config-overlay.open { display:block; }
.chart-header-config-modal { display:none; position:fixed; z-index:8001; left:50%; top:50%; transform:translate(-50%,-50%); width:min(620px,calc(100vw - 28px)); max-height:calc(100vh - 32px); overflow:auto; box-sizing:border-box; padding:18px; border:2px solid color-mix(in srgb, var(--acc) 65%, var(--brd)); border-radius:10px; background:var(--bg); color:var(--txt); box-shadow:0 20px 60px rgba(0,0,0,.62); }
.chart-header-config-modal.open { display:block; }
.chart-header-config-head { display:flex; align-items:center; justify-content:space-between; gap:10px; }.chart-header-config-drag{display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;border:1px solid var(--brd);border-radius:5px;color:var(--txt2);cursor:grab;touch-action:none}.chart-header-config-drag:active{cursor:grabbing}.chart-header-config-head h3{margin:0;font-size:16px;flex:1}.chart-header-config-head button{border:0;background:transparent;color:var(--txt);font-size:25px;cursor:pointer}.chart-header-config-modal p{font-size:12px;color:var(--txt2);margin:10px 0 14px}.chart-header-config-tabs{display:flex;gap:4px;overflow:auto;border-bottom:1px solid var(--brd);margin-bottom:12px}.chart-header-config-tabs button{border:0;border-bottom:2px solid transparent;background:transparent;color:var(--txt2);padding:7px 9px;white-space:nowrap;cursor:pointer}.chart-header-config-tabs button.active{border-color:var(--acc);color:var(--acc)}.chart-header-config-metrics{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}.chart-header-config-metric{display:flex;align-items:center;gap:7px;padding:7px;border:1px solid var(--brd);border-radius:5px;font-size:12px}.chart-header-config-metric button{margin-left:auto;border:0;background:transparent;color:var(--txt2);cursor:pointer}.chart-header-config-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:16px}.chart-header-config-actions button{padding:7px 11px;border:1px solid var(--brd);border-radius:5px;background:var(--bg2);color:var(--txt);cursor:pointer}.chart-header-config-actions .primary{background:var(--acc);border-color:var(--acc);color:#fff}.chart-header-config-status{height:16px;margin-top:8px;font-size:11px;color:var(--txt2)}
.chart-header-config-layout{margin:0 0 14px}.chart-header-layout-row{display:flex;align-items:flex-start;gap:8px;padding:7px 0;border-bottom:1px solid var(--brd)}.chart-header-layout-row:last-child{border-bottom:0}.chart-header-layout-label{width:42px;padding-top:5px;color:var(--txt2);font-size:11px}.chart-header-layout-items{display:flex;flex-wrap:wrap;gap:5px;min-height:30px;flex:1;padding:2px;border:1px dashed transparent;border-radius:5px;transition:border-color .12s,background .12s}.chart-header-layout-items.is-drop-target{border-color:var(--acc);background:color-mix(in srgb,var(--acc) 8%,transparent)}.chart-header-layout-empty{font-size:11px;color:var(--txt2);padding:5px}.chart-header-layout-chip{display:inline-flex;align-items:center;gap:5px;padding:3px 5px;border:1px solid var(--brd);border-radius:4px;background:var(--bg2);font-size:11px;cursor:grab;touch-action:none;user-select:none;transition:opacity .12s,transform .12s,border-color .12s}.chart-header-layout-chip:focus-visible{outline:1px solid var(--acc);outline-offset:1px}.chart-header-layout-chip.is-fixed{cursor:default}.chart-header-layout-chip.is-dragging{opacity:.38;transform:scale(.96)}.chart-header-layout-chip.drop-before{border-left:3px solid var(--acc)}.chart-header-layout-chip.drop-after{border-right:3px solid var(--acc)}.chart-header-layout-grip{color:var(--txt2);font-size:9px;cursor:grab}.chart-header-layout-chip button{border:0;background:transparent;color:var(--txt2);cursor:pointer;padding:0 2px;font-size:14px;line-height:12px}.chart-header-layout-chip button:hover{color:var(--red)}
.chart-ohlc-overlay .ohlc-data {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  overflow: hidden;
  scrollbar-width: none;
  pointer-events: none;
}
.chart-ohlc-overlay .ohlc-data::-webkit-scrollbar {
  display: none;
}
.ob-pair {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex: 0 0 auto;
}
.ob-metrics {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  min-width: 0;
  white-space: nowrap;
}
.ob-topline {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  width: 100%;
}
.ob-meta-tail {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  width: 100%;
  justify-content: flex-start;
  overflow: hidden;
}
.ob-ticker { font-weight: 700; color: var(--txth); margin-right: 6px; }
.ob-logo-slot{
  display:inline-flex;
  align-items:center;
  margin-right:7px;
  vertical-align:middle;
}
.ob-logo-slot .gs-ticker-logo-only .gs-ticker-logo{
  width:16px;
  height:16px;
}
.ob-ticker-input {
  width: 88px;
  height: 24px;
  margin: 0;
  padding: 1px 6px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: var(--txth);
  font: 800 13px/1 'Roboto Mono','Courier New',monospace;
  text-transform: uppercase;
  outline: none;
  vertical-align: middle;
  flex: 0 0 auto;
}
.ob-ticker-input:hover { border-color: var(--brd); background: var(--bgi); }
.ob-ticker-input:focus { border-color: var(--acc); background: var(--bgi); }
.ohlc-ticker-ac-list {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: min(420px, calc(100vw - 40px));
  z-index: 9600;
  background: var(--bg2);
  border: 1px solid var(--brd);
  border-radius: 5px;
  max-height: 260px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,.34);
  line-height: 1.2;
}
.ohlc-ticker-ac-list .ac-item {
  padding: 7px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--brd);
}
.ohlc-ticker-ac-list .ac-item:last-child { border-bottom: 0; }
.ohlc-ticker-ac-list .ac-item:hover,
.ohlc-ticker-ac-list .ac-item.sel { background: var(--bgi); }
.ohlc-ticker-ac-list .ac-logo{
  display:inline-flex;
  align-items:center;
  flex:0 0 auto;
}
.ohlc-ticker-ac-list .ac-logo .gs-ticker-logo-only .gs-ticker-logo{
  width:14px;
  height:14px;
}
.ohlc-ticker-ac-list .ac-tk { flex: 0 0 108px; min-width: 108px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--acc); font: 800 12px/1 'Roboto Mono','Courier New',monospace; }
.ohlc-ticker-ac-list .ac-nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--txt2); font-size: 11px; }
.ohlc-ticker-ac-list .ac-ex { background: var(--brd); color: var(--txt2); font-size: 10px; padding: 1px 5px; border-radius: 2px; flex-shrink: 0; }
.ob-name   { color: var(--txt2); font-size: 11px; margin-left: 8px; margin-right: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.ob-sep    { color: var(--brd); margin: 0 8px; }
.ob-lbl    { color: var(--txt2); font-size: 10px; margin: 0; }
.ob-val    { text-align: right; font-weight: 600; color: var(--txth); font-family: 'Roboto Mono','Courier New', monospace; margin: 0; flex: 0 0 auto; }
.ob-time   { font-size: 10px; color: var(--txt2); margin: 0; padding: 0; white-space: nowrap; font-family: 'Roboto Mono','Courier New',monospace; flex: 0 0 auto; }
.ob-chg    { font-weight: 700; font-family: 'Courier New', monospace; margin-left: 4px; }
.ob-live   { color: var(--grn) !important; font-weight: 700; animation: rt-blink 2s infinite; }
.chart-alerts-tf{
  color: var(--txt2);
  font-weight: 600;
  font-size: 12px;
}
@keyframes rt-blink { 0%,100%{ opacity:1 } 50%{ opacity:0.4 } }
.price-flash-up {
  animation: priceFlashUp 0.85s ease-out;
}
.price-flash-down {
  animation: priceFlashDown 0.85s ease-out;
}
#heroClosePrice.price-flash-up,
#heroClosePrice.price-flash-down {
  border-radius: 3px;
}
@keyframes priceFlashUp {
  0%   { background-color: rgba(38,166,154,0.32); box-shadow: inset 0 0 0 9999px rgba(38,166,154,0.08), 0 0 18px rgba(38,166,154,0.42); }
  100% { background-color: transparent; box-shadow: none; }
}
@keyframes priceFlashDown {
  0%   { background-color: rgba(239,83,80,0.32); box-shadow: inset 0 0 0 9999px rgba(239,83,80,0.08), 0 0 18px rgba(239,83,80,0.42); }
  100% { background-color: transparent; box-shadow: none; }
}
#rtOverlay { position:absolute; inset:0; z-index:10; background:transparent; display:flex; align-items:flex-end; justify-content:flex-end; padding:10px 14px; pointer-events:none; }
#rtOverlay .rt-badge { font-size:11px; color:var(--txt2); background:var(--bg2); border:1px solid var(--brd); border-radius:4px; padding:3px 8px; display:flex; align-items:center; gap:6px; opacity:0.85; }
#rtOverlay .rt-spinner { width:10px; height:10px; border:2px solid var(--brd); border-top-color:var(--acc); border-radius:50%; animation:rt-spin 0.8s linear infinite; }
@keyframes rt-spin { to { transform:rotate(360deg); } }

/* ── QUOTE LOADING OVERLAY (blur grafico finché non arriva ultima quotazione) ── */
#chartQuoteLoading {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  pointer-events: none;
  /* Sfondo semi-trasparente che "copre" il grafico */
  background: rgba(0,0,0,0.18);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  border-radius: 0;
  transition: opacity 0.3s ease;
}
#chartQuoteLoading.hidden {
  opacity: 0;
  pointer-events: auto;
}
#chartQuoteLoading .cql-badge {
  background: var(--bg2);
  border: 1px solid var(--brd);
  border-radius: 6px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--txt2);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
#chartQuoteLoading .cql-spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--brd);
  border-top-color: var(--acc);
  border-radius: 50%;
  animation: rt-spin 0.7s linear infinite;
  flex-shrink: 0;
}

/* ── CONTROLS ── */
.ctrl-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1 1 auto;
  flex-wrap: nowrap;
  min-width: 0;
  padding: 0;
  border-bottom: 0;
  background: transparent;
  overflow: visible;
}
.ctrl-bar-compact {
  justify-content: space-between;
  gap: 8px;
}
.chart-toolbar-main,
.chart-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.chart-toolbar-main {
  flex: 1 1 auto;
  overflow: visible;
}
.chart-toolbar-actions {
  flex: 0 0 auto;
}

.manual-candle-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 9, 18, .62);
}
.manual-candle-overlay[hidden] { display: none; }
.manual-candle-panel {
  width: min(520px, 100%);
  padding: 18px;
  border: 1px solid rgba(140, 160, 190, .24);
  border-radius: 12px;
  background: var(--panel, #101722);
  color: var(--txt, #edf3fb);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .42);
}
.manual-candle-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.manual-candle-head h3 { margin: 2px 0 0; font-size: 17px; }
.manual-candle-head h3 i { margin-right: 7px; color: var(--accent, #6aa8ff); }
.manual-candle-kicker { color: var(--txt2); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.manual-candle-head > button { border: 0; background: transparent; color: var(--txt2); cursor: pointer; font-size: 24px; line-height: 1; }
.manual-candle-help { margin: 12px 0 16px; color: var(--txt2); font-size: 12px; line-height: 1.45; }
.manual-candle-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.manual-candle-grid label { display: grid; gap: 5px; color: var(--txt2); font-size: 11px; }
.manual-candle-grid label:first-child { grid-column: 1 / -1; }
.manual-candle-grid input { width: 100%; box-sizing: border-box; min-height: 34px; padding: 7px 8px; border: 1px solid rgba(140, 160, 190, .28); border-radius: 6px; background: rgba(255,255,255,.045); color: var(--txt); }
.manual-candle-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.manual-candle-actions button { min-height: 32px; padding: 0 12px; border: 1px solid rgba(140, 160, 190, .3); border-radius: 6px; background: transparent; color: var(--txt); cursor: pointer; }
.manual-candle-actions button.primary { border-color: transparent; background: var(--accent, #3e8cff); color: #fff; }
.manual-candle-status { min-height: 17px; margin-top: 9px; color: var(--txt2); font-size: 11px; }
.manual-candle-status.error { color: #ff8d8d; }
@media (max-width: 560px) { .manual-candle-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.chart-simulation-overlay { position: fixed; inset: 0; z-index: 1201; display: grid; place-items: center; padding: 20px; background: rgba(4, 9, 18, .62); }
.chart-simulation-overlay[hidden] { display: none; }
.chart-simulation-panel { width: min(520px, 100%); padding: 18px; border: 1px solid rgba(140, 160, 190, .24); border-radius: 12px; background: var(--panel, #101722); color: var(--txt, #edf3fb); box-shadow: 0 24px 70px rgba(0, 0, 0, .42); }
.chart-simulation-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.chart-simulation-grid label { display: grid; gap: 5px; color: var(--txt2); font-size: 11px; }
.chart-simulation-grid select { width: 100%; box-sizing: border-box; min-height: 34px; padding: 7px 8px; border: 1px solid rgba(140, 160, 190, .28); border-radius: 6px; background: rgba(255,255,255,.045); color: var(--txt); }
.chart-simulation-check { grid-column: 1 / -1; display: flex !important; align-items: center; gap: 7px !important; }
.chart-simulation-check input { accent-color: var(--accent, #3e8cff); }
.chart-simulation-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.chart-simulation-actions button { min-height: 32px; padding: 0 12px; border: 1px solid rgba(140, 160, 190, .3); border-radius: 6px; background: transparent; color: var(--txt); cursor: pointer; }
.chart-simulation-actions button.primary { border-color: transparent; background: var(--accent, #3e8cff); color: #fff; }
.chart-simulation-status { min-height: 17px; margin-top: 9px; color: var(--txt2); font-size: 11px; }
.chart-simulation-status.error { color: #ff8d8d; }
.chart-simulation-layer { position: absolute; inset: 0; z-index: 8; pointer-events: none; overflow: hidden; }
.chart-simulation-candle { position: absolute; width: 8px; }
.chart-simulation-wick { position: absolute; left: 50%; width: 2px; transform: translateX(-50%); background: repeating-linear-gradient(to bottom, currentColor 0 3px, transparent 3px 6px); opacity: .95; }
.chart-simulation-body { position: absolute; left: 0; right: 0; min-height: 3px; border: 2px dashed currentColor; border-radius: 2px; box-sizing: border-box; background: transparent; }
.chart-simulation-candle.is-up { color: #39c6bd; }
.chart-simulation-candle.is-down { color: #e5ad58; }
body.theme-white .chart-simulation-candle.is-up { color: #087f7a; }
body.theme-white .chart-simulation-candle.is-down { color: #a86a08; }
.chart-simulation-boundary { position: absolute; top: 0; bottom: 0; width: 1px; border-left: 1px dashed rgba(180, 190, 210, .72); }
.chart-simulation-label { position: absolute; top: 8px; padding: 3px 6px; border: 1px solid rgba(140, 160, 190, .32); border-radius: 4px; background: rgba(8, 13, 22, .82); color: var(--txt2); font-size: 10px; white-space: nowrap; }
@media (max-width: 560px) { .chart-simulation-grid { grid-template-columns: 1fr; } .chart-simulation-check { grid-column: auto; } }

/* ── MOBILE CHART LAYOUT GUARD ── */
@media (max-width: 768px) {
  html, body { max-width: 100%; overflow-x: hidden; }
  body[data-page="chart"] .content { min-width: 0; padding: 8px 6px 20px; }
  body[data-page="chart"] .chart-page,
  body[data-page="chart"] .page,
  body[data-page="chart"] #chartPanel,
  body[data-page="chart"] .chart-area-wrap,
  body[data-page="chart"] .chart-main-wrap { width: 100%; min-width: 0; max-width: 100%; }
  body[data-page="chart"] .chart-hero { padding: 7px 8px; flex-wrap: wrap; }
  body[data-page="chart"] .chart-hero-main { flex: 1 1 100%; width: 100%; max-width: 100%; flex-wrap: wrap; overflow: visible; }
  body[data-page="chart"] .hero-price-wrap { max-width: 100%; flex-wrap: wrap; }
  body[data-page="chart"] .ctrl-bar { width: 100%; max-width: 100%; min-width: 0; flex-wrap: wrap; gap: 4px; padding: 5px 6px; overflow: visible; }
  body[data-page="chart"] .chart-toolbar-main,
  body[data-page="chart"] .chart-toolbar-actions { flex: 1 1 100%; width: 100%; max-width: 100%; min-width: 0; overflow-x: auto; overflow-y: visible; scrollbar-width: none; }
  body[data-page="chart"] .chart-toolbar-main::-webkit-scrollbar,
  body[data-page="chart"] .chart-toolbar-actions::-webkit-scrollbar { display: none; }
  body[data-page="chart"] .chart-toolbar-main { padding-bottom: 1px; }
  body[data-page="chart"] .chart-toolbar-actions { justify-content: flex-start; padding-top: 1px; }
  body[data-page="chart"] .chart-toolbar-main > *,
  body[data-page="chart"] .chart-toolbar-actions > * { flex: 0 0 auto; }
  body[data-page="chart"] .mobile-chart-controls { flex: 0 0 auto; max-width: none; }
  body[data-page="chart"] #klineChart,
  body[data-page="chart"] .chart-placeholder { width: 100%; max-width: 100%; min-width: 0; }
}
.chart-toolbar-segment {
  flex: 0 0 auto;
}
.chart-toolbar-segment-tight {
  padding-right: 2px;
  border-right: 1px solid rgba(128, 144, 168, .22);
}
.chart-toolbar-status {
  flex: 0 1 120px;
  min-width: 0;
  margin-left: 2px;
  color: var(--txt2);
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color .3s;
}
.chart-toolbar-menu {
  min-width: 220px;
}
.chart-toolbar-grid {
  display: grid;
  gap: 6px;
  padding: 4px 12px 8px;
}
.chart-toolbar-grid-range {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.chart-toolbar-grid-scale {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.chart-toolbar-grid .cbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  width: 100%;
}
.cgrp { display: flex; gap: 2px; }
.cbtn { background: none; border: 1px solid var(--brd); color: var(--txt2); padding: 2px 8px; border-radius: 2px; font-size: 11px; font-weight: 500; cursor: pointer; font-family: inherit; transition: all .12s; white-space: nowrap; letter-spacing: .2px; }
.cbtn:hover { border-color: var(--brd2,#2a3350); color: var(--txth); background: var(--bgi); }
.cbtn.active { background: var(--bgi); border-color: var(--txth); color: var(--txth); font-weight: 600; }
body.theme-trader .cbtn.active { color: #000; border-color: var(--acc); background: rgba(0,255,65,0.1); }
.csep { color: var(--brd); font-size: 14px; }
.clbl { font-size: 10px; color: var(--txt2); text-transform: uppercase; letter-spacing: .5px; white-space: nowrap; }

/* ── TF BADGE BUTTONS ── */
.tf-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 22px;
  background: none;
  border: 1px solid var(--brd);
  border-radius: 3px;
  color: var(--txt2);
  font-size: 11px; font-weight: 700;
  cursor: pointer;
  font-family: 'Roboto Mono','Courier New',monospace;
  letter-spacing: 0;
  transition: all .12s;
  padding: 0;
}
.tf-btn:hover { border-color: var(--brd2); color: var(--txth); background: var(--bgi); }
.tf-btn.active { background: var(--acc); border-color: var(--acc); color: #fff; }
body.theme-trader .tf-btn.active { color: #000; }

/* ── CTRL DROPDOWN ── */
.cdrop { position: relative; display: inline-flex; }
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.cdrop-btn {
  background: none;
  border: 1px solid var(--brd);
  color: var(--txt2);
  padding: 2px 7px;
  border-radius: 2px;
  font-size: 11px; font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all .12s;
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 4px;
}
.cdrop-btn:hover { border-color: var(--brd2); color: var(--txth); background: var(--bgi); }
.cdrop-btn.has-active { border-color: var(--txth); color: var(--txth); font-weight: 600; }
.cdrop-btn .caret { font-size: 8px; opacity: .6; margin-left: 1px; }
.toolbar-icon-btn {
  justify-content: center;
  min-width: 28px;
  padding-left: 6px;
  padding-right: 6px;
}
.toolbar-icon-btn .caret {
  display: none;
}
#chartInsidersBtn.active {
  border-color: rgba(34,197,94,.38);
  color: #22c55e;
  background: rgba(34,197,94,.08);
}
/* Separa il bottone dal menu: assicura che non sembrino "attaccati" */
.cdrop-btn i, .cdrop-btn span.fa { pointer-events: none; flex-shrink: 0; }
/* Forza visibilité icona Font Awesome dentro i bottoni cdrop */
.cdrop-btn .fa { display: inline-block !important; }
.cdrop-menu {
  display: none;
  position: absolute;
  top: calc(100% + 3px);
  left: 0;
  z-index: 9500;
  background: var(--bg2);
  border: 1px solid var(--brd);
  border-radius: 4px;
  min-width: 170px;
  box-shadow: 0 6px 20px rgba(0,0,0,.45);
  padding: 4px 0;
  white-space: nowrap;
}
.cdrop-menu.open { display: block; }
.cdrop-menu-section {
  font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .8px;
  color: var(--txt2);
  padding: 6px 12px 3px;
}
.cdrop-menu-sep { border-top: 1px solid var(--brd); margin: 4px 0; }
.cdrop-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 14px;
  font-size: 12px;
  color: var(--txt);
  cursor: pointer;
  transition: background .1s;
  user-select: none;
}
.cdrop-item:hover { background: var(--bgi); color: var(--txth); }
.cdrop-item.active { color: var(--acc); font-weight: 600; }
.cdrop-item.active::after { content: '✓'; margin-left: auto; font-size: 11px; color: var(--acc); }
.cdrop-item.ind-active { color: var(--acc); }
.cdrop-item.ind-active::after { content: '●'; margin-left: auto; font-size: 9px; color: var(--acc); }
.cdrop-item i { width: 14px; text-align: center; font-size: 11px; color: var(--txt2); flex-shrink: 0; }
/* Analysis menu accent */
.cdrop-btn.analysis-btn { border-color: rgba(41,98,255,.4); color: var(--acc); }
.cdrop-btn.analysis-btn:hover { background: rgba(41,98,255,.08); }
.alert-open-btn { position: relative; border-color: rgba(245,158,11,.45); color: #f59e0b; }
.alert-open-btn.toolbar-icon-btn { gap: 4px; }
.alert-open-btn:hover { background: rgba(245,158,11,.09); color: #fbbf24; }
.notes-open-btn { border-color: rgba(15,118,110,.42); color: #14b8a6; }
.notes-open-btn:hover { background: rgba(20,184,166,.08); color: #2dd4bf; }
.journal-open-btn { border-color: rgba(99,102,241,.42); color: #a5b4fc; }
.journal-open-btn:hover { background: rgba(99,102,241,.10); color: #c7d2fe; }
.alert-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  flex: 0 0 auto;
  min-width: 16px;
  height: 16px;
  padding: 0 5px;
  border-radius: 999px;
  background: #f59e0b;
  color: #111827;
  font-size: 10px;
  font-weight: 800;
  line-height: 16px;
}

#chartNotesOverlay.chart-notes-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(2,6,23,.56);
  backdrop-filter: blur(2px);
  z-index: 8800;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease;
}
#chartNotesOverlay.chart-notes-overlay.open {
  display: block;
  opacity: 1;
  visibility: visible;
}
#chartNotesPanel.chart-notes-panel {
  position: fixed;
  top: 60px;
  right: 0;
  width: min(420px, calc(100vw - 16px));
  height: calc(100vh - 60px);
  background: var(--bg2);
  border-left: 1px solid var(--brd2);
  box-shadow: -18px 0 42px rgba(0,0,0,.35);
  z-index: 8801;
  transform: translateX(100%);
  transition: transform .24s ease;
  display: flex;
  flex-direction: column;
  visibility: hidden;
  pointer-events: none;
}
#chartNotesPanel.chart-notes-panel.open {
  transform: translateX(0);
  visibility: visible;
  pointer-events: auto;
}
body.chart-panel-supermaximized #chartNotesPanel {
  top: 0;
  height: 100vh;
  z-index: 10061;
}
body.chart-panel-supermaximized #chartNotesOverlay {
  z-index: 10060;
}
.chart-notes-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--brd);
  background: linear-gradient(180deg, rgba(20,184,166,.08), rgba(20,184,166,.02));
}
.chart-notes-title-wrap {
  min-width: 0;
  flex: 1;
}
.chart-notes-kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #14b8a6;
  margin-bottom: 6px;
}
.chart-notes-head h3 {
  font-size: 18px;
  color: var(--txth);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  min-width: 0;
}
#chartNotesTicker {
  display: inline-block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chart-notes-company {
  margin-top: 4px;
  font-size: 12px;
  color: var(--txt2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chart-notes-close {
  position: relative;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 34px;
  background: rgba(255,255,255,.02);
  border: 1px solid var(--brd);
  border-radius: 8px;
  color: var(--txt2);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: all .15s ease;
}
.chart-notes-close::before,
.chart-notes-close::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}
.chart-notes-close::before {
  transform: rotate(45deg);
}
.chart-notes-close::after {
  transform: rotate(-45deg);
}
.chart-notes-close:hover {
  background: rgba(239,68,68,.10);
  border-color: rgba(239,68,68,.35);
  color: #fca5a5;
}
.chart-notes-close svg {
  display: none;
}

#chartJournalOverlay.chart-journal-overlay {
  display:none; position:fixed; inset:0; z-index:8900; background:rgba(2,6,23,.22);
  backdrop-filter:blur(2px); opacity:0; visibility:hidden; transition:opacity .2s ease,visibility .2s ease;
}
#chartJournalOverlay.chart-journal-overlay.open { display:block; opacity:1; visibility:visible; }
#chartJournalPanel.chart-journal-panel {
  position:fixed; top:50%; left:50%; width:min(920px,calc(100vw - 32px)); height:min(760px,calc(100vh - 32px));
  z-index:8901; display:flex; flex-direction:column; background:var(--bg2); border:2px solid #4f46e5; border-radius:12px;
  box-shadow:0 22px 70px rgba(0,0,0,.48),0 0 0 5px rgba(79,70,229,.12); transform:translate(-50%,-50%) scale(.96); transition:transform .22s ease,opacity .22s ease;
  visibility:hidden; pointer-events:none;
}
#chartJournalPanel.chart-journal-panel.open { transform:translate(-50%,-50%) scale(1); visibility:visible; pointer-events:auto; }
body.theme-dark #chartJournalPanel.chart-journal-panel { border-color:#6366f1; box-shadow:0 22px 70px rgba(0,0,0,.62),0 0 0 5px rgba(99,102,241,.16); }
body.theme-white #chartJournalPanel.chart-journal-panel { border-color:#2563eb; box-shadow:0 22px 70px rgba(15,23,42,.24),0 0 0 5px rgba(37,99,235,.12); }
body.chart-panel-supermaximized #chartJournalPanel { z-index:10063; }
body.chart-panel-supermaximized #chartJournalOverlay { z-index:10062; }
.chart-journal-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; padding:18px 18px 14px; border-bottom:1px solid var(--brd); border-radius:10px 10px 0 0; background:linear-gradient(180deg,rgba(99,102,241,.11),rgba(99,102,241,.02)); user-select:none; }
body.theme-dark .chart-journal-head { background:linear-gradient(180deg,rgba(99,102,241,.16),rgba(99,102,241,.035)); }
body.theme-white .chart-journal-head { background:linear-gradient(180deg,rgba(37,99,235,.12),rgba(37,99,235,.025)); }
.chart-journal-head h3 { margin:0; color:var(--txth); font-size:18px; display:flex; align-items:center; gap:8px; }
.chart-journal-subtitle { margin-top:4px; color:var(--txt2); font-size:12px; }
.chart-journal-login { margin:12px 16px 0; padding:10px 12px; border:1px solid rgba(245,158,11,.35); border-radius:6px; color:#fbbf24; background:rgba(245,158,11,.08); font-size:12px; }
.chart-journal-layout { flex:1; min-height:0; display:grid; grid-template-columns:270px minmax(0,1fr); }
.chart-journal-list-pane { min-width:0; border-right:1px solid var(--brd); display:flex; flex-direction:column; }
.chart-journal-list-actions { padding:12px; border-bottom:1px solid var(--brd); display:grid; gap:8px; }
.chart-journal-archive-filter { color:var(--txt2); font-size:11px; display:flex; align-items:center; gap:6px; }
.chart-journal-archive-filter input { accent-color:#6366f1; }
.chart-journal-new { border:1px solid rgba(99,102,241,.55); background:rgba(99,102,241,.14); color:#c7d2fe; border-radius:6px; padding:8px 10px; font-weight:700; cursor:pointer; }
.chart-journal-new:hover { background:rgba(99,102,241,.24); }
#chartJournalSearch { width:100%; box-sizing:border-box; padding:8px 9px; border:1px solid var(--brd); border-radius:5px; background:var(--bg); color:var(--txt); font:12px inherit; }
.chart-journal-list { flex:1; overflow:auto; padding:6px; }
.chart-journal-row { width:100%; display:flex; flex-direction:column; align-items:flex-start; gap:4px; padding:10px; margin:2px 0; border:1px solid transparent; border-radius:6px; background:transparent; color:var(--txt); text-align:left; cursor:pointer; }
.chart-journal-row:hover { background:var(--bgi); }
.chart-journal-row.active { background:rgba(99,102,241,.12); border-color:rgba(99,102,241,.35); }
.chart-journal-row strong { max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:12px; color:var(--txth); }
.chart-journal-row span { width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--txt2); font-size:11px; }
.chart-journal-row time { color:var(--txt2); font-size:10px; opacity:.8; }
.chart-journal-row small { color:#818cf8; font-size:10px; max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.chart-journal-row.pinned { border-left:2px solid #6366f1; }
.chart-journal-empty { padding:28px 12px; text-align:center; color:var(--txt2); font-size:12px; }
.chart-journal-empty i { display:block; margin-bottom:10px; color:#a5b4fc; font-size:22px; }
.chart-journal-empty strong,.chart-journal-empty span { display:block; }
.chart-journal-empty strong { color:var(--txth); margin-bottom:5px; }
.chart-journal-editor { min-width:0; display:flex; flex-direction:column; padding:16px; }
.chart-journal-title { width:100%; box-sizing:border-box; border:0; border-bottom:1px solid var(--brd); background:transparent; color:var(--txth); outline:0; padding:5px 0 12px; font-size:20px; font-weight:700; }
.chart-journal-meta-row { display:flex; gap:7px; align-items:center; padding:10px 0 0; }
.chart-journal-tags { flex:1; min-width:0; border:1px solid var(--brd); border-radius:5px; padding:7px 9px; background:var(--bg); color:var(--txt); font:11px inherit; }
.chart-journal-pin,.chart-journal-archive { border:1px solid var(--brd); border-radius:5px; padding:7px 9px; background:var(--bg); color:var(--txt2); cursor:pointer; font-size:11px; white-space:nowrap; }
.chart-journal-pin:hover,.chart-journal-archive:hover { border-color:#6366f1; color:var(--txth); }
.chart-journal-pin:disabled,.chart-journal-archive:disabled { opacity:.35; cursor:default; }
.chart-journal-toolbar { display:flex; gap:4px; align-items:center; padding:10px 0; border-bottom:1px solid var(--brd); }
.chart-journal-toolbar button { min-width:28px; height:27px; border:1px solid var(--brd); border-radius:4px; background:var(--bg); color:var(--txt2); cursor:pointer; }
.chart-journal-toolbar button:hover { color:var(--txth); border-color:var(--brd2); background:var(--bgi); }
.chart-journal-toolbar span { width:1px; height:18px; background:var(--brd); margin:0 4px; }
.chart-journal-content { flex:1; min-height:180px; overflow:auto; padding:16px 2px; outline:0; color:var(--txt); font-size:14px; line-height:1.65; }
.chart-journal-content:empty:before { content:attr(data-placeholder); color:var(--txt2); opacity:.7; pointer-events:none; }
.chart-journal-content h3 { margin:12px 0 5px; color:var(--txth); font-size:17px; }
.chart-journal-content ul,.chart-journal-content ol { padding-left:24px; }
.chart-journal-content a { color:#93c5fd; }
.chart-journal-content a.journal-ticker-link { color:#a5b4fc; font-weight:800; text-decoration:underline; text-decoration-style:dotted; cursor:pointer; }
.chart-journal-editor-foot { display:flex; align-items:center; gap:12px; border-top:1px solid var(--brd); padding-top:10px; color:var(--txt2); font-size:11px; }
.chart-journal-editor-foot span:first-child { flex:1; }
.chart-journal-status.error { color:#fca5a5; }
.chart-journal-delete { border:0; background:transparent; color:#fca5a5; cursor:pointer; font-size:11px; }
.chart-journal-save { border:1px solid #6366f1; border-radius:5px; padding:7px 9px; background:rgba(99,102,241,.14); color:#c7d2fe; cursor:pointer; font-size:11px; white-space:nowrap; }
.chart-journal-save:hover { background:rgba(99,102,241,.25); }
.chart-journal-delete:disabled { opacity:.35; cursor:default; }
.chart-journal-ticker-preview { display:none; position:fixed; z-index:10080; width:380px; padding:10px; border:1px solid #6366f1; border-radius:8px; background:var(--bg2); box-shadow:0 16px 44px rgba(0,0,0,.45); pointer-events:auto; }
.chart-journal-ticker-preview.visible { display:block; }
.chart-journal-preview-head { display:flex; align-items:baseline; gap:8px; padding:2px 2px 7px; border-bottom:1px solid var(--brd); }
.chart-journal-preview-head strong { color:var(--txth); font-size:14px; }
.chart-journal-preview-head span { color:var(--txt2); font-size:11px; }
.chart-journal-preview-stats { display:flex; gap:10px; padding:8px 2px 5px; color:var(--txt2); font:10px monospace; }
.chart-journal-preview-stats b { color:var(--txt); }
.chart-journal-preview-stats em { margin-left:auto; font-style:normal; font-weight:800; }
.chart-journal-preview-stats em.up { color:#26c680; }.chart-journal-preview-stats em.down { color:#ef5350; }
#chartJournalPreviewCanvas { display:block; width:360px; height:170px; background:var(--panel2,var(--bg)); }
#chartJournalPreviewLoading { position:absolute; inset:72px 0 0; display:none; align-items:center; justify-content:center; color:var(--txt2); font-size:11px; background:rgba(15,23,42,.38); }
@media (max-width:720px) {
  #chartJournalPanel.chart-journal-panel { width:calc(100vw - 16px); height:calc(100vh - 16px); }
  .chart-journal-layout { grid-template-columns:1fr; grid-template-rows:190px minmax(0,1fr); }
  .chart-journal-list-pane { border-right:0; border-bottom:1px solid var(--brd); }
  .chart-journal-list { display:flex; gap:5px; overflow-x:auto; overflow-y:hidden; }
  .chart-journal-row { min-width:180px; max-width:220px; align-self:flex-start; }
}
.chart-notes-body {
  flex: 1;
  overflow: auto;
  padding: 16px;
}
.chart-notes-login {
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px dashed var(--brd2);
  border-radius: 10px;
  color: var(--txt2);
  font-size: 12px;
}
.chart-notes-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chart-notes-copy {
  font-size: 12px;
  line-height: 1.55;
  color: var(--txt2);
}
#chartTickerNotesInput {
  width: 100%;
  min-height: 320px;
  resize: vertical;
  padding: 12px 13px;
  border-radius: 10px;
  border: 1px solid var(--brd2);
  background: var(--bgi);
  color: var(--txth);
  font-size: 13px;
  line-height: 1.55;
  outline: none;
}
#chartTickerNotesInput:focus {
  border-color: #14b8a6;
  box-shadow: 0 0 0 3px rgba(20,184,166,.12);
}
.chart-notes-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  color: var(--txt2);
}
.chart-notes-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.chart-notes-primary,
.chart-notes-secondary {
  border-radius: 8px;
  padding: 9px 13px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.chart-notes-primary {
  border: 1px solid #14b8a6;
  background: #0f766e;
  color: #fff;
}
.chart-notes-secondary {
  border: 1px solid var(--brd2);
  background: transparent;
  color: var(--txt);
}
.chart-notes-status {
  min-height: 18px;
  font-size: 12px;
  color: var(--txt2);
}
@media(max-width:768px) {
  #chartNotesPanel.chart-notes-panel {
    top: 58px;
    height: calc(100vh - 58px);
    width: 100vw;
  }
}

/* ── DRAWING TOOLS ── */
/* ── CHART + TOOLBAR LAYOUT ── */
.chart-area-wrap {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  width: 100%;
}
.draw-toolbar {
  width: 40px;
  flex-shrink: 0;
  background: var(--bg3);
  border-right: 1px solid var(--brd);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 0;
  gap: 2px;
  z-index: 500;
  position: relative;
  overflow: visible;
}
.chart-main-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.dt-sep {
  width: 24px; height: 1px;
  background: var(--brd);
  margin: 3px 0;
  flex-shrink: 0;
}
.dt-btn {
  position: relative;
  width: 32px; height: 32px;
  background: none;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--txt2);
  font-size: 13px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .12s;
  flex-shrink: 0;
}
.dt-btn:hover { background: var(--bgi); border-color: var(--brd); color: var(--txt); }
.dt-btn.active { background: var(--acc); border-color: var(--acc); color: #fff; }
body.theme-trader .dt-btn.active { color: #000; }
.dt-style-preview {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #4d8eec;
  border: 1px solid rgba(255,255,255,.45);
  box-shadow: 0 0 0 1px rgba(0,0,0,.18);
  pointer-events: none;
}
.dt-btn:disabled {
  opacity: .38;
  cursor: default;
  pointer-events: none;
}
.draw-toolbar-config {
  position: fixed;
  z-index: 9500;
  left: 58px;
  top: 92px;
  width: min(360px, calc(100vw - 80px));
  box-sizing: border-box;
  padding: 15px;
  border: 1px solid var(--brd);
  border-radius: 9px;
  background: var(--bg2);
  color: var(--txt);
  box-shadow: 0 16px 42px rgba(0,0,0,.32);
}
.draw-toolbar-config[hidden] { display: none; }
.draw-toolbar-config-head { display:flex; align-items:flex-start; gap:10px; }
.draw-toolbar-config-head > div { flex:1; }
.draw-toolbar-config-kicker { color:var(--acc); font-size:10px; font-weight:800; letter-spacing:.7px; text-transform:uppercase; }
.draw-toolbar-config h3 { margin:3px 0 0; font-size:16px; }
.draw-toolbar-config-head > button { border:0; background:transparent; color:var(--txt2); font-size:24px; line-height:20px; cursor:pointer; }
.draw-toolbar-config p { margin:10px 0 12px; color:var(--txt2); font-size:11px; line-height:1.4; }
.draw-toolbar-config-list { display:grid; gap:6px; max-height:310px; overflow:auto; }
.draw-toolbar-config-item { display:flex; align-items:center; gap:8px; padding:8px; border:1px solid var(--brd); border-radius:6px; background:var(--bg); cursor:grab; user-select:none; touch-action:none; }
.draw-toolbar-config-item:active { cursor:grabbing; }
.draw-toolbar-config-item.is-dragging { opacity:.42; }
.draw-toolbar-config-item.is-drop-target { border-color:var(--acc); background:color-mix(in srgb,var(--acc) 9%,transparent); }
.draw-toolbar-config-grip { color:var(--txt2); font-size:12px; }
.draw-toolbar-config-item strong { font-size:12px; }
.draw-toolbar-config-actions { display:flex; justify-content:flex-end; gap:7px; margin-top:13px; }
.draw-toolbar-config-actions button { padding:7px 10px; border:1px solid var(--brd); border-radius:5px; background:var(--bg); color:var(--txt); cursor:pointer; font-size:11px; }
.draw-toolbar-config-actions .primary { background:var(--acc); border-color:var(--acc); color:#fff; }
body.chart-readonly .draw-toolbar{
  display:none !important;
}
body.chart-readonly #studySaveStatus{
  display:none !important;
}
.dt-group {
  position: relative;
  display: flex;
  justify-content: center;
  width: 100%;
}
.dt-group-trigger {
  gap: 2px;
}
.dt-group-trigger.active,
.dt-group.open .dt-group-trigger {
  background: var(--bgi);
  border-color: var(--brd);
  color: var(--txt);
}
.dt-group-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
}
.dt-group-caret {
  position: absolute;
  right: 3px;
  bottom: 1px;
  font-size: 9px;
  line-height: 1;
  opacity: .8;
}
.dt-group-menu {
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  background: color-mix(in srgb, var(--bg2) 92%, transparent);
  border: 1px solid var(--brd);
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0,0,0,.22);
  backdrop-filter: blur(12px);
  z-index: 520;
}
.dt-group.open .dt-group-menu {
  display: flex;
}
.dt-group-menu .dt-btn::after {
  left: calc(100% + 6px);
}
.dt-btn.del:hover { background: var(--red); border-color: var(--red); color: #fff; }
/* Tooltip */
.dt-btn::after {
  content: attr(data-tip);
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg);
  color: var(--txth);
  border: 1px solid var(--brd);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 999;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.dt-btn:hover::after { opacity: 1; }
/* draw-btn alias per js compatibility */
.draw-btn { cursor: pointer; }
body.chart-studies-hidden #maLegend,
body.chart-studies-hidden #indicatorCloseLayer,
body.chart-studies-hidden #studyAlertMarkerLayer,
body.chart-studies-hidden .ma-axis-label {
  display: none !important;
}

/* ── CHART CONTAINER ── */
#klineChart {
  width: 100%;
  height: calc(100vh - 205px);
  min-height: 400px;
  display: block;
  flex: 1;
  position: relative;
}
#klineChart.mobile-simple-chart {
  padding: 0 8px 4px;
  background: var(--bg);
}
#klineChart.mobile-simple-chart canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}
.mobile-chart-controls {
  display: none;
  align-items: center;
  gap: 4px;
}
.xaxis-two-line-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 34px;
  pointer-events: none;
  z-index: 6;
  overflow: hidden;
  font-family: 'Roboto Mono','Courier New',monospace;
}
.xaxis-two-line-label {
  position: absolute;
  bottom: 17px;
  transform: translateX(-50%);
  min-width: 42px;
  text-align: center;
  color: var(--txt);
  line-height: 1.05;
  white-space: nowrap;
  text-shadow: 0 1px 0 var(--bg);
}
.xaxis-two-line-label .x-month {
  display: block;
  font-size: 10px;
  font-weight: 650;
}
.xaxis-two-line-year {
  position: absolute;
  bottom: 4px;
  transform: translateX(-50%);
  min-width: 42px;
  text-align: center;
  color: var(--txt2);
  font-size: 9px;
  line-height: 1;
  font-weight: 700;
  white-space: nowrap;
  text-shadow: 0 1px 0 var(--bg);
}
.volume-profile-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  user-select: none;
}
.volume-profile-overlay.is-hidden {
  display: none;
}
.volume-profile-bars {
  position: absolute;
  overflow: hidden;
  border-radius: 0 8px 8px 0;
  background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,0));
}
.volume-profile-bar {
  position: absolute;
  left: 0;
  border-radius: 0 999px 999px 0;
  background: color-mix(in srgb, var(--acc) 72%, transparent);
  opacity: .72;
}
.volume-profile-bar.is-poc {
  background: linear-gradient(90deg, color-mix(in srgb, var(--acc) 90%, #ffffff 10%), color-mix(in srgb, var(--grn) 56%, var(--acc) 44%));
  opacity: .95;
  box-shadow: 0 0 0 1px rgba(255,255,255,.08) inset;
}
.volume-profile-poc-label {
  position: absolute;
  left: 0;
  transform: translateY(-50%);
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  font-family: 'Roboto Mono','Courier New',monospace;
  color: var(--txth);
  background: color-mix(in srgb, var(--bg2) 86%, transparent);
  border: 1px solid color-mix(in srgb, var(--acc) 34%, var(--brd) 66%);
  box-shadow: 0 6px 20px rgba(0,0,0,.18);
  white-space: nowrap;
}
.volume-profile-caption {
  position: absolute;
  top: 8px;
  left: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--txt2);
  background: color-mix(in srgb, var(--bg2) 84%, transparent);
  border: 1px solid color-mix(in srgb, var(--brd) 75%, transparent);
}
body.theme-white .volume-profile-bars {
  background: linear-gradient(180deg, rgba(15,23,42,.04), rgba(15,23,42,0));
}
body.theme-white .volume-profile-bar {
  opacity: .58;
}
body.theme-trader .volume-profile-bar {
  background: color-mix(in srgb, #00ff41 68%, transparent);
}
body.theme-trader .volume-profile-bar.is-poc {
  background: linear-gradient(90deg, #00ff41, color-mix(in srgb, #00ff41 64%, #7cffb2 36%));
  box-shadow: 0 0 12px rgba(0,255,65,.12);
}
.chart-placeholder {
  width: 100%; height: calc(100vh - 205px);
  min-height: 400px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--txt2); gap: 12px; background: var(--bg);
}
.chart-placeholder i { font-size: 52px; opacity: .12; }
.spinner { width: 24px; height: 24px; border: 2px solid var(--brd); border-top-color: var(--acc); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── STATS ── */
.stats-bar { display: flex; flex-wrap: wrap; gap: 4px; padding: 3px 10px; background: var(--bg3); border-top: 1px solid var(--brd); }
.sbox { background: none; border: none; border-right: 1px solid var(--brd); padding: 1px 10px 1px 0; }
.sbox:last-child { border-right: none; }
.slbl { font-size: 8px; text-transform: uppercase; letter-spacing: .45px; color: var(--txt2); margin-bottom: 0; line-height: 1.1; }
.sval { font-size: 11px; line-height: 1.15; font-weight: 700; color: var(--txth); font-family: 'Roboto Mono','Courier New',monospace; }
.c-grn { color: var(--grn) !important; }
.c-red { color: var(--red) !important; }
.c-acc { color: var(--acc) !important; }

/* ── DRAW MODE HINT ── */
.draw-hint { display: none; padding: 5px 14px; background: rgba(77,142,236,.12); border-bottom: 1px solid var(--acc); font-size: 11px; color: var(--acc); pointer-events: none; }
.draw-hint.show { display: block; }
.draw-stylebar {
  display: none;
  position: fixed;
  left: 86px;
  top: 220px;
  z-index: 9001;
  width: min(340px, calc(100vw - 76px));
  max-width: calc(100vw - 76px);
  transform: scale(.98);
  transform-origin: top left;
  background: var(--bg2);
  border: 1px solid var(--brd2);
  border-radius: 14px;
  box-shadow: 0 28px 70px rgba(0,0,0,.42), 0 0 0 1px rgba(255,255,255,.03) inset;
  color: var(--txt);
  overflow: hidden;
}
.draw-stylebar.show { display: block; transform: scale(1); }
.draw-style-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px 10px;
  background: linear-gradient(180deg, var(--bg3), var(--bg2));
  border-bottom: 1px solid var(--brd);
}
.draw-style-kicker {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--txt2);
  margin-bottom: 2px;
}
.draw-style-head strong {
  display: block;
  color: var(--txth);
  font-size: 14px;
  line-height: 1.2;
}
.draw-style-close {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--brd);
  border-radius: 999px;
  background: var(--bg3);
  color: var(--txt2);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}
.draw-style-close:hover { color: var(--txth); border-color: var(--brd2); }
.draw-style-body {
  padding: 14px;
  display: grid;
  gap: 12px;
}
.draw-style-row {
  display: grid;
  gap: 5px;
  margin: 0;
}
.draw-style-row > span {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .45px;
  text-transform: uppercase;
  color: var(--txt2);
}
.draw-style-row input[type="color"],
.draw-style-row select {
  width: 100%;
  min-height: 34px;
  background: var(--bg3);
  border: 1px solid var(--brd);
  border-radius: 10px;
  color: var(--txth);
  font: inherit;
  font-size: 13px;
  outline: none;
  padding: 6px 10px;
}
.draw-style-row input[type="color"] {
  padding: 4px 6px;
  min-height: 38px;
  cursor: pointer;
}
.draw-style-row input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.draw-style-row input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 6px;
}
.draw-style-fill-group {
  display: grid;
  gap: 12px;
  padding-top: 2px;
  border-top: 1px solid var(--brd);
}
.draw-style-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 0 14px 14px;
}
.draw-style-footer button {
  height: 34px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--brd);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
}
.draw-style-secondary {
  background: var(--bg3);
  color: var(--txt2);
}
.draw-style-secondary:hover { color: var(--txth); border-color: var(--brd2); }
.draw-style-primary {
  background: var(--acc);
  border-color: var(--acc);
  color: #fff;
}
.draw-style-primary:hover { filter: brightness(1.05); }
@media (max-width: 900px) {
  .draw-stylebar {
    left: 12px !important;
    top: auto !important;
    right: 12px;
    bottom: 12px;
    width: auto;
    max-width: none;
    transform-origin: bottom left;
  }
}
.fib-props-dialog {
  width: min(420px, calc(100vw - 20px));
}
.fib-props-note {
  font-size: 12px;
  line-height: 1.45;
  color: var(--txt2);
}
.fib-props-error {
  min-height: 18px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--red);
}
.annotation-editor {
  display: none;
  position: absolute;
  z-index: 260;
  width: min(260px, calc(100% - 24px));
  background: var(--bg2);
  border: 1px solid var(--brd2);
  border-radius: 6px;
  box-shadow: 0 10px 28px rgba(0,0,0,.38);
  padding: 8px;
}
.annotation-editor.show { display: block; }
.annotation-editor textarea {
  width: 100%;
  min-height: 74px;
  resize: vertical;
  border: 1px solid var(--brd);
  border-radius: 4px;
  background: var(--bgi);
  color: var(--txt);
  padding: 7px 8px;
  font-size: 12px;
  line-height: 1.35;
  outline: none;
}
.annotation-editor textarea:focus { border-color: var(--acc); }
.annotation-tooltip-toggle { display:flex; align-items:center; gap:7px; margin-top:8px; color:var(--txt2); font-size:11px; font-weight:700; cursor:pointer; }
.annotation-tooltip-toggle input { accent-color:var(--acc); }
.annotation-placement { display: flex; align-items: center; gap: 5px; margin-top: 7px; }
.annotation-placement span { margin-right: auto; color: var(--txt2); font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.annotation-placement button { height: 24px; padding: 0 8px; border: 1px solid var(--brd); border-radius: 4px; background: var(--bgi); color: var(--txt2); font: 700 10px inherit; cursor: pointer; }
.annotation-placement button.is-active { border-color: var(--acc); background: color-mix(in srgb, var(--acc) 18%, var(--bgi)); color: var(--txth); }
.annotation-editor-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 7px; }
.annotation-editor-actions button {
  height: 26px;
  border: 1px solid var(--brd);
  border-radius: 4px;
  background: var(--bgi);
  color: var(--txt);
  padding: 0 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.annotation-editor-actions button:first-child { background: var(--acc); border-color: var(--acc); color: #fff; }

.chart-note-marker-tooltip {
  display: none;
  position: fixed;
  z-index: 10050;
  width: min(320px, calc(100% - 20px));
  max-height: 220px;
  overflow: auto;
  padding: 9px 11px;
  border: 1px solid color-mix(in srgb, #14b8a6 55%, var(--brd));
  border-radius: 6px;
  background: color-mix(in srgb, var(--bg2) 94%, #14b8a6);
  color: var(--txt);
  box-shadow: 0 10px 26px rgba(0,0,0,.42);
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  pointer-events: none;
}
.chart-note-marker-tooltip::before {
  content: "✎";
  display: inline-block;
  margin-right: 6px;
  color: #14b8a6;
  font-size: 14px;
  font-weight: 800;
  vertical-align: -1px;
}
.chart-note-marker-tooltip.show { display: block; }

/* ── CANDLE TOOLTIP ── */
#candleTooltip {
  position: absolute;
  z-index: 200;
  pointer-events: none;
  display: none;
  background: var(--bg2);
  border: 1px solid var(--brd);
  border-radius: 5px;
  padding: 8px 11px;
  min-width: 170px;
  box-shadow: 0 6px 24px rgba(0,0,0,.5);
  font-size: 11px;
  line-height: 1.0;
}
#candleTooltip .ct-date {
  font-size: 11px;
  font-weight: 700;
  color: var(--txth);
  margin-bottom: 7px;
  font-family: 'Roboto Mono','Courier New',monospace;
  border-bottom: 1px solid var(--brd);
  padding-bottom: 5px;
}
#candleTooltip .ct-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 3px;
}
#candleTooltip .ct-lbl {
  color: var(--txt2);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .4px;
  white-space: nowrap;
}
#candleTooltip .ct-val {
  color: var(--txth);
  font-weight: 600;
  font-family: 'Roboto Mono','Courier New',monospace;
  font-size: 15px;
  text-align: right;
}
#candleTooltip .ct-sep {
  border-top: 1px solid var(--brd);
  margin: 5px 0;
}
#candleTooltip .ct-up   { color: var(--grn); }
#candleTooltip .ct-dn   { color: var(--red); }
#candleTooltip .ct-neut { color: var(--txt2); }
#rulerCanvas {
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 50;
  display: none;
}
#rulerCanvas.active { display: block; pointer-events: auto; cursor: crosshair; }
#rulerTooltip {
  position: absolute; z-index: 60;
  background: rgba(10,14,22,.92);
  border: 1px solid var(--brd,#1e2433);
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 11px;
  font-family: 'Roboto Mono','Courier New',monospace;
  color: var(--txth,#d1d5dc);
  pointer-events: none;
  white-space: nowrap;
  display: none;
  box-shadow: 0 4px 16px rgba(0,0,0,.5);
  line-height: 1.7;
}
#rulerTooltip .r-pct-pos { color: #26a69a; font-weight: 700; }
#rulerTooltip .r-pct-neg { color: #ef5350; font-weight: 700; }
#rulerTooltip .r-bars    { color: #9098a8; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-thumb { background: var(--brd); border-radius: 3px; }

@media(max-width:768px) {
  #klineChart { height: clamp(260px, calc(100dvh - 250px), 420px); min-height: 260px; }
  .chart-placeholder { height: clamp(260px, calc(100dvh - 250px), 420px); min-height: 260px; }
  .draw-toolbar,
  #drawHint,
  #maLegend,
  #candleTooltip,
  #rulerCanvas,
  #rulerTooltip {
    display: none !important;
  }
  .chart-area-wrap { display: block; }
  .ctrl-bar { gap: 6px; padding: 6px 10px; }
  .mobile-chart-controls { display: inline-flex; }
  .ctrl-bar .csep,
  #cdropType,
  #scaleLinBtn,
  #scaleLogBtn,
  #cdropMA,
  #cdropInd,
  #studySaveStatus {
    display: none !important;
  }

  .gs-force-kline #klineChart,
  .gs-force-kline .chart-placeholder {
    height: clamp(320px, calc(100dvh - 132px), 520px);
    min-height: 320px;
  }
  .gs-force-kline .draw-toolbar {
    display: flex !important;
  }
  .gs-force-kline .chart-area-wrap {
    display: flex;
  }
  .gs-force-kline .ctrl-bar .csep,
  .gs-force-kline #cdropType,
  .gs-force-kline #scaleLinBtn,
  .gs-force-kline #scaleLogBtn,
  .gs-force-kline #cdropMA,
  .gs-force-kline #cdropInd,
  .gs-force-kline #studySaveStatus {
    display: initial !important;
  }
  .gs-force-kline #cdropType,
  .gs-force-kline #cdropMA,
  .gs-force-kline #cdropInd {
    display: inline-flex !important;
  }
  .gs-force-kline .ctrl-bar .csep {
    display: inline !important;
  }
  .gs-force-kline .mobile-chart-controls {
    display: none !important;
  }
}

body.chart-panel-maximized {
  overflow: hidden;
  --chart-max-top: 64px;
  --chart-max-left: 0px;
}
body.chart-panel-supermaximized {
  overflow: hidden;
}
body.chart-panel-maximized #chartPanel {
  position: fixed;
  top: var(--chart-max-top);
  right: 0;
  bottom: 0;
  left: var(--chart-max-left);
  z-index: 40;
  display: flex;
  flex-direction: column;
  margin: 0;
  border-radius: 0;
  box-shadow: 0 18px 60px rgba(0,0,0,.28);
}
body.chart-panel-supermaximized #chartPanel {
  position: fixed;
  inset: 0;
  z-index: 14000;
  display: flex;
  flex-direction: column;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
body.chart-panel-maximized #chartPanel .chart-hero {
  flex-shrink: 0;
  position: relative;
  z-index: 120;
  overflow: visible;
}
body.chart-panel-supermaximized #chartPanel .chart-hero {
  flex-shrink: 0;
  position: relative;
  z-index: 120;
  overflow: visible;
}
body.chart-panel-maximized #chartPanel .search-outer {
  z-index: 130;
}
body.chart-panel-maximized #chartPanel .ac-list {
  z-index: 140;
}
body.chart-panel-maximized #chartPanel .ohlc-bar,
body.chart-panel-maximized #chartPanel .ctrl-bar,
body.chart-panel-maximized #chartPanel .stats-bar,
body.chart-panel-maximized #chartPanel .signals-panel,
body.chart-panel-supermaximized #chartPanel .ohlc-bar,
body.chart-panel-supermaximized #chartPanel .ctrl-bar,
body.chart-panel-supermaximized #chartPanel .stats-bar,
body.chart-panel-supermaximized #chartPanel .signals-panel {
  flex-shrink: 0;
}
body.chart-panel-maximized #chartPanel .chart-area-wrap,
body.chart-panel-supermaximized #chartPanel .chart-area-wrap {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  background: var(--bg2);
}
body.chart-panel-maximized #chartPanel .chart-main-wrap,
body.chart-panel-supermaximized #chartPanel .chart-main-wrap {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  background: var(--bg2);
}
body.chart-panel-maximized #chartPanel #klineChart,
body.chart-panel-maximized #chartPanel .chart-placeholder,
body.chart-panel-supermaximized #chartPanel #klineChart,
body.chart-panel-supermaximized #chartPanel .chart-placeholder {
  display: flex;
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
}
body.chart-panel-maximized #chartPanel .draw-toolbar,
body.chart-panel-supermaximized #chartPanel .draw-toolbar {
  align-self: stretch;
  overflow: visible;
}

/* ── CHART ALERTS PANEL ── */
.chart-alerts-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9200;
  background: rgba(0,0,0,.42);
}
.chart-alerts-overlay.open { display: block; }
.chart-alerts-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 9201;
  width: min(420px, 100vw);
  height: 100vh;
  background: var(--bg2);
  border-left: 1px solid var(--brd);
  box-shadow: -14px 0 34px rgba(0,0,0,.38);
  transform: translateX(100%);
  transition: transform .18s ease;
  display: flex;
  flex-direction: column;
}
.chart-alerts-panel.open { transform: translateX(0); }
.trade-planner-overlay{display:none;position:fixed;inset:0;z-index:9250;background:rgba(0,0,0,.35)}.trade-planner-overlay.open{display:block}.trade-planner-panel{display:none;position:fixed;z-index:9251;left:50%;top:50%;transform:translate(-50%,-50%);width:min(420px,calc(100vw - 28px));box-sizing:border-box;padding:16px;border:2px solid color-mix(in srgb,var(--acc) 65%,var(--brd));border-radius:10px;background:var(--bg2);box-shadow:0 18px 50px rgba(0,0,0,.55)}.trade-planner-panel.open{display:block}.trade-planner-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:14px}.trade-planner-drag{display:inline-flex;width:25px;height:25px;align-items:center;justify-content:center;border:1px solid var(--brd);border-radius:5px;color:var(--txt2);cursor:grab;touch-action:none}.trade-planner-drag:active{cursor:grabbing}.trade-planner-head h3{margin:0;font-size:16px;flex:1}.trade-planner-head button{border:0;background:transparent;color:var(--txt);font-size:24px;cursor:pointer}.trade-planner-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}.trade-planner-grid label{display:grid;gap:4px;font-size:11px;color:var(--txt2)}.trade-planner-grid input{min-width:0;padding:7px 8px;border:1px solid var(--brd);border-radius:5px;background:var(--bg);color:var(--txt)}.trade-planner-results{display:grid;grid-template-columns:repeat(3,1fr);gap:7px;margin-top:14px}.trade-planner-result{padding:8px;border-radius:5px;background:var(--bg);border:1px solid var(--brd);font-size:11px;color:var(--txt2)}.trade-planner-result strong{display:block;margin-top:3px;color:var(--txt);font-size:14px}.trade-planner-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:14px}.trade-planner-actions button{border:1px solid var(--brd);border-radius:5px;padding:7px 9px;background:var(--bg);color:var(--txt);cursor:pointer}.trade-planner-note{font-size:10px;color:var(--txt2);margin:12px 0 0}
.chart-workspace-overlay{display:none;position:fixed;inset:0;z-index:9260;background:rgba(0,0,0,.35)}.chart-workspace-overlay.open{display:block}.chart-workspace-panel{display:none;position:fixed;z-index:9261;left:50%;top:50%;transform:translate(-50%,-50%);width:min(460px,calc(100vw - 28px));box-sizing:border-box;padding:16px;border:2px solid color-mix(in srgb,var(--acc) 65%,var(--brd));border-radius:10px;background:var(--bg2);box-shadow:0 18px 50px rgba(0,0,0,.55)}.chart-workspace-panel.open{display:block}.chart-workspace-head{display:flex;align-items:center;gap:10px}.chart-workspace-head h3{margin:0;flex:1;font-size:16px}.chart-workspace-head button{border:0;background:transparent;color:var(--txt);font-size:24px;cursor:pointer}.chart-workspace-drag{display:inline-flex;width:25px;height:25px;align-items:center;justify-content:center;border:1px solid var(--brd);border-radius:5px;color:var(--txt2);cursor:grab;touch-action:none}.chart-workspace-panel p{font-size:11px;color:var(--txt2);line-height:1.4}.chart-workspace-save{display:flex;gap:7px}.chart-workspace-save input{flex:1;min-width:0;padding:8px;border:1px solid var(--brd);border-radius:5px;background:var(--bg);color:var(--txt)}.chart-workspace-save button,.chart-workspace-item button{border:1px solid var(--brd);border-radius:5px;background:var(--bg);color:var(--txt);padding:7px 9px;cursor:pointer}.chart-workspace-list{display:grid;gap:7px;margin-top:14px;max-height:280px;overflow:auto}.chart-workspace-item{display:flex;align-items:center;gap:7px;padding:8px;border:1px solid var(--brd);border-radius:6px}.chart-workspace-item strong{flex:1;font-size:12px}.chart-workspace-status{min-height:16px;margin-top:9px;font-size:11px;color:var(--txt2)}
.chart-alerts-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  background: var(--bg3);
  border-bottom: 1px solid var(--brd);
}
.chart-alerts-kicker {
  font-size: 10px;
  color: var(--txt2);
  text-transform: uppercase;
  letter-spacing: .8px;
  font-weight: 700;
  margin-bottom: 4px;
}
.chart-alerts-head h3 {
  margin: 0;
  color: var(--txth);
  font-size: 17px;
  font-weight: 750;
  display: flex;
  align-items: center;
  gap: 8px;
}
.chart-alerts-close {
  width: 30px;
  height: 30px;
  border: 1px solid var(--brd);
  border-radius: 4px;
  background: none;
  color: var(--txt2);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.chart-alerts-close:hover { color: var(--txth); background: var(--bgi); }
.chart-alerts-mobile-close { display: none; }
.chart-alerts-body {
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chart-alerts-login,
.chart-alert-card,
.chart-alert-item {
  border: 1px solid var(--brd);
  background: var(--bg3);
  border-radius: 6px;
}
.chart-alerts-login {
  color: var(--txt2);
  font-size: 12px;
  padding: 12px;
}
.chart-alert-delivery {
  border: 1px solid var(--brd);
  background: var(--bg3);
  border-radius: 6px;
  padding: 10px 12px;
}
.chart-alert-delivery-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.chart-alert-delivery-title {
  color: var(--txth);
  font-size: 12px;
  font-weight: 800;
}
.chart-alert-delivery-sub {
  color: var(--txt2);
  font-size: 10px;
}
.chart-alert-delivery-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.chart-alert-delivery-controls label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--txt);
  font-size: 12px;
  font-weight: 650;
}
.chart-alert-delivery-controls input { margin: 0; }
.chart-alert-delivery-controls button {
  margin-left: auto;
  border: 1px solid var(--brd);
  background: var(--bgi);
  color: var(--txt);
  border-radius: 4px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}
.chart-alert-delivery-controls button:hover { border-color: #f59e0b; color: #f59e0b; }
.chart-alert-card { padding: 12px; }
.chart-alert-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--brd);
  border-radius: 6px;
  background: var(--bg3);
}
.chart-alert-tab {
  min-height: 30px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--txt2);
  font-size: 10.5px;
  font-weight: 800;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: .2px;
  white-space: nowrap;
  padding: 0 4px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chart-alert-tab:hover { color: var(--txth); background: var(--bgi); }
.chart-alert-tab.active {
  background: rgba(245,158,11,.14);
  border-color: rgba(245,158,11,.45);
  color: #f59e0b;
}
.chart-alert-tab-panel { display: none; }
.chart-alert-tab-panel.active { display: block; }
.chart-alert-card-title {
  color: var(--txth);
  font-size: 13px;
  font-weight: 750;
  margin-bottom: 10px;
}
.chart-alert-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.chart-alert-wide { grid-column: 1 / -1; }
.chart-alert-select-with-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.chart-alert-color-preview {
  flex: 0 0 12px;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid rgba(255,255,255,.18);
  background: transparent;
  box-shadow: 0 0 0 1px rgba(0,0,0,.08) inset;
  opacity: 0;
  transition: opacity .16s ease, background-color .16s ease, border-color .16s ease;
}
.chart-alert-color-preview.is-visible {
  opacity: 1;
}
.chart-alert-select-with-preview select {
  margin-top: 0;
}
.chart-alert-grid label {
  margin: 0;
  color: var(--txt2);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.chart-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 14px;
  height: 14px;
  margin-left: 4px;
  border: 1px solid rgba(245,158,11,.38);
  border-radius: 50%;
  color: #f59e0b;
  background: rgba(245,158,11,.08);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  cursor: help;
  text-transform: none;
  letter-spacing: 0;
  vertical-align: 1px;
  transition: background .14s ease, border-color .14s ease, color .14s ease, transform .14s ease;
}
.chart-help:hover {
  color: #111827;
  border-color: #f59e0b;
  background: #f59e0b;
  transform: translateY(-1px);
}
.chart-help-tooltip {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 12050;
  max-width: min(260px, calc(100vw - 24px));
  padding: 8px 10px;
  border: 1px solid rgba(245,158,11,.42);
  border-radius: 6px;
  background: #111827;
  color: #f8fafc;
  box-shadow: 0 10px 28px rgba(0,0,0,.36);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
  white-space: normal;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .14s ease, transform .14s ease;
  pointer-events: none;
}
.chart-help-tooltip.show {
  opacity: 1;
  transform: translateY(0);
}
.chart-help-tooltip::after {
  content: "";
  position: absolute;
  left: var(--tooltip-arrow-left, 50%);
  top: -5px;
  bottom: auto;
  width: 9px;
  height: 9px;
  background: #111827;
  border-left: 1px solid rgba(245,158,11,.42);
  border-top: 1px solid rgba(245,158,11,.42);
  transform: translateX(-50%) rotate(45deg);
}
body.chart-help-floating .chart-help::before,
body.chart-help-floating .chart-help::after {
  content: none;
  display: none;
}
.chart-help::before,
.chart-help::after {
  position: absolute;
  left: 50%;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 4px);
  transition: opacity .14s ease, transform .14s ease;
  z-index: 9400;
}
.chart-help::before {
  content: attr(data-tooltip);
  bottom: calc(100% + 9px);
  width: max-content;
  max-width: 235px;
  padding: 8px 10px;
  border: 1px solid rgba(245,158,11,.42);
  border-radius: 6px;
  background: #111827;
  color: #f8fafc;
  box-shadow: 0 10px 28px rgba(0,0,0,.36);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
  white-space: normal;
}
.chart-help::after {
  content: "";
  bottom: calc(100% + 4px);
  width: 9px;
  height: 9px;
  background: #111827;
  border-right: 1px solid rgba(245,158,11,.42);
  border-bottom: 1px solid rgba(245,158,11,.42);
  transform: translate(-50%, 4px) rotate(45deg);
}
.chart-help:hover::before,
.chart-help:hover::after {
  opacity: 1;
  transform: translate(-50%, 0);
}
.chart-help:hover::after {
  transform: translate(-50%, 0) rotate(45deg);
}
.chart-alert-grid input,
.chart-alert-grid select,
.chart-alert-grid textarea {
  width: 100%;
  margin-top: 4px;
  background: var(--bgi);
  border: 1px solid var(--brd);
  color: var(--txt);
  border-radius: 4px;
  padding: 7px 8px;
  font-size: 12px;
  font-family: inherit;
  outline: none;
}
.chart-alert-grid textarea {
  min-height: 70px;
  resize: vertical;
  line-height: 1.4;
  text-transform: none;
}
.chart-alert-grid input:focus,
.chart-alert-grid select:focus,
.chart-alert-grid textarea:focus { border-color: var(--acc); }
.chart-alert-checks {
  display: flex;
  gap: 10px;
  min-height: 32px;
  align-items: center;
  margin-top: 4px;
}
.chart-alert-checks label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--txt);
  text-transform: none;
  letter-spacing: 0;
}
.chart-alert-checks input { width: auto; margin: 0; }
.chart-alert-primary {
  width: 100%;
  margin-top: 12px;
  padding: 8px 10px;
  border: none;
  border-radius: 4px;
  background: #f59e0b;
  color: #111827;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.chart-alert-primary:hover { filter: brightness(1.06); }
.chart-alert-note {
  min-height: 17px;
  margin-top: 8px;
  color: var(--txt2);
  font-size: 11px;
}
.chart-alert-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--txt2);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .7px;
}
.chart-alert-list-head button,
.chart-alert-actions button {
  border: 1px solid var(--brd);
  background: none;
  color: var(--txt2);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
}
.chart-alert-list-head button:hover,
.chart-alert-actions button:hover { color: var(--txth); background: var(--bgi); }
.chart-alerts-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chart-alert-empty {
  color: var(--txt2);
  font-size: 12px;
  border: 1px dashed var(--brd);
  border-radius: 6px;
  padding: 12px;
  text-align: center;
}
.chart-alert-item { padding: 10px 11px; }
.chart-alert-item.off { opacity: .58; }
.chart-alert-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.chart-alert-side {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
.chart-alert-title {
  color: var(--txth);
  font-size: 12px;
  font-weight: 750;
}
.chart-alert-sub {
  color: var(--txt2);
  font-size: 11px;
  margin-top: 3px;
  line-height: 1.45;
}
.chart-alert-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(245,158,11,.12);
  color: #f59e0b;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}
.chart-alert-actions {
  display: flex;
  gap: 6px;
}
.chart-alert-actions .danger:hover { color: #fff; background: var(--red); border-color: var(--red); }
@media (max-width: 520px) {
  .chart-alert-grid { grid-template-columns: 1fr; }
  .chart-alerts-panel { width: 100vw; }
  .chart-alerts-head {
    position: sticky;
    top: 0;
    z-index: 2;
  }
  .chart-alerts-mobile-close {
    position: sticky;
    top: 0;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    align-self: flex-end;
    margin: 8px 10px 0 auto;
    padding: 8px 12px;
    border: 1px solid var(--brd);
    border-radius: 6px;
    background: var(--bg2);
    color: var(--txth);
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
  }
  .chart-alerts-mobile-close i { font-size: 12px; }
  .chart-alert-main {
    flex-direction: column;
  }
  .chart-alert-side {
    width: 100%;
    align-items: center;
    justify-content: space-between;
  }
}

/* ── SIGNALS PANEL ── */
.signals-panel {
  border-top: 1px solid var(--brd);
  background: var(--bg3);
}
.signals-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  cursor: pointer;
  user-select: none;
  font-size: 11px;
  font-weight: 600;
  color: var(--txt2);
  text-transform: uppercase;
  letter-spacing: .5px;
  transition: color .15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.signals-toggle:hover { color: var(--txth); }
.signals-toggle .sig-badge {
  background: var(--acc);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  line-height: 1.4;
}
.signals-toggle .sig-badge.has-signals { background: var(--grn); }
.signals-toggle .sig-arrow { margin-left: auto; transition: transform .2s; font-size: 10px; }
.signals-toggle.open .sig-arrow { transform: rotate(180deg); }
.signals-body {
  display: none;
  padding: 8px 12px 12px;
  overflow-x: auto;
}
.signals-body.open { display: block; }

/* ── TECHNICAL RATING WIDGET ── */
#techRatingWidget {
  border-top: 1px solid var(--brd);
  background: var(--bg3);
}
.tr-toggle {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 12px; cursor: pointer; user-select: none;
  font-size: 11px; font-weight: 600; color: var(--txt2);
  text-transform: uppercase; letter-spacing: .5px;
  transition: color .15s; border: none; background: none;
  width: 100%; text-align: left;
}
.tr-toggle:hover { color: var(--txth); }
.tr-toggle .tr-summary {
  font-size: 10px; font-weight: 700; padding: 1px 8px;
  border-radius: 10px; line-height: 1.4; color: #fff;
}
.tr-toggle .sig-arrow { margin-left: auto; transition: transform .2s; font-size: 10px; }
.tr-toggle.open .sig-arrow { transform: rotate(180deg); }
.tr-body { padding: 10px 14px 14px; }

/* Gauge semicircle */
.tr-gauge-wrap { display: flex; align-items: flex-end; justify-content: center; gap: 32px; flex-wrap: wrap; margin-bottom: 14px; }
.tr-gauge { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.tr-gauge-label { font-size: 10px; font-weight: 700; color: var(--txt2); text-transform: uppercase; letter-spacing: .6px; }
.tr-gauge svg { overflow: visible; }
.tr-gauge-verdict { font-size: 11px; font-weight: 800; text-align: center; margin-top: 2px; }

/* Indicators grid */
.tr-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 600px) { .tr-grid { grid-template-columns: 1fr; } }
.tr-col-title { font-size: 10px; font-weight: 700; color: var(--txt2); text-transform: uppercase;
  letter-spacing: .7px; margin-bottom: 6px; padding-bottom: 4px; border-bottom: 1px solid var(--brd); }
.tr-row { display: flex; justify-content: space-between; align-items: center; padding: 3px 0;
  border-bottom: 1px solid rgba(42,58,90,.3); font-size: 11px; }
.tr-row:last-child { border-bottom: none; }
.tr-row-name { color: var(--txt2); }
.tr-row-val  { font-weight: 700; font-size: 10px; padding: 2px 7px; border-radius: 4px; }
.tr-ss { background: rgba(239,68,68,.2);  color: #ef4444; }
.tr-s  { background: rgba(249,115,22,.2); color: #f97316; }
.tr-h  { background: rgba(102,112,144,.2);color: var(--txt2); }
.tr-b  { background: rgba(34,197,94,.15); color: #22c55e; }
.tr-sb { background: rgba(34,197,94,.25); color: #16a34a; }

/* Summary counts */
.tr-counts { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 10px; font-size: 11px; }
.tr-count-chip { display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--bg2); border: 1px solid var(--brd); border-radius: 8px; padding: 6px 12px; min-width: 56px; }
.tr-count-chip .tc-num { font-size: 16px; font-weight: 800; line-height: 1; }
.tr-count-chip .tc-lbl { font-size: 9px; text-transform: uppercase; letter-spacing: .5px; color: var(--txt2); }
.sig-empty { font-size: 12px; color: var(--txt2); padding: 6px 0; }
.sig-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.sig-table th {
  text-align: left;
  padding: 4px 10px 4px 0;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--txt2);
  border-bottom: 1px solid var(--brd);
  white-space: nowrap;
}
.sig-table td {
  padding: 5px 10px 5px 0;
  border-bottom: 1px solid var(--brd);
  color: var(--txth);
  vertical-align: middle;
  white-space: nowrap;
}
.sig-table tr:last-child td { border-bottom: none; }
.sig-table tr:hover td { background: var(--bgi); }
.sig-strategy-badge {
  display: inline-block;
  background: rgba(41,98,255,.15);
  color: var(--acc);
  border: 1px solid rgba(41,98,255,.3);
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  white-space: nowrap;
}
body.theme-trader .sig-strategy-badge {
  background: rgba(0,255,65,.1);
  color: var(--acc);
  border-color: rgba(0,255,65,.3);
}
.sig-date  { color: var(--txt2); font-size: 10px; font-family: 'Roboto Mono','Courier New',monospace; }
.sig-price { font-family: 'Roboto Mono','Courier New',monospace; font-weight: 600; }
.sig-tf    { font-size: 10px; color: var(--txt2); }
.sig-loading { font-size: 11px; color: var(--txt2); padding: 6px 0; display: flex; align-items: center; gap: 8px; }

/* ── STRATEGY MATCH INDICATOR ── */
.chart-strategies-indicator{position:relative;overflow:visible}
.chart-strategies-indicator .chart-strategies-count{position:absolute;right:-5px;top:-5px;min-width:15px;height:15px;padding:0 3px;border:2px solid var(--bg2);border-radius:999px;background:var(--acc);color:#fff;font:800 9px/15px var(--sans,Arial,sans-serif);text-align:center;box-sizing:content-box}
.chart-strategies-indicator.has-strategies{border-color:color-mix(in srgb,var(--grn) 62%,var(--brd) 38%);background:color-mix(in srgb,var(--grn) 14%,var(--bgi) 86%);color:var(--grn);box-shadow:0 0 0 1px color-mix(in srgb,var(--grn) 18%,transparent),0 0 14px color-mix(in srgb,var(--grn) 26%,transparent)}
.chart-strategies-indicator.has-strategies .chart-strategies-count{background:var(--grn)}
.chart-strategies-indicator[data-tooltip]:hover::after,.chart-strategies-indicator[data-tooltip]:focus-visible::after{content:attr(data-tooltip);position:absolute;right:0;top:calc(100% + 9px);z-index:9800;width:max-content;max-width:min(310px,calc(100vw - 28px));padding:10px 12px;border:1px solid color-mix(in srgb,var(--grn) 42%,var(--brd) 58%);border-radius:8px;background:var(--bg2);color:var(--txt);box-shadow:0 12px 30px rgba(0,0,0,.30);font:600 11px/1.55 var(--sans,Arial,sans-serif);white-space:pre-line;text-align:left;pointer-events:none}
.chart-strategies-indicator[data-tooltip]:hover::before,.chart-strategies-indicator[data-tooltip]:focus-visible::before{content:"";position:absolute;right:10px;top:calc(100% + 3px);z-index:9801;width:10px;height:10px;border-top:1px solid color-mix(in srgb,var(--grn) 42%,var(--brd) 58%);border-left:1px solid color-mix(in srgb,var(--grn) 42%,var(--brd) 58%);background:var(--bg2);transform:rotate(45deg);pointer-events:none}

/* ── MA/EMA LEGEND OVERLAY sul grafico ── */
#maLegend {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 30;
  display: none;
  flex-direction: column;
  gap: 3px;
  pointer-events: none;
  user-select: none;
}
.ma-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(10, 14, 20, 0.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 4px;
  padding: 2px 7px 2px 5px;
  font-size: 11px;
  font-weight: 600;
  font-family: 'Roboto Mono','Courier New', monospace;
  letter-spacing: 0.2px;
  line-height: 1.5;
  border: 1px solid rgba(255,255,255,0.05);
  white-space: nowrap;
}
.ma-legend-swatch {
  width: 12px;
  height: 2.5px;
  border-radius: 2px;
  flex-shrink: 0;
  display: inline-block;
}
#indicatorCloseLayer {
  position: absolute;
  inset: 0;
  z-index: 31;
  pointer-events: none;
}
#studyAlertMarkerLayer {
  position: absolute;
  inset: 0;
  /* Keep alert bells behind the price-axis badges when levels overlap. */
  z-index: 28;
  pointer-events: none;
}
body.chart-drawing-active #indicatorCloseLayer,
body.chart-drawing-active .indicator-close-btn,
body.chart-drawing-active #studyAlertMarkerLayer,
body.chart-drawing-active .study-alert-marker {
  pointer-events: none !important;
}
.indicator-close-btn {
  position: absolute;
  width: 22px;
  height: 22px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  background: rgba(12,16,24,.78);
  color: var(--txt2);
  font-size: 12px;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 6px 14px rgba(0,0,0,.24);
  transition: transform .12s ease, background .12s ease, color .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.indicator-close-btn:hover,
.indicator-close-btn:focus-visible {
  color: #fff;
  background: rgba(239,83,80,.95);
  border-color: rgba(239,83,80,.95);
  box-shadow: 0 8px 18px rgba(239,83,80,.28);
  transform: scale(1.04);
  outline: none;
}
body.theme-white .indicator-close-btn {
  background: rgba(255,255,255,.92);
  border-color: rgba(0,0,0,.08);
  color: var(--txt2);
}
body.theme-trader .indicator-close-btn {
  background: rgba(3,10,3,.9);
  border-color: rgba(0,255,65,.18);
  color: var(--acc);
}
.study-alert-marker {
  position: absolute;
  width: 22px;
  height: 22px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(245, 158, 11, .55);
  border-radius: 999px;
  background: rgba(14, 18, 28, .92);
  color: #f59e0b;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 8px 18px rgba(0,0,0,.28);
}
.study-alert-marker:hover,
.study-alert-marker:focus-visible {
  transform: scale(1.05);
  box-shadow: 0 10px 22px rgba(0,0,0,.34);
  outline: none;
}
.study-alert-marker.is-off {
  color: #9aa3b4;
  border-color: rgba(154, 163, 180, .35);
}
.study-alert-marker-price {
  border-radius: 8px;
  width: 24px;
  height: 24px;
  background: rgba(10, 14, 22, .52);
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
}
.study-alert-marker-price.is-price-above {
  color: #26c680;
  border-color: rgba(38, 198, 128, .34);
  box-shadow: 0 8px 18px rgba(20, 120, 82, .14);
}
.study-alert-marker-price.is-price-below {
  color: #ef5350;
  border-color: rgba(239, 83, 80, .34);
  box-shadow: 0 8px 18px rgba(150, 44, 54, .14);
}
.study-alert-marker-price.is-mixed {
  color: #60a5fa;
  border-color: rgba(96, 165, 250, .34);
  box-shadow: 0 8px 18px rgba(49, 98, 168, .14);
}
.study-alert-marker-count {
  position: absolute;
  right: -3px;
  top: -4px;
  min-width: 12px;
  height: 12px;
  padding: 0 3px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 9px;
  line-height: 12px;
  font-weight: 800;
}
.study-alert-marker-tooltip {
  position: fixed;
  z-index: 9700;
  display: none;
  /* The tooltip may overlap its bell marker; it must not steal hover from it. */
  pointer-events: none;
  min-width: 240px;
  max-width: min(360px, calc(100vw - 24px));
  background: var(--bg2);
  color: var(--txt);
  border: 1px solid var(--brd2);
  border-radius: 10px;
  box-shadow: 0 18px 42px rgba(0,0,0,.36);
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.45;
}
.study-alert-marker-tooltip.show {
  display: block;
}
.study-alert-marker-tooltip::after {
  content: "";
  position: absolute;
  left: var(--tooltip-arrow-left, 50%);
  top: 100%;
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-top-color: var(--brd2);
}
.study-alert-marker-tooltip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.study-alert-marker-tooltip-head strong {
  color: var(--txth);
  font-size: 13px;
}
.study-alert-marker-tooltip-head span {
  color: var(--txt2);
  font-size: 11px;
  white-space: nowrap;
}
.study-alert-marker-tooltip-item + .study-alert-marker-tooltip-item {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--brd);
}
.study-alert-marker-tooltip-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--txth);
  font-weight: 700;
}
.study-alert-marker-tooltip-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 18px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .35px;
}
.study-alert-marker-tooltip-pill.is-on {
  background: rgba(38, 166, 154, .16);
  color: #26a69a;
}
.study-alert-marker-tooltip-pill.is-off {
  background: rgba(154, 163, 180, .14);
  color: #9aa3b4;
}
.study-alert-marker-tooltip-sub {
  margin-top: 2px;
  color: var(--txt2);
}
.study-alert-marker-tooltip-note {
  margin-top: 6px;
  color: var(--txt);
}
.chart-insider-marker-layer {
  position: absolute;
  inset: 0;
  z-index: 18;
  pointer-events: none;
}
.chart-trade-marker-layer {
  position: absolute;
  inset: 0;
  z-index: 42;
  pointer-events: none;
}
.chart-trade-marker {
  position: absolute;
  transform: translate(-50%, 0);
  width: 26px;
  height: 22px;
  padding: 0;
  border: 1px solid rgba(255,255,255,.38);
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 3px 10px rgba(0,0,0,.28);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}
.chart-trade-marker.is-win { background: linear-gradient(180deg, rgba(34,197,94,.98), rgba(21,128,61,.98)); border-color: rgba(134,239,172,.72); }
.chart-trade-marker.is-loss { background: linear-gradient(180deg, rgba(239,68,68,.98), rgba(153,27,27,.98)); border-color: rgba(252,165,165,.72); }
.chart-trade-marker.is-flat { background: linear-gradient(180deg, rgba(100,116,139,.98), rgba(71,85,105,.98)); border-color: rgba(203,213,225,.58); }
body.chart-panel-maximized .chart-insider-tooltip,
body.chart-panel-supermaximized .chart-insider-tooltip {
  z-index: 15050;
}
.chart-trade-marker span { font-size: 9px; font-weight: 800; }

/* ── TRADE LIST PANEL ── */
.chart-trade-list-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 14000;
  background: rgba(0,0,0,.48);
  backdrop-filter: blur(2px);
}
.chart-trade-list-overlay.open { display: block; }
.chart-trade-list-panel {
  display: none;
  position: fixed;
  z-index: 14001;
  left: 50%;
  top: 50%;
  width: min(1180px, calc(100vw - 28px));
  max-height: min(720px, calc(100vh - 42px));
  transform: translate(-50%, -50%);
  overflow: hidden;
  color: var(--txt);
  background: var(--bg2);
  border: 1px solid var(--brd);
  border-radius: 10px;
  box-shadow: 0 18px 60px rgba(0,0,0,.45);
}
.chart-trade-list-panel.open { display: flex; flex-direction: column; }
.chart-trade-list-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px 13px;
  border-bottom: 1px solid var(--brd);
  background: color-mix(in srgb, var(--bg2) 88%, var(--acc));
}
.chart-trade-list-kicker {
  color: var(--txt2);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .8px;
  text-transform: uppercase;
}
.chart-trade-list-head h3 { margin: 3px 0 2px; color: var(--txth); font-size: 16px; }
.chart-trade-list-head h3 i { margin-right: 6px; color: var(--acc); }
.chart-trade-list-subtitle { color: var(--txt2); font-size: 11px; }
.chart-trade-list-close {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--brd);
  border-radius: 5px;
  background: transparent;
  color: var(--txt2);
  font-size: 21px;
  line-height: 24px;
  cursor: pointer;
}
.chart-trade-list-close:hover { color: var(--txth); border-color: var(--brd2); background: var(--bgi); }
.chart-trade-list-body { min-height: 0; padding: 12px 14px 14px; overflow: auto; }
.chart-trade-list-meta { margin: 0 0 9px; color: var(--txt2); font-size: 10px; }
.chart-trade-list-empty { display: none; padding: 38px 12px; color: var(--txt2); text-align: center; font-size: 12px; }
.chart-trade-list-empty.show { display: block; }
.chart-trade-list-table-wrap { overflow: auto; }
.chart-trade-list-table { width: 100%; min-width: 930px; border-collapse: collapse; font-size: 10px; }
.chart-trade-list-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 8px 9px;
  border-bottom: 1px solid var(--brd2);
  background: var(--bg2);
  color: var(--txt2);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .35px;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
.chart-trade-list-table td { padding: 9px; border-bottom: 1px solid color-mix(in srgb, var(--brd) 72%, transparent); color: var(--txt); white-space: nowrap; }
.chart-trade-list-table tbody tr:hover td { background: color-mix(in srgb, var(--bgi) 80%, var(--acc)); }
.chart-trade-list-table .trade-side { font-weight: 800; }
.chart-trade-list-table .trade-side.is-long { color: #22c55e; }
.chart-trade-list-table .trade-side.is-short { color: #f97316; }
.chart-trade-list-table .trade-product { max-width: 260px; overflow: hidden; text-overflow: ellipsis; color: var(--txth); }
.chart-trade-list-table .trade-pnl { font-weight: 800; }
.chart-trade-list-table .trade-pnl.is-positive, .chart-trade-list-table .trade-pnl-pct.is-positive { color: #22c55e; }
.chart-trade-list-table .trade-pnl.is-negative, .chart-trade-list-table .trade-pnl-pct.is-negative { color: #ef4444; }
.chart-trade-list-table .trade-pnl.is-flat, .chart-trade-list-table .trade-pnl-pct.is-flat { color: var(--txt2); }
body.chart-panel-supermaximized .chart-trade-list-panel,
body.chart-panel-supermaximized .chart-trade-list-overlay,
body.chart-panel-maximized .chart-trade-list-panel,
body.chart-panel-maximized .chart-trade-list-overlay { z-index: 15000; }
@media (max-width: 700px) {
  .chart-trade-list-panel { width: calc(100vw - 16px); max-height: calc(100vh - 20px); }
  .chart-trade-list-head { padding: 13px 12px 11px; }
  .chart-trade-list-body { padding: 10px 8px; }
}
.chart-insider-marker {
  position: absolute;
  transform: translate(-50%, 0);
  width: var(--insider-marker-size, 24px);
  min-width: var(--insider-marker-size, 24px);
  height: var(--insider-marker-size, 24px);
  padding: 0 7px;
  box-sizing: border-box;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-shadow: 0 8px 20px rgba(0,0,0,.26);
  pointer-events: auto;
  cursor: pointer;
  color: #fff;
}
.chart-insider-marker i {
  font-size: 11px;
}
.chart-insider-marker.is-buy {
  background: linear-gradient(180deg, rgba(34,197,94,.96), rgba(22,163,74,.96));
  border-color: rgba(134,239,172,.42);
}
.chart-insider-marker.is-buy.is-amount-1 {
  background: linear-gradient(180deg, rgba(134,239,172,.92), rgba(74,222,128,.92));
  border-color: rgba(187,247,208,.72);
}
.chart-insider-marker.is-buy.is-amount-2 {
  background: linear-gradient(180deg, rgba(74,222,128,.94), rgba(34,197,94,.94));
}
.chart-insider-marker.is-buy.is-amount-3 {
  background: linear-gradient(180deg, rgba(34,197,94,.96), rgba(22,163,74,.96));
}
.chart-insider-marker.is-buy.is-amount-4,
.chart-insider-marker.is-buy.is-amount-5 {
  background: linear-gradient(180deg, rgba(22,163,74,.98), rgba(21,128,61,.98));
  border-color: rgba(134,239,172,.64);
}
.chart-insider-marker.is-sell {
  background: linear-gradient(180deg, rgba(239,68,68,.96), rgba(220,38,38,.96));
  border-color: rgba(252,165,165,.42);
}
.chart-insider-marker.is-sell.is-amount-1 {
  background: linear-gradient(180deg, rgba(252,165,165,.92), rgba(248,113,113,.92));
  border-color: rgba(254,202,202,.74);
}
.chart-insider-marker.is-sell.is-amount-2 {
  background: linear-gradient(180deg, rgba(248,113,113,.94), rgba(239,68,68,.94));
}
.chart-insider-marker.is-sell.is-amount-3 {
  background: linear-gradient(180deg, rgba(239,68,68,.96), rgba(220,38,38,.96));
}
.chart-insider-marker.is-sell.is-amount-4,
.chart-insider-marker.is-sell.is-amount-5 {
  background: linear-gradient(180deg, rgba(220,38,38,.98), rgba(153,27,27,.98));
  border-color: rgba(252,165,165,.64);
}
.chart-insider-marker.is-mixed {
  background: linear-gradient(180deg, rgba(245,158,11,.96), rgba(234,88,12,.96));
  border-color: rgba(253,186,116,.42);
}
.chart-insider-marker-count {
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}
.chart-insider-tooltip {
  position: fixed;
  z-index: 9800;
  width: min(280px, calc(100vw - 20px));
  max-width: 280px;
  max-height: min(70vh, calc(100vh - 24px));
  border-radius: 10px;
  border: 1px solid var(--brd2);
  background: color-mix(in srgb, var(--bg2) 96%, #000 4%);
  box-shadow: 0 16px 36px rgba(0,0,0,.38);
  color: var(--txt);
  padding: 8px 9px;
  display: none;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  pointer-events: auto;
}
.chart-insider-tooltip.show {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}
.chart-insider-tooltip::after {
  content: "";
  position: absolute;
  left: var(--tooltip-arrow-left, 28px);
  top: 100%;
  width: 10px;
  height: 10px;
  transform: translate(-50%, -50%) rotate(45deg);
  background: inherit;
  border-right: 1px solid var(--brd2);
  border-bottom: 1px solid var(--brd2);
}
.chart-insider-tooltip-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.chart-insider-tooltip-head strong {
  color: var(--txth);
  font-size: 12px;
  line-height: 1.15;
}
.chart-insider-tooltip-head span {
  color: var(--txt2);
  font-size: 10px;
  line-height: 1.1;
}
.chart-insider-tooltip-item + .chart-insider-tooltip-item {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(255,255,255,.045);
}
.chart-insider-tooltip-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}
.chart-insider-tooltip-title strong {
  color: var(--txth);
  font-size: 11px;
  line-height: 1.15;
}
.chart-insider-tooltip-count {
  margin-left: auto;
  color: var(--txt2);
  font-size: 9px;
  white-space: nowrap;
}
.chart-insider-tooltip-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 15px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #fff;
}
.chart-insider-tooltip-pill.is-buy {
  background: rgba(22,163,74,.94);
}
.chart-insider-tooltip-pill.is-sell {
  background: rgba(220,38,38,.94);
}
.chart-insider-tooltip-sub {
  color: var(--txt2);
  font-size: 10px;
  line-height: 1.25;
}
body.theme-white .ma-legend-item {
  background: rgba(240, 243, 248, 0.80);
  border-color: rgba(0,0,0,0.07);
}
body.theme-trader .ma-legend-item {
  background: rgba(2, 12, 2, 0.75);
  border-color: rgba(0,255,65,0.1);
  font-family: 'Courier New', monospace !important;
}
#maAxisLabels {
  position: absolute;
  inset: 0;
  z-index: 29;
  pointer-events: none;
  user-select: none;
}
.ma-axis-label {
  position: absolute;
  right: 8px;
  transform: translateY(-50%);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 2px 4px 1px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  font-family: 'Roboto Mono','Courier New', monospace;
  line-height: 1.05;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,.16);
  border: 1px solid transparent;
}
.ma-axis-label.current-price-axis-label {
  z-index: 3;
  min-width: 56px;
  box-shadow: 0 4px 12px rgba(0,0,0,.28);
}
.ma-axis-label.cursor-axis-label {
  z-index: 4;
  min-width: 64px;
  padding: 3px 6px 2px;
  box-shadow: 0 6px 18px rgba(0,0,0,.34);
}
.ma-axis-label-value {
  display: block;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}
.ma-axis-label-name {
  display: block;
  margin-top: 1px;
  font-size: 8px;
  font-weight: 600;
  line-height: 1;
  opacity: 0.9;
  letter-spacing: 0.02em;
}

/* ── CORRELATION POPUP ── */
#correlationOverlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0,0,0,.34);
}
#correlationBox {
  display: none;
}
.theme-dark #correlationBox,
body.theme-trader #correlationBox {
  background: linear-gradient(180deg, #111722 0%, #0b0f16 100%) !important;
  border-color: #243049 !important;
  box-shadow: 0 32px 84px rgba(0,0,0,.62), 0 0 0 1px rgba(255,255,255,.02) inset !important;
}
.theme-white #correlationBox {
  background: linear-gradient(180deg, #ffffff 0%, #f5f8fd 100%) !important;
  border-color: #d9e2f0 !important;
  box-shadow: 0 24px 70px rgba(18,31,55,.18), 0 0 0 1px rgba(255,255,255,.8) inset !important;
}
.theme-trader #correlationBox {
  background: linear-gradient(180deg, #030803 0%, #081208 100%) !important;
  border-color: rgba(0,255,65,.18) !important;
  box-shadow: 0 32px 84px rgba(0,0,0,.72), 0 0 0 1px rgba(0,255,65,.06) inset !important;
}
.correlation-summary-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  width: 100%;
  font-family: 'Roboto Mono','Courier New',monospace;
  font-size: 11px;
  line-height: 1.1;
  padding: 2px 0;
  white-space: nowrap;
}
.correlation-summary-line.base-row {
  color: var(--txth);
}
.corr-col {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.corr-col-label {
  flex: 1 1 46%;
  text-align: left;
  font-weight: 700;
}
.corr-col-r,
.corr-col-r2,
.corr-col-end {
  flex: 0 0 17%;
  text-align: right;
  color: var(--txth);
}
.corr-pill {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 1px 5px;
  border-radius: 999px;
  border: 1px solid var(--brd);
  font-size: 9px;
  line-height: 1;
  color: var(--txt2);
  text-transform: uppercase;
  letter-spacing: .35px;
}
.corr-pill-base {
  background: rgba(255,255,255,.03);
}
.correlation-summary-line.base-row .corr-col-r,
.correlation-summary-line.base-row .corr-col-r2,
.correlation-summary-line.base-row .corr-col-end {
  color: var(--txt2);
}
.correlation-legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--txt2);
  font-family: 'Roboto Mono','Courier New',monospace;
  white-space: nowrap;
}
.correlation-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex-shrink: 0;
}
@media (max-width: 820px) {
  #correlationSummary {
    gap: 5px;
  }
  .correlation-summary-line {
    font-size: 10px;
    gap: 6px;
  }
  .corr-col-r,
  .corr-col-r2,
  .corr-col-end {
    flex-basis: 18%;
  }
}

#chartWatermark {
  position: absolute;
  bottom: 26px;
  left: 16px;
  /* Keep the brand mark above the chart renderer and every in-chart overlay. */
  z-index: 1000;
  pointer-events: none;
  user-select: none;
  display: flex;
  align-items: baseline;
  opacity: 1;
}
.wm-g    { font-size: 22px; font-weight: 700; color: #4CAF50; font-family: 'Segoe UI', Tahoma, sans-serif; line-height: 1; }
.wm-rest { font-size: 22px; font-weight: 700; color: #ffffff; font-family: 'Segoe UI', Tahoma, sans-serif; line-height: 1; }
.wm-it   { font-size: 17px; font-weight: 400; color: #7dd67f; font-family: 'Segoe UI', Tahoma, sans-serif; font-style: italic; line-height: 1; margin-left: 1px; }
body.theme-white #chartWatermark .wm-rest { color: #1a2035; }
body.theme-white #chartWatermark .wm-it   { color: #3d9940; }
body.theme-trader #chartWatermark .wm-g   { color: #00ff41; }
body.theme-trader #chartWatermark .wm-rest{ color: #00d435; }
body.theme-trader #chartWatermark .wm-it  { color: #00a828; font-family: 'Courier New', monospace !important; }

/* ── INSIGHTS PANEL ── */
#insightsOverlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 8000;
  background: rgba(0,0,0,.45);
}
#insightsOverlay.open { display: block; }
#insightsPanel {
  position: fixed;
  top: 60px; right: 0;
  width: 420px;
  max-width: 96vw;
  height: calc(100vh - 60px);
  background: var(--bg2);
  border-left: 1px solid var(--brd);
  z-index: 8001;
  display: flex;
  flex-direction: column;
  box-shadow: -6px 0 32px rgba(0,0,0,.5);
  transform: translateX(100%);
  transition: transform .22s cubic-bezier(.4,0,.2,1);
}
#insightsPanel.open { transform: translateX(0); }
body.chart-panel-supermaximized #insightsOverlay {
  z-index: 10050;
}
body.chart-panel-supermaximized #insightsPanel {
  top: 0;
  height: 100vh;
  z-index: 10051;
}
.ins-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg3);
  border-bottom: 1px solid var(--brd);
  flex-shrink: 0;
}
.ins-head h3 { margin:0; font-size:14px; font-weight:700; color:var(--txth); display:flex; align-items:center; gap:7px; }
.ins-close { background:none; border:none; color:var(--txt2); font-size:18px; cursor:pointer; padding:2px 6px; border-radius:3px; line-height:1; }
.ins-close:hover { background:var(--bgi); color:var(--txth); }
.ins-body { flex:1; overflow-y:auto; padding:0; }
.ins-summary {
  margin: 14px 14px 10px;
  padding: 14px 14px 12px;
  border: 1px solid rgba(78, 146, 223, .45);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(78,146,223,.16) 0%, rgba(78,146,223,.06) 100%),
    var(--bg3);
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.ins-summary-title {
  display:flex;
  align-items:center;
  gap:8px;
  margin-bottom:10px;
  font-size:12px;
  font-weight:700;
  letter-spacing:.2px;
  color:var(--txth);
}
.ins-summary-title i { color:#69a8ff; }
.ins-summary-tabs {
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-bottom:12px;
}
.ins-summary-tab {
  display:inline-flex;
  flex-direction:column;
  align-items:flex-start;
  gap:2px;
  min-width:110px;
  padding:8px 10px;
  border:1px solid rgba(105,168,255,.22);
  border-radius:9px;
  background:rgba(255,255,255,.03);
  color:var(--txt2);
  font-size:11px;
  font-weight:700;
  cursor:pointer;
  transition:all .14s ease;
}
.ins-summary-tab span {
  font-size:10px;
  color:var(--txt2);
  opacity:.88;
}
.ins-summary-tab:hover,
.ins-summary-tab:focus-visible {
  border-color:rgba(105,168,255,.42);
  color:var(--txth);
  background:rgba(105,168,255,.08);
  outline:none;
}
.ins-summary-tab.active {
  border-color:rgba(105,168,255,.56);
  background:rgba(105,168,255,.14);
  color:#dcecff;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.05);
}
.ins-summary-tab.active span { color:#aecdff; }
.ins-summary-panel { display:none; }
.ins-summary-panel.active { display:block; }
.ins-summary-subtitle {
  margin-bottom:10px;
  font-size:11px;
  font-weight:700;
  letter-spacing:.2px;
  color:#c7d7ef;
}
.ins-summary-pills {
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  margin-bottom:10px;
}
.ins-summary-copy p {
  margin:0 0 8px;
  color:var(--txt);
  font-size:12px;
  line-height:1.5;
}
.ins-summary-copy p:last-child { margin-bottom:0; }
.ins-section { border-bottom: 1px solid var(--brd); }
.ins-section-title {
  font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.8px;
  color:var(--txt2); padding:8px 16px 4px;
  display: flex; align-items: center; gap: 6px;
}
.ins-section-title i { font-size:11px; color:var(--acc); }
.ins-table { width:100%; border-collapse:collapse; }
.ins-table tr:hover td { background:var(--bgi); }
.ins-table td {
  padding: 5px 16px;
  font-size: 12px;
  border-bottom: 1px solid rgba(255,255,255,.03);
  vertical-align: middle;
}
.ins-table tr:last-child td { border-bottom:none; }
.ins-metric { color:var(--txt); width:55%; }
.ins-value  { color:var(--txth); font-weight:600; font-family:'Roboto Mono','Courier New',monospace; font-size:11px; text-align:right; }
.ins-bar-wrap { display:flex; align-items:center; gap:6px; }
.ins-bar { height:4px; border-radius:2px; flex-shrink:0; }
.ins-badge {
  display:inline-block; padding:1px 7px; border-radius:3px;
  font-size:10px; font-weight:700; white-space:nowrap;
}
.ins-badge.bull  { background:rgba(38,166,154,.18); color:var(--grn); }
.ins-badge.bear  { background:rgba(239,83,80,.18);  color:var(--red); }
.ins-badge.neut  { background:rgba(144,152,168,.15); color:var(--txt); }
.ins-loading { display:flex; align-items:center; justify-content:center; gap:10px; padding:40px; color:var(--txt2); font-size:12px; }
.ins-ticker-label { font-size:12px; color:var(--txt2); margin-left:6px; font-weight:400; }
.ins-computed { font-size:10px; color:var(--txt2); padding:8px 16px 10px; text-align:right; }

/* ══════════════════════════════════════════════════════════
   FUNDAMENTALS PANEL
══════════════════════════════════════════════════════════ */
#fundOverlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 8100;
  background: rgba(0,0,0,.45);
}
#fundOverlay.open { display: block; }
#fundPanel {
  position: fixed;
  top: 50%; left: 50%;
  width: min(920px, calc(100vw - 24px));
  max-width: 920px;
  height: min(820px, calc(100vh - 100px));
  background: var(--bg2);
  border: 1px solid var(--brd);
  z-index: 8101;
  display: flex;
  flex-direction: column;
  box-shadow: 0 18px 55px rgba(0,0,0,.55);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, -46%) scale(.98);
  transition: opacity .18s ease, transform .18s ease, visibility 0s linear .18s;
  overflow: hidden;
}
#fundPanel.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
  transition-delay: 0s;
}
#fundPanel.is-dragged { transition: none; }
#fundPanel .fund-head { cursor: default; }
#fundDrag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  margin-right: 2px;
  color: var(--txt2);
  border-radius: 4px;
  cursor: move;
  touch-action: none;
  user-select: none;
}
#fundDrag:hover, #fundDrag:focus-visible { background: var(--bgi); color: var(--txth); outline: none; }
#techRatingOverlay { display:none; position:fixed; inset:0; z-index:8100; background:rgba(0,0,0,.45); }
#techRatingOverlay.open { display:block; }
#techRatingPanel { position:fixed; top:60px; right:0; width:680px; max-width:98vw; height:calc(100vh - 60px); z-index:8101; background:var(--bg2); border-left:1px solid var(--brd2); box-shadow:-6px 0 32px rgba(0,0,0,.55); transform:translateX(100%); transition:transform .22s cubic-bezier(.4,0,.2,1); overflow:auto; }
#techRatingPanel.open { transform:translateX(0); }
.tech-rating-intro { padding:10px 14px; color:var(--txt2); font-size:12px; border-bottom:1px solid var(--brd); }
.tech-rating-body { padding:16px; }
body.chart-panel-supermaximized #fundOverlay {
  z-index: 10060;
}
body.chart-panel-supermaximized #fundPanel {
  top: 50%;
  left: 50%;
  width: min(1100px, calc(100vw - 24px));
  height: 100vh;
  z-index: 10061;
}
body.chart-panel-supermaximized #techRatingOverlay { z-index:10060; }
body.chart-panel-supermaximized #techRatingPanel { top:0; height:100vh; z-index:10061; }
@media(max-width:768px) {
  #insightsPanel,
  #newsPanel,
  #techRatingPanel {
    top: 58px;
    height: calc(100vh - 58px);
  }
  #fundPanel {
    top: 50%;
    left: 50%;
    width: calc(100vw - 16px);
    height: calc(100vh - 76px);
    max-height: none;
  }
}
.fund-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg3);
  border-bottom: 1px solid var(--brd);
  flex-shrink: 0;
}
.fund-head h3 { margin:0; font-size:14px; font-weight:700; color:var(--txth); display:flex; align-items:center; gap:7px; }
.fund-close { background:none; border:none; color:var(--txt2); font-size:18px; cursor:pointer; padding:2px 6px; border-radius:3px; line-height:1; }
.fund-close:hover { background:var(--bgi); color:var(--txth); }
/* ── Tabs ── */
.fund-tabs {
  display: flex;
  border-bottom: 1px solid var(--brd);
  background: var(--bg3);
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--brd2) var(--bg3);
  overscroll-behavior-x: contain;
}
.fund-tabs::-webkit-scrollbar { height: 7px; }
.fund-tabs::-webkit-scrollbar-track { background: var(--bg3); }
.fund-tabs::-webkit-scrollbar-thumb { background: var(--brd2); border-radius: 4px; }
.fund-tabs::-webkit-scrollbar-thumb:hover { background: var(--acc); }
.fund-tab {
  flex: 0 0 auto;
  padding: 8px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--txt2);
  cursor: pointer;
  border: none;
  background: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.fund-tab:hover { color: var(--txth); }
.fund-tab.active { color: var(--acc); border-bottom-color: var(--acc); }
/* ── Period toggle ── */
.fund-period-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  background: var(--bg2);
  border-bottom: 1px solid var(--brd);
  flex-shrink: 0;
}
.fund-period-bar span { font-size:10px; color:var(--txt2); text-transform:uppercase; letter-spacing:.5px; margin-right:4px; }
.fund-pbtn {
  padding: 2px 10px;
  font-size: 10px;
  font-weight: 600;
  border-radius: 3px;
  border: 1px solid var(--brd);
  background: none;
  color: var(--txt2);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.fund-pbtn:hover { background: var(--bgi); color: var(--txth); }
.fund-pbtn.active { background: var(--acc); color: #fff; border-color: var(--acc); }

/* ── View toggle (Sparkline / Table) ── */
.fund-view-toggle {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--brd);
  border-radius: 4px;
  overflow: hidden;
}
.fund-vbtn {
  padding: 3px 10px;
  font-size: 10px;
  font-weight: 600;
  border: none;
  background: none;
  color: var(--txt2);
  cursor: pointer;
  transition: background .15s, color .15s;
  display: flex; align-items: center; gap: 5px;
  white-space: nowrap;
}
.fund-vbtn + .fund-vbtn { border-left: 1px solid var(--brd); }
.fund-vbtn:hover { background: var(--bgi); color: var(--txth); }
.fund-vbtn.active { background: var(--bg3); color: var(--txth); }
.fund-vbtn svg { width:12px; height:12px; flex-shrink:0; }

/* ── Body ── */
.fund-body { flex:1; overflow-y:auto; overflow-x:hidden; padding: 0; }
.fund-extra-kpis { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; padding:10px 12px; border-bottom:1px solid var(--brd); }
.fund-extra-kpi { min-width:0; padding:8px 9px; border:1px solid var(--brd); border-radius:4px; background:var(--bg3); }
.fund-extra-kpi span { display:block; color:var(--txt2); font-size:9px; font-weight:700; letter-spacing:.35px; text-transform:uppercase; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.fund-extra-kpi strong { display:block; margin-top:4px; color:var(--txth); font:700 13px/1.1 'Roboto Mono','Courier New',monospace; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.fund-extra-card { margin:10px 12px; border:1px solid var(--brd); border-radius:4px; background:var(--bg2); overflow:hidden; }
.fund-extra-title { display:flex; align-items:baseline; justify-content:space-between; gap:8px; padding:9px 10px; border-bottom:1px solid var(--brd); background:var(--bg3); color:var(--txth); font-size:12px; }
.fund-extra-title span { color:var(--txt2); font-size:10px; font-weight:500; text-align:right; }
.fund-extra-table-wrap { overflow:auto; max-height:300px; }
.fund-extra-table { width:100%; min-width:560px; border-collapse:collapse; font-size:10px; }
.fund-extra-table th { position:sticky; top:0; z-index:1; padding:7px 8px; background:var(--bgi); color:var(--txt2); font-size:9px; font-weight:700; letter-spacing:.3px; text-align:right; text-transform:uppercase; white-space:nowrap; }
.fund-extra-table th:first-child,.fund-extra-table td:first-child { text-align:left; }
.fund-extra-table td { padding:7px 8px; border-top:1px solid var(--brd); color:var(--txt); text-align:right; white-space:nowrap; font-variant-numeric:tabular-nums; }
.fund-extra-table tbody tr:hover td { background:var(--bg3); color:var(--txth); }
.fund-extra-table a { color:var(--acc); font-weight:700; text-decoration:none; }
.fund-extra-table a:hover { text-decoration:underline; }
.fund-extra-empty { padding:24px 14px; color:var(--txt2); font-size:11px; text-align:center; }
.fund-extra-empty i { display:block; margin-bottom:7px; color:var(--acc); font-size:18px; }
@media(max-width:520px) { .fund-extra-kpis { grid-template-columns:repeat(2,minmax(0,1fr)); } .fund-extra-card { margin:8px; } .fund-extra-title { align-items:flex-start; flex-direction:column; gap:3px; } .fund-extra-title span { text-align:left; } }

/* ══════════════════════════════════════════════════════════
   NEWS PANEL
══════════════════════════════════════════════════════════ */
#newsOverlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 8200;
  background: rgba(0,0,0,.45);
}
#newsOverlay.open { display: block; }
#newsPanel {
  position: fixed;
  top: 60px; right: 0;
  width: 520px;
  max-width: 98vw;
  height: calc(100vh - 60px);
  background: var(--bg2);
  border-left: 1px solid var(--brd);
  z-index: 8201;
  display: flex;
  flex-direction: column;
  box-shadow: -6px 0 32px rgba(0,0,0,.55);
  transform: translateX(100%);
  transition: transform .22s cubic-bezier(.4,0,.2,1);
}
#newsPanel.open { transform: translateX(0); }
body.chart-panel-supermaximized #newsOverlay {
  z-index: 10070;
}
body.chart-panel-supermaximized #newsPanel {
  top: 0;
  height: 100vh;
  z-index: 10071;
}
.news-head {
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:10px 16px;
  background:var(--bg3);
  border-bottom:1px solid var(--brd);
  flex-shrink:0;
}
.news-head h3 { margin:0; font-size:14px; font-weight:700; color:var(--txth); display:flex; align-items:center; gap:7px; }
.news-close { background:none; border:none; color:var(--txt2); font-size:18px; cursor:pointer; padding:2px 6px; border-radius:3px; line-height:1; }
.news-close:hover { background:var(--bgi); color:var(--txth); }
.news-meta {
  display:flex;
  align-items:center;
  justify-content:flex-start;
  gap:12px;
  padding:8px 16px;
  border-bottom:1px solid var(--brd);
  background:var(--bg2);
  color:var(--txt2);
  font-size:11px;
}
.news-body {
  flex:1;
  overflow-y:auto;
  padding:14px;
}
.news-list {
  display:flex;
  flex-direction:column;
  gap:12px;
}
.news-card {
  padding:14px;
  border:1px solid var(--brd);
  border-radius:12px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.01)),
    var(--bg3);
  box-shadow:0 10px 26px rgba(0,0,0,.14);
}
.news-card-top,
.news-card-bottom {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}
.news-source,
.news-date,
.news-host,
.news-open {
  font-size:11px;
  color:var(--txt2);
}
.news-source {
  font-weight:700;
  color:var(--txth);
}
.news-title {
  display:block;
  margin:8px 0 9px;
  color:var(--txth);
  text-decoration:none;
  font-size:15px;
  line-height:1.4;
  font-weight:700;
}
.news-title:hover {
  color:var(--acc);
}
.news-summary {
  color:var(--txt);
  font-size:12px;
  line-height:1.55;
}
.news-open {
  font-weight:700;
  color:var(--acc);
}
.news-loading,
.news-empty {
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  padding:40px 20px;
  color:var(--txt2);
  font-size:12px;
  text-align:center;
}

/* ── Table view ── */
.fund-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.fund-table-wrap::-webkit-scrollbar { height: 5px; }
.fund-table-wrap::-webkit-scrollbar-track { background: var(--bg2); }
.fund-table-wrap::-webkit-scrollbar-thumb { background: var(--brd); border-radius: 3px; }
.fund-stats-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
  min-width: max-content;
}
.fund-stats-table th {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--txt2);
  padding: 7px 14px 5px;
  text-align: right;
  border-bottom: 2px solid var(--brd);
  background: var(--bg3);
  position: sticky;
  top: 0;
  z-index: 2;
  white-space: nowrap;
  min-width: 72px;
}
.fund-stats-table th:first-child {
  text-align: left;
  min-width: 130px;
  position: sticky;
  left: 0;
  z-index: 4;
}
.fund-stats-table td {
  padding: 7px 14px;
  font-size: 12px;
  border-bottom: 1px solid rgba(255,255,255,.04);
  vertical-align: middle;
  white-space: nowrap;
  text-align: right;
  font-family: 'Roboto Mono','Courier New',monospace;
  color: var(--txth);
}
.fund-stats-table tr:hover td { background: var(--bgi); }
.fund-stats-table td:first-child {
  text-align: left;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--txt2);
  position: sticky;
  left: 0;
  background: var(--bg2);
  z-index: 1;
}
.fund-stats-table tr:hover td:first-child { background: var(--bgi); }
/* colonna più recente evidenziata */
.fund-stats-table td.fund-col-latest,
.fund-stats-table th.fund-col-latest {
  color: var(--txth);
  font-weight: 700;
}
.fund-stats-table th.fund-col-latest { color: var(--acc); }
/* ── Chart container ── */
.fund-chart-wrap {
  position: relative;
  padding: 12px 14px 4px;
  border-bottom: 1px solid var(--brd);
}
.fund-chart-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--txt2);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.fund-chart-title .fund-chart-legend {
  display: flex; gap: 10px; margin-left: auto;
}
.fund-legend-item {
  display: flex; align-items: center; gap: 4px;
  font-size: 10px; color: var(--txt2);
}
.fund-legend-dot {
  width: 10px; height: 10px; border-radius: 2px;
}
.fund-legend-line {
  width: 16px; height: 2px; border-radius: 1px;
}
.fund-canvas-container { position: relative; height: 180px; }
/* ── Metric list con sparkline ── */
.fund-metric-list {
  padding: 4px 0 8px;
}
.fund-metric-row {
  display: grid;
  grid-template-columns: 130px 88px 1fr auto;
  align-items: center;
  gap: 0 8px;
  padding: 8px 16px;
  border-bottom: 1px solid rgba(255,255,255,.04);
  transition: background .1s;
}
.fund-metric-row:hover { background: var(--bgi); }
.fund-metric-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--txt2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fund-metric-spark {
  display: flex;
  align-items: center;
  opacity: .85;
}
.fund-metric-spark svg { display: block; }
.fund-metric-val {
  font-size: 14px;
  font-weight: 700;
  color: var(--txth);
  text-align: right;
  font-family: 'Roboto Mono','Courier New',monospace;
  white-space: nowrap;
}
.fund-metric-yoy {
  font-size: 11px;
  font-weight: 600;
  text-align: right;
  width: 56px;
  white-space: nowrap;
  font-family: 'Roboto Mono','Courier New',monospace;
}
.fund-val-pos { color: #26a69a !important; }
.fund-val-neg { color: #ef5350 !important; }

.fund-loading {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; padding: 40px; color: var(--txt2); font-size: 13px;
}
.fund-empty {
  padding: 30px 20px; text-align: center; color: var(--txt2); font-size: 13px;
}
.fund-empty i { font-size: 32px; margin-bottom: 10px; display: block; color: var(--brd); }

/* ── Mobile overrides ── */
@media (max-width: 768px) {
  .fund-metric-row {
    grid-template-columns: 105px 68px 1fr auto;
    padding: 7px 12px;
    gap: 0 6px;
  }
  .fund-metric-label { font-size: 12px; }
  .fund-metric-val   { font-size: 13px; }
  .fund-metric-yoy   { font-size: 10px; width: 46px; }

  .fund-vbtn { padding: 3px 8px; font-size: 10px; }
  .fund-stats-table th,
  .fund-stats-table td { padding: 6px 10px; font-size: 11px; }
  .fund-stats-table th:first-child,
  .fund-stats-table td:first-child { min-width: 110px; }
}
.chart-page {
  --bg:#f7f8fa; --bg2:#ffffff; --bg3:#f0f2f5; --bgi:#ebeef2;
  --brd:#dde2ec; --brd2:#c8d0e0;
  --txt:#5c6680; --txt2:#9098a8; --txth:#1a2035;
  --acc:#2962ff; --grn:#26a69a; --red:#ef5350;
  --nav:#1a2035;
}
body.theme-dark .chart-page {
  --bg:#0b0e11; --bg2:#131722; --bg3:#0d1017; --bgi:#1c2030;
  --brd:#1e2433; --brd2:#2a3350;
  --txt:#9098a8; --txt2:#5c6680; --txth:#d1d5dc;
  --acc:#2962ff; --grn:#26a69a; --red:#ef5350;
  --nav:#0d1017;
}
body.theme-trader .chart-page {
  --bg:#020c02; --bg2:#050f05; --bg3:#071207; --bgi:#0a1a0a;
  --brd:#0d2b0d; --brd2:#164016;
  --txt:#00d435; --txt2:#006820; --txth:#00ff41;
  --acc:#00ff41; --grn:#00ff41; --red:#ff3b3b;
  --nav:#020802;
}
body[data-page="chart"].chart-visual-theme-proTechnical .chart-page {
  --bg:#0b0d10; --bg2:#101419; --bg3:#0c1014; --bgi:#141a21;
  --brd:#232b36; --brd2:#344051;
  --txt:#96a2b4; --txt2:#647286; --txth:#d4dde8;
  --acc:#7ea6ff; --grn:#00c176; --red:#ff4d57;
  --nav:#0a0d11;
}
/* Paper is intentionally independent of the site-wide Light/Dark preference:
   it is a bright, print-like chart workspace with a white canvas. */
body[data-page="chart"].chart-visual-theme-paper,
body[data-page="chart"].chart-visual-theme-paper .chart-page {
  --bg:#ffffff; --bg2:#ffffff; --bg3:#f8fafc; --bgi:#eef2f7;
  --brd:#d8e0ea; --brd2:#b9c5d4;
  --txt:#475569; --txt2:#64748b; --txth:#172033;
  --acc:#2563eb; --grn:#14804a; --red:#d14343;
  --nav:#172033;
}
body[data-page="chart"].chart-visual-theme-paper { background:#ffffff; }
body[data-page="chart"].chart-visual-theme-paper .chart-page .pnl { border-color:#d8e0ea; box-shadow:0 1px 3px rgba(15,23,42,.06); }
body[data-page="chart"].chart-visual-theme-paper .pnl-head { background:#f8fafc; }
body[data-page="chart"].chart-visual-theme-paper #klineChart,
body[data-page="chart"].chart-visual-theme-paper .chart-placeholder { background:#ffffff; }

/* A high-contrast navy workspace for fast intraday reading. */
body[data-page="chart"].chart-visual-theme-marketPulse,
body[data-page="chart"].chart-visual-theme-marketPulse .chart-page {
  --bg:#071426; --bg2:#0b1b31; --bg3:#09172a; --bgi:#102440;
  --brd:#183252; --brd2:#28466b;
  --txt:#9eb7d0; --txt2:#6682a2; --txth:#e5f2ff;
  --acc:#38bdf8; --grn:#21d4a2; --red:#ff667a;
  --nav:#061222;
}
body[data-page="chart"].chart-visual-theme-marketPulse { background:#071426; }
body[data-page="chart"].chart-visual-theme-marketPulse .chart-page .pnl { border-color:#183252; }
.chart-page{background:var(--bg);color:var(--txt);max-width:none;padding:0;}
.chart-page .pnl{border-radius:8px;}
.chart-page .page{padding:0;max-width:none;}
body[data-page="chart"] .topbar {
  height: 60px;
  padding-left: 14px;
  padding-right: 14px;
  gap: 12px;
  z-index: 13000;
  overflow: visible;
}
body[data-page="chart"] .search-wrap {
  z-index: 13001;
}
body[data-page="chart"] .search-box {
  height: 40px;
  overflow: visible;
}
body[data-page="chart"] .ac-list {
  z-index: 13002;
}
body[data-page="chart"] #cdropSearchTools {
  z-index: 13003;
}
body[data-page="chart"] #cdropSearchToolsMenu {
  z-index: 13004;
}
body[data-page="chart"] .content {
  padding: 10px 12px 18px;
  max-width: none;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}
body[data-page="chart"] .chart-page,
body[data-page="chart"] .chart-page .page,
body[data-page="chart"] #chartPanel {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}
body[data-page="chart"] .chart-page .pnl {
  margin-bottom: 6px;
  border-radius: 6px;
}
body[data-page="chart"] .chart-hero {
  min-height: 0;
  padding: 5px 12px;
  align-items: center;
  justify-content: space-between;
}
body[data-page="chart"] .chart-hero-main {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  flex-wrap: nowrap;
  overflow: hidden;
  min-width: 0;
}
body[data-page="chart"] #chartTitle {
  font-size: 10pt;
  line-height: 1.15;
  font-weight: 800;
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body[data-page="chart"] #chartTitle .chart-title-company {
  font-size: 10pt;
  color: #7281a5;
  font-weight: 700;
}
body[data-page="chart"] .hero-price-wrap {
  margin-top: 0;
  gap: 7px;
  align-items: center;
  padding-left: 9px;
  margin-left: 2px;
  border-left: 1px solid var(--brd);
  flex: 0 0 auto;
}
body[data-page="chart"] .hero-price {
  font-size: 10pt;
  font-weight: 760;
  letter-spacing: -0.01em;
}
body[data-page="chart"] .hero-change {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10pt;
  font-weight: 800;
  line-height: 1;
}
body[data-page="chart"] .hero-change.up {
  background: rgba(38,166,154,.12);
}
body[data-page="chart"] .hero-change.down {
  background: rgba(239,83,80,.12);
}
body[data-page="chart"] .hero-change.flat {
  background: rgba(108,117,138,.12);
}
body[data-page="chart"] .hero-earnings-badge {
  height: 22px;
  padding: 0 7px;
  font-size: 11px;
}
.hero-earnings-badge.is-today {
  animation: hero-earnings-today-blink 1.8s linear infinite;
  border-color: #f59e0b;
  background: rgba(245,158,11,.22);
  color: #fff7e6;
}
.hero-earnings-badge.is-today i,
.hero-earnings-badge.is-today .earnings-date {
  animation: hero-earnings-today-blink 1.8s linear infinite;
}
@keyframes hero-earnings-today-blink {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(245,158,11,0); }
  50% { opacity: .2; box-shadow: 0 0 0 6px rgba(245,158,11,.24); }
}
body[data-page="chart"] .chart-ohlc-overlay {
  left: 8px;
  right: 8px;
  top: 6px;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 8px;
}
body[data-page="chart"] .ohlc-data {
  gap: 8px;
  scrollbar-width: none;
}
body[data-page="chart"] .ohlc-data::-webkit-scrollbar {
  display: none;
}
body[data-page="chart"] .ob-name {
  margin-right: 10px;
  max-width: 210px;
}
body[data-page="chart"] .ob-lbl {
  font-size: 9pt;
  color: #73809f;
}
body[data-page="chart"] .ob-val {
  font-size: 9pt;
}
body[data-page="chart"] .ob-time {
  font-size: 9pt;
}
body[data-page="chart"] .ob-meta-tail {
  gap: 6px;
  min-width: 0;
}
body[data-page="chart"] .ctrl-bar {
  padding: 0;
  gap: 3px;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}
body[data-page="chart"] .ctrl-bar-compact {
  gap: 8px;
}
body[data-page="chart"] .chart-toolbar-main {
  gap: 3px;
}
body[data-page="chart"] .chart-toolbar-actions {
  gap: 6px;
}
body[data-page="chart"] .chart-panel-actions {
  flex: 0 0 auto;
  margin-left: 8px;
  position: relative;
  z-index: 1;
}
/* Keep the live price visually above the adjacent hero controls. */
body[data-page="chart"] .hero-price-wrap {
  position: relative;
  z-index: 60;
  flex-shrink: 0;
  isolation: isolate;
}
body[data-page="chart"] .hero-price,
body[data-page="chart"] .hero-change {
  position: relative;
  z-index: 61;
}
/* Compact alert bell in the right-side toolbar. */
body[data-page="chart"] .chart-toolbar-actions .alert-open-btn.toolbar-icon-btn {
  width: auto;
  min-width: 28px;
  height: 22px;
  padding: 0 6px;
  font-size: 11px;
}
body[data-page="chart"] .chart-toolbar-actions .alert-open-btn.toolbar-icon-btn .fa {
  font-size: 11px;
}
@media(min-width:769px) {
  body[data-page="chart"] .chart-hero {
    display: grid;
    grid-template-columns: minmax(220px, 34%) minmax(0, 1fr) auto;
    column-gap: 8px;
    align-items: center;
    overflow: visible;
  }
  body[data-page="chart"] .chart-hero-main {
    grid-column: 1;
    flex: 0 1 auto;
    max-width: 100%;
    padding-right: 0;
    overflow: hidden;
    min-width: 0;
  }
  body[data-page="chart"] #chartTitle {
    flex: 0 1 auto;
    min-width: 0;
  }
  body[data-page="chart"] .hero-price-wrap {
    flex: 0 0 auto;
    min-width: 0;
  }
  body[data-page="chart"] .ctrl-bar {
    grid-column: 2;
    justify-self: stretch;
    align-self: center;
    flex: 0 1 auto;
    overflow: visible;
    min-width: 0;
  }
  body[data-page="chart"] .chart-panel-actions {
    grid-column: 3;
    justify-self: end;
    align-self: center;
    margin-left: 0;
    position: static;
    top: auto;
    right: auto;
    transform: none;
    z-index: 2;
    white-space: nowrap;
  }
}
body[data-page="chart"] .chart-hero,
body[data-page="chart"] .stats-bar,
body[data-page="chart"] .signals-panel {
  flex-shrink: 0;
}
body[data-page="chart"] .chart-area-wrap,
body[data-page="chart"] .chart-main-wrap {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}
body[data-page="chart"] #klineChart,
body[data-page="chart"] .chart-placeholder {
  height: 100%;
  flex: 1 1 auto;
  min-height: 520px;
}
body[data-page="chart"] .stats-bar {
  padding-top: 2px;
  padding-bottom: 2px;
}
body[data-page="chart"].chart-visual-theme-modern .chart-page .pnl {
  border-radius: 8px;
}
body[data-page="chart"].chart-visual-theme-proTechnical {
  background: #0a0d11;
}
body[data-page="chart"].chart-visual-theme-proTechnical .chart-page .pnl,
body[data-page="chart"].chart-visual-theme-proTechnical .chart-page .ac-list,
body[data-page="chart"].chart-visual-theme-proTechnical .ohlc-ticker-ac-list,
body[data-page="chart"].chart-visual-theme-proTechnical .admin-service-menu,
body[data-page="chart"].chart-visual-theme-proTechnical .cdrop-menu,
body[data-page="chart"].chart-visual-theme-proTechnical #candleTooltip,
body[data-page="chart"].chart-visual-theme-proTechnical #rulerTooltip {
  border-radius: 0;
  box-shadow: none;
}
body[data-page="chart"].chart-visual-theme-proTechnical .chart-page .pnl {
  border-color: #202832;
}
body[data-page="chart"].chart-visual-theme-proTechnical .admin-service-menu {
  background-color: #11161d;
  background-image: none;
  border-color: #202832;
  box-shadow: 0 10px 24px rgba(0,0,0,.45);
}
body[data-page="chart"].chart-visual-theme-proTechnical .pnl-head {
  border-bottom-color: #202832;
}
body[data-page="chart"].chart-visual-theme-proTechnical .chart-hero {
  gap: 6px;
  padding: 3px 8px;
}
body[data-page="chart"].chart-visual-theme-proTechnical .chart-hero-main {
  gap: 8px;
}
body[data-page="chart"].chart-visual-theme-proTechnical #chartTitle {
  font-size: 10pt;
  font-weight: 700;
}
body[data-page="chart"].chart-visual-theme-proTechnical #chartTitle .chart-title-company {
  font-size: 10pt;
  color: #7a8799;
}
body[data-page="chart"].chart-visual-theme-proTechnical .hero-price-wrap {
  gap: 6px;
  padding-left: 8px;
}
body[data-page="chart"].chart-visual-theme-proTechnical .hero-price {
  font-size: 10pt;
  font-weight: 700;
}
body[data-page="chart"].chart-visual-theme-proTechnical .hero-change {
  min-height: 18px;
  padding: 0 5px;
  border-radius: 0;
  font-size: 10pt;
  background: transparent;
}
body[data-page="chart"].chart-visual-theme-proTechnical .hero-earnings-badge {
  height: 20px;
  padding: 0 6px;
  border-radius: 0;
}
body[data-page="chart"].chart-visual-theme-proTechnical .chart-panel-action {
  width: 22px;
  height: 22px;
  border-radius: 0;
  box-shadow: none;
}
body[data-page="chart"].chart-visual-theme-proTechnical .chart-ohlc-overlay {
  left: 6px;
  right: 6px;
  top: 5px;
  min-height: 20px;
  padding: 2px 6px;
  border-radius: 0;
  border-color: transparent;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
}
body[data-page="chart"].chart-visual-theme-proTechnical .ob-ticker-input {
  height: 20px;
  padding: 0 4px;
  font-size: 12px;
}
body[data-page="chart"].chart-visual-theme-proTechnical .ob-name,
body[data-page="chart"].chart-visual-theme-proTechnical .ob-val,
body[data-page="chart"].chart-visual-theme-proTechnical .ob-time {
  font-size: 9pt;
}
body[data-page="chart"].chart-visual-theme-proTechnical .ob-lbl {
  font-size: 9pt;
  letter-spacing: .2px;
}
body[data-page="chart"].chart-visual-theme-proTechnical .ctrl-bar {
  gap: 2px;
}
body[data-page="chart"].chart-visual-theme-proTechnical .chart-toolbar-segment-tight {
  border-right-color: rgba(126, 140, 159, .25);
}
body[data-page="chart"].chart-visual-theme-proTechnical .chart-toolbar-status {
  color: #7f90a6;
}
body[data-page="chart"].chart-visual-theme-proTechnical .cbtn,
body[data-page="chart"].chart-visual-theme-proTechnical .cdrop-btn {
  min-height: 22px;
  padding: 1px 7px;
  border-radius: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  transition: none;
}
body[data-page="chart"].chart-visual-theme-proTechnical .cbtn.active,
body[data-page="chart"].chart-visual-theme-proTechnical .cdrop-btn.has-active {
  border-color: #8493aa;
  color: var(--txth);
  background: #171d25;
}
body[data-page="chart"].chart-visual-theme-proTechnical .cdrop-btn.analysis-btn {
  border-color: #44516a;
  color: #a7bcf0;
}
body[data-page="chart"].chart-visual-theme-proTechnical .cdrop-btn.analysis-btn:hover {
  background: #161e2a;
}
body[data-page="chart"].chart-visual-theme-proTechnical .cdrop-menu {
  margin-top: 1px;
  border-color: #26303d;
  background: #101419;
}
body[data-page="chart"].chart-visual-theme-proTechnical .cdrop-item {
  min-height: 24px;
  font-size: 11px;
}
body[data-page="chart"].chart-visual-theme-proTechnical .cdrop-item:hover {
  background: #171d25;
}
body[data-page="chart"].chart-visual-theme-proTechnical .stats-bar {
  gap: 2px;
  padding: 1px 8px;
  border-top-color: #202832;
}
body[data-page="chart"].chart-visual-theme-proTechnical .stats-pill,
body[data-page="chart"].chart-visual-theme-proTechnical .signal-pill {
  border-radius: 0;
}
body[data-page="chart"].chart-visual-theme-proTechnical #klineChart,
body[data-page="chart"].chart-visual-theme-proTechnical .chart-placeholder {
  min-height: 500px;
}
body[data-page="chart"].chart-visual-theme-proTechnical .xaxis-two-line-label,
body[data-page="chart"].chart-visual-theme-proTechnical .xaxis-two-line-year {
  font-size: 10px;
  text-shadow: none;
}
body[data-page="chart"].chart-visual-theme-proTechnical .xaxis-two-line-label {
  color: #bcc9d8;
  opacity: .96;
  bottom: 17px;
}
body[data-page="chart"].chart-visual-theme-proTechnical .xaxis-two-line-label .x-month {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .02em;
}
body[data-page="chart"].chart-visual-theme-proTechnical .xaxis-two-line-year {
  color: #7f90a6;
  opacity: .98;
  bottom: 4px;
}
body[data-page="chart"].chart-visual-theme-proTechnical #candleTooltip {
  border-color: #2b3440;
  padding: 6px 8px;
  min-width: 154px;
  font-size: 10px;
  line-height: 1.05;
}
body[data-page="chart"].chart-visual-theme-proTechnical #candleTooltip .ct-date {
  margin-bottom: 5px;
  padding-bottom: 4px;
  font-size: 10px;
}
body[data-page="chart"].chart-visual-theme-proTechnical #candleTooltip .ct-val {
  font-size: 15px;
}
body[data-page="chart"].chart-visual-theme-proTechnical #candleTooltip .ct-lbl {
  font-size: 10px;
}
body[data-page="chart"].chart-visual-theme-proTechnical #rulerTooltip {
  border-color: #2b3440;
  border-radius: 0;
  padding: 4px 8px;
  font-size: 10px;
  line-height: 1.55;
}
@media(max-width:1120px) {
  body[data-page="chart"] .topbar {
    height: 58px;
    min-height: 58px;
    padding: 8px 10px;
  }
  body[data-page="chart"] .content {
    padding: 8px 8px 14px;
  }
}
@media(max-width:768px) {
  body[data-page="chart"] .chart-hero {
    flex-wrap: wrap;
    overflow: visible;
  }
  body[data-page="chart"] .chart-hero-main {
    flex-direction: row;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 3px;
    min-width: 100%;
  }
  body[data-page="chart"] .ctrl-bar {
    min-width: 100%;
    order: 3;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    row-gap: 4px;
    overflow-y: visible;
    overflow-x: visible;
    scrollbar-width: none;
  }
  body[data-page="chart"] .ctrl-bar::-webkit-scrollbar { display: none; }
  body[data-page="chart"] .ctrl-bar-compact {
    justify-content: flex-start;
    gap: 6px;
  }
  body[data-page="chart"] .chart-toolbar-main,
  body[data-page="chart"] .chart-toolbar-actions {
    flex-wrap: wrap;
    overflow: visible;
  }
  body[data-page="chart"] .chart-toolbar-main {
    flex: 1 1 100%;
  }
  body[data-page="chart"] .chart-toolbar-actions {
    flex: 0 0 auto;
  }
  body[data-page="chart"] .chart-toolbar-segment-tight {
    padding-right: 0;
    border-right: 0;
  }
  body[data-page="chart"] .chart-toolbar-status {
    flex-basis: 100%;
    margin-left: 0;
  }
  body[data-page="chart"] .chart-toolbar-menu {
    width: min(300px, calc(100vw - 32px));
  }
  body[data-page="chart"] .chart-toolbar-grid-range {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  body[data-page="chart"] .cgrp {
    flex-wrap: wrap;
  }
  body[data-page="chart"] .cdrop {
    max-width: 100%;
  }
  body[data-page="chart"] .cdrop-btn,
  body[data-page="chart"] .cbtn,
  body[data-page="chart"] .tf-btn {
    flex: 0 0 auto;
  }
  body[data-page="chart"] .chart-hero {
    padding: 6px 10px;
  }
  body[data-page="chart"] .chart-ohlc-overlay {
    position: static;
    left: auto;
    right: auto;
    top: auto;
    margin: 0 0 2px;
    box-shadow: none;
    flex: 0 0 auto;
    min-height: 0;
    width: 100%;
  }
  body[data-page="chart"] #chartTitle {
    max-width: 100%;
  }
  body[data-page="chart"] #klineChart,
  body[data-page="chart"] .chart-placeholder {
    height: clamp(260px, calc(100dvh - 220px), 420px);
    min-height: 260px;
  }
  body[data-page="chart"].chart-visual-theme-proTechnical .chart-hero {
    padding: 4px 8px;
  }
  body[data-page="chart"].chart-visual-theme-proTechnical .ctrl-bar {
    gap: 4px;
  }
  body[data-page="chart"].chart-visual-theme-proTechnical .cbtn,
  body[data-page="chart"].chart-visual-theme-proTechnical .cdrop-btn {
    min-height: 24px;
    padding: 1px 6px;
    font-size: 10px;
  }
  body[data-page="chart"].chart-visual-theme-proTechnical .chart-ohlc-overlay {
    margin: 0 0 1px;
  }
}
@media(max-width:1120px){body.nav-open aside.sidebar{left:-280px!important;transform:translateX(280px);}}

/* Terminal-style OHLC/meta strip */
body[data-page="chart"] .chart-ohlc-overlay {
  padding: 4px 10px 3px;
  border: 0;
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
  pointer-events: auto;
}
body[data-page="chart"] .chart-ohlc-overlay .ohlc-data {
  gap: 4px;
  pointer-events: auto;
}
body[data-page="chart"] .ob-pair {
  gap: 4px;
}
body[data-page="chart"] .ob-metrics {
  gap: 10px;
}
body[data-page="chart"] .ob-topline {
  gap: 10px;
}
body[data-page="chart"] .ob-meta-tail {
  gap: 0;
}
body[data-page="chart"] .ob-lbl {
  color: #f59e0b;
  font: 600 9pt/1.2 'Segoe UI','Tahoma','Arial',sans-serif;
  letter-spacing: .02em;
}
body[data-page="chart"] .ob-val {
  color: #f6f0db;
  font: 600 9pt/1.2 'Segoe UI','Tahoma','Arial',sans-serif;
}
body[data-page="chart"] .ob-time {
  color: #f59e0b;
  font: 600 9pt/1.2 'Segoe UI','Tahoma','Arial',sans-serif;
}
body[data-page="chart"] .hero-meta-strip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  color: #f6f0db;
  font: 600 9pt/1.25 'Segoe UI','Tahoma','Arial',sans-serif;
  white-space: nowrap;
  text-overflow: ellipsis;
}
body[data-page="chart"] .ob-meta-item {
  display: inline;
  color: #f6f0db;
}
body[data-page="chart"] .ob-meta-sep {
  color: rgba(245,158,11,.82);
  font-weight: 700;
}
body[data-page="chart"] .ob-market-cap,
body[data-page="chart"] .ob-market-timing-label {
  color: #f59e0b;
  font-weight: 700;
}
body[data-page="chart"] .ob-market-timing {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  overflow: visible;
}
body[data-page="chart"] .chart-ohlc-overlay,
body[data-page="chart"] .chart-ohlc-overlay .ohlc-data,
body[data-page="chart"] .ob-topline,
body[data-page="chart"] .ob-meta-tail {
  overflow: visible;
}
body[data-page="chart"] .chart-ohlc-overlay .chart-help {
  pointer-events: auto;
  z-index: 12120;
}
body[data-page="chart"] .chart-ohlc-overlay .chart-help::before,
body[data-page="chart"] .chart-ohlc-overlay .chart-help::after {
  z-index: 12121;
}
body[data-page="chart"].chart-visual-theme-proTechnical .chart-ohlc-overlay {
  background: transparent;
}
.trade-planner-grid select{min-width:0;padding:7px 8px;border:1px solid var(--brd);border-radius:5px;background:var(--bg);color:var(--txt)}

@media (max-width: 980px) {
  body[data-page="chart"] .hero-meta-strip {
    display: inline-flex;
    width: auto;
    margin: 0;
    max-width: 100%;
  }
}
/* Historical Analytics */
.historical-analytics-overlay{display:none!important}
.historical-analytics-row .breakout_up,.historical-analytics-row .rejection_up{color:#22c55e;font-weight:700}.historical-analytics-row .breakout_down,.historical-analytics-row .rejection_down{color:#ef4444;font-weight:700}
.historical-analytics-panel{position:fixed;top:72px;left:auto;right:22px;width:min(720px,calc(100vw - 44px));height:auto;max-height:calc(100vh - 94px);overflow:auto;background:var(--bg2);border:1px solid var(--brd);border-radius:10px;box-shadow:0 18px 42px rgba(0,0,0,.28);z-index:8991;padding:22px;color:var(--txt)}
.historical-analytics-panel.is-dragging{cursor:grabbing;user-select:none}.historical-analytics-head{cursor:grab}.historical-analytics-head:active{cursor:grabbing}
.historical-analytics-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;border-bottom:1px solid var(--brd);padding-bottom:14px}.historical-analytics-kicker{font-size:10px;letter-spacing:.12em;text-transform:uppercase;color:var(--txt2);font-weight:700}.historical-analytics-head h3{margin:5px 0 0;font-size:18px;color:var(--txth)}.historical-analytics-head h3 i{color:var(--acc)}.historical-analytics-close{border:0;background:transparent;color:var(--txt2);font-size:24px;cursor:pointer;line-height:1}.historical-analytics-controls{display:grid;grid-template-columns:repeat(4,minmax(0,1fr)) auto;gap:8px;margin:16px 0}.historical-analytics-controls label{font-size:10px;color:var(--txt2);font-weight:700}.historical-analytics-controls input,.historical-analytics-controls select{display:block;width:100%;box-sizing:border-box;margin-top:5px;height:32px;border:1px solid var(--brd2);border-radius:5px;background:var(--bgi);color:var(--txt);padding:0 7px}.historical-analytics-run{align-self:end;height:32px;border:1px solid var(--acc);border-radius:5px;background:var(--acc);color:#fff;font-weight:700;padding:0 12px;cursor:pointer}.historical-analytics-meta{font-size:11px;color:var(--txt2);padding:9px 10px;background:var(--bg3);border-radius:6px}.historical-analytics-summary{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:7px;margin:12px 0}.historical-analytics-kpi{border:1px solid var(--brd);border-radius:6px;padding:9px;background:var(--bg3)}.historical-analytics-kpi b{display:block;font-size:16px;color:var(--txth)}.historical-analytics-kpi span{display:block;margin-top:3px;font-size:10px;color:var(--txt2)}.historical-analytics-events{margin-top:12px;border:1px solid var(--brd);border-radius:6px;overflow:auto}.historical-analytics-row{display:grid;grid-template-columns:86px 74px 68px repeat(4,minmax(55px,1fr));gap:6px;align-items:center;padding:8px 10px;border-bottom:1px solid var(--brd);font-size:10px;cursor:pointer}.historical-analytics-row:last-child{border-bottom:0}.historical-analytics-row:hover{background:var(--bg3)}.historical-analytics-row.head{font-weight:700;color:var(--txt2);cursor:default;background:var(--bg3)}.historical-analytics-row .rebound{color:#22c55e;font-weight:700}.historical-analytics-row .breakout{color:#ef4444;font-weight:700}.historical-analytics-detail{margin-top:10px;padding:10px;border:1px solid var(--brd);border-radius:6px;background:var(--bg3);font-size:11px;line-height:1.55}.historical-analytics-foot{display:flex;justify-content:space-between;gap:8px;margin-top:12px;font-size:10px;color:var(--txt2)}.historical-analytics-foot label{color:var(--txt);font-weight:700}@media(max-width:640px){.historical-analytics-panel{padding:15px}.historical-analytics-controls{grid-template-columns:repeat(2,minmax(0,1fr))}.historical-analytics-run{grid-column:span 2}.historical-analytics-summary{grid-template-columns:repeat(2,minmax(0,1fr))}.historical-analytics-row{grid-template-columns:72px 68px 62px repeat(4,52px);min-width:430px}.historical-analytics-events{overflow-x:auto}}

/* Metric explanations sit outside the scrolling fundamentals window. */
.fund-help {
  display:inline-flex; align-items:center; justify-content:center; vertical-align:middle;
  width:17px; height:17px; margin-left:4px; padding:0; flex-shrink:0;
  border:1px solid var(--brd2); border-radius:50%; background:var(--bg3);
  color:var(--txt2); font:700 11px/1 Arial,sans-serif; cursor:pointer;
  text-transform:none; letter-spacing:0; touch-action:manipulation;
}
.fund-help:hover,.fund-help[aria-expanded="true"] { color:var(--acc); border-color:var(--acc); background:var(--bgi); }
.fund-help:focus-visible { outline:2px solid var(--acc); outline-offset:3px; }
.fund-help-tooltip {
  position:fixed; z-index:15050; box-sizing:border-box; width:310px;
  max-width:calc(100vw - 20px); max-height:calc(100vh - 20px); overflow:auto;
  padding:14px 16px; border:1px solid var(--brd2); border-top:3px solid var(--acc);
  border-radius:10px; background:var(--bg2); color:var(--txt);
  box-shadow:0 10px 32px rgba(0,0,0,.28); font:400 12px/1.65 'Roboto',Arial,sans-serif;
  text-align:left; text-transform:none; letter-spacing:0; white-space:normal;
}
.fund-help-tooltip[hidden] { display:none; }
.fund-help-tooltip strong { display:block; color:var(--txth); font-size:13px; line-height:1.4; }
.fund-help-tooltip p { margin:7px 0 0; }
.fund-extra-kpi > span { overflow:visible; white-space:normal; }

/* v4: etichetta + X per ogni studio (medie mobili, RSI, ...) in alto a destra del pane */
.indicator-close-btn.has-label{width:auto;height:22px;padding:0 8px 0 10px;gap:6px;border-radius:999px;font:600 11px/1 'Roboto Mono','Courier New',monospace;color:var(--txt);white-space:nowrap}
.indicator-close-btn.has-label .ind-chip-dot{display:inline-block;width:8px;height:8px;border-radius:50%;flex:none}
.indicator-close-btn.has-label .ind-chip-x{font-size:15px;line-height:1;opacity:.6;margin-left:2px}
.indicator-close-btn.has-label:hover .ind-chip-x,.indicator-close-btn.has-label:focus-visible .ind-chip-x{opacity:1}

/* ===== chart-next: block 1 ===== */
.hero-data-chip {
  display: inline-flex; align-items: center; height: 20px; padding: 0 8px;
  border: 1px solid var(--brd); border-radius: 999px;
  font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--txt2); background: var(--bg3); white-space: nowrap; cursor: help;
}
.hero-data-chip.is-eod { color: #b7791f; border-color: currentColor; }

.chart-range-bar {
  display: flex; align-items: center; gap: 8px; flex: 0 0 auto;
  padding: 4px 10px; border-top: 1px solid var(--brd); background: var(--bg3);
  overflow-x: auto; scrollbar-width: none;
}
.chart-range-bar::-webkit-scrollbar { display: none; }
.chart-range-group { display: inline-flex; gap: 2px; }
.chart-range-bar .cbtn {
  min-width: 34px; height: 24px; padding: 0 8px; font-size: 11px; font-weight: 600;
  border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--txt2); cursor: pointer;
}
.chart-range-bar .cbtn:hover { color: var(--txth); background: var(--bgi); }
.chart-range-bar .cbtn.active { color: var(--acc); background: var(--bgi); border-color: var(--brd); }
.chart-range-bar .cbtn:focus-visible { outline: 2px solid var(--acc); outline-offset: 1px; }
.chart-range-sep { width: 1px; height: 14px; background: var(--brd); }

/* ===== chart-next: block 2a (menus) ===== */
#cdropMAMenu { max-height: calc(100vh - 170px); overflow-y: auto; min-width: 250px; }
.studies-head { position: sticky; top: -4px; z-index: 2; background: var(--bg2); padding: 6px 8px 2px; margin-top: -4px; border-bottom: 1px solid var(--brd); }
.studies-search {
  width: 100%; height: 30px; padding: 0 10px; font-size: 12px; color: var(--txth);
  background: var(--bgi); border: 1px solid var(--brd); border-radius: 6px; outline: none;
}
.studies-search:focus { border-color: var(--acc); }
.studies-fav-title { padding-left: 4px; }
.studies-fav-box .cdrop-item { padding-left: 6px; padding-right: 6px; }
.cdrop-item .studies-star {
  margin-left: auto; background: none; border: 0; padding: 0 2px; cursor: pointer;
  color: var(--txt2); opacity: 0; font-size: 12px; line-height: 1;
}
.cdrop-item:hover .studies-star, .cdrop-item.is-fav .studies-star, .studies-star:focus-visible { opacity: 1; }
.cdrop-item.is-fav .studies-star { color: #d69e2e; }
.cdrop-item.ind-active .studies-star { margin-left: 8px; }
.studies-more { margin: 2px 0; border-top: 1px solid var(--brd); }
.studies-more > summary {
  list-style: none; cursor: pointer; padding: 7px 12px; font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .8px; color: var(--txt2);
}
.studies-more > summary::-webkit-details-marker { display: none; }
.studies-more > summary::after { content: '▸'; float: right; }
.studies-more[open] > summary::after { content: '▾'; }
.cdrop-item-btn { width: 100%; border: 0; background: none; text-align: left; font-family: inherit; }
#heroBlogBtn { display: none !important; }
#alertsMenuItem, #alertsMenuItem + .cdrop-menu-sep { display: none; }

/* ===== chart-next: block 3 (alerts) ===== */
.chart-alert-card:not(.adv-open) .chart-alert-grid > label.is-adv { display: none !important; }
.chart-alert-adv-row { display: flex; align-items: center; gap: 10px; margin: 10px 0 6px; flex-wrap: wrap; }
.chart-alert-adv-toggle {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; font-size: 12px; font-weight: 600;
  color: var(--txt2); background: transparent; border: 1px dashed var(--brd); border-radius: 6px; cursor: pointer;
}
.chart-alert-adv-toggle:hover { color: var(--txth); border-color: var(--acc); }
.chart-alert-adv-toggle .chev { transition: transform .15s; }
.chart-alert-adv-toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }
.chart-alert-adv-sum { font-size: 11px; color: var(--txt2); }
.chart-alert-settings { margin-top: 14px; border-top: 1px solid var(--brd); padding-top: 8px; }
.chart-alert-settings > summary { cursor: pointer; font-size: 12px; font-weight: 600; color: var(--txt2); padding: 4px 0; }

/* ===== chart-next: block 4 (app mode) =====
   The chart page fills the viewport: tighter paddings, content as tall as the window,
   one-line disclaimer. Desktop only; small screens keep the original flow. */
@media (min-width: 900px) and (min-height: 640px) {
  body[data-page="chart"] .content { padding: 8px 12px 4px; height: calc(100dvh - 64px); box-sizing: border-box; }
  body[data-page="chart"] .main { min-height: 0; }
  body[data-page="chart"] .page > p { padding: 0; margin: 4px 0 0; font-size: 10px; line-height: 1.3; }
}

/* ===== chart-next: block 5 (a11y) ===== */
.cdrop-item:focus-visible, .cdrop-item-btn:focus-visible { outline: 2px solid var(--acc); outline-offset: -2px; background: var(--bgi); color: var(--txth); }
.cdrop-btn:focus-visible, .tf-btn:focus-visible, .dt-btn:focus-visible, .toolbar-icon-btn:focus-visible { outline: 2px solid var(--acc); outline-offset: 1px; }
[role="dialog"]:focus { outline: none; }

/* ===== chart-next: block 6 (share / toast) ===== */
.gs-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 12px); z-index: 10050;
  padding: 9px 16px; border-radius: 8px; font-size: 12px; font-weight: 600;
  color: var(--txth); background: var(--bg2); border: 1px solid var(--brd); box-shadow: 0 8px 24px rgba(0,0,0,.4);
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s;
}
.gs-toast.show { opacity: 1; transform: translate(-50%, 0); }
.gs-toast.bad { border-color: #ef5350; color: #ef5350; }

/* ===== chart-next: block 7 (position tool) ===== */
.gs-pos-btn.gs-pos-long i { color: #26a69a; }
.gs-pos-btn.gs-pos-short i { color: #ef5350; }
body.gs-pos-armed #klineChart, body.gs-pos-armed #klineChart canvas { cursor: crosshair !important; }

/* ===== chart-next: block 8 (command palette) ===== */
.gsp-overlay { position: fixed; inset: 0; z-index: 10040; background: rgba(0,0,0,.45); display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh; }
.gsp-overlay[hidden] { display: none; }
.gsp-box { width: min(620px, calc(100vw - 24px)); max-height: 70vh; display: flex; flex-direction: column; background: var(--bg2); border: 1px solid var(--brd); border-radius: 12px; box-shadow: 0 24px 64px rgba(0,0,0,.55); overflow: hidden; }
.gsp-inputwrap { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--brd); color: var(--txt2); }
.gsp-input { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; font-size: 15px; color: var(--txth); font-family: inherit; }
.gsp-box kbd { font: 600 10px/1 Inter, sans-serif; padding: 3px 5px; border: 1px solid var(--brd); border-radius: 4px; color: var(--txt2); background: var(--bg3); margin-right: 3px; }
.gsp-list { overflow-y: auto; padding: 6px; }
.gsp-group { font-size: 9px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--txt2); padding: 8px 10px 3px; }
.gsp-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; font-size: 13px; color: var(--txt); cursor: pointer; }
.gsp-item i { width: 16px; text-align: center; color: var(--txt2); }
.gsp-item.sel { background: var(--bgi); color: var(--txth); }
.gsp-item.sel i { color: var(--acc); }
.gsp-empty { padding: 22px; text-align: center; color: var(--txt2); font-size: 13px; }
.gsp-foot { display: flex; gap: 16px; padding: 8px 14px; border-top: 1px solid var(--brd); font-size: 11px; color: var(--txt2); }

/* ===== chart-next: block 9 (small viewports / browser zoom) =====
   The drawing toolbar is ~700px tall. When the window (or zoomed viewport) is shorter, the chart area
   grows to contain it and the page scrolls, instead of letting the toolbar overlap the bars below.
   The stats bar now lives inside .chart-main-wrap, so it starts right after the toolbar, aligned with 1W. */
@media (min-width: 900px) {
  body[data-page="chart"] .chart-area-wrap { min-height: min-content; }
  body[data-page="chart"] #chartPanel,
  body[data-page="chart"] .chart-page,
  body[data-page="chart"] .chart-page .page { min-height: min-content; }
  body[data-page="chart"] #klineChart,
  body[data-page="chart"] .chart-placeholder { min-height: 240px; }
  body[data-page="chart"] .chart-main-wrap > .stats-bar { padding-left: 10px; flex: 0 0 auto; }
}

/* ===== chart-next: block 11 (toolbar icons) ===== */
.draw-toolbar .dt-btn svg.gsi, .draw-toolbar .dt-group-icon svg { width: 20px; height: 20px; display: block; }
.draw-toolbar .dt-group-icon { width: 20px; height: 20px; }
.draw-toolbar .dt-btn { transition: background .12s, color .12s, border-color .12s; }
.draw-toolbar .dt-btn:hover svg.gsi { color: var(--txth); }
.dt-btn .gsi-slash { display: none; }
.dt-btn[aria-pressed="true"] .gsi-slash { display: block; }
.dt-btn.active svg.gsi { color: #fff; }
body.theme-trader .dt-btn.active svg.gsi { color: #000; }
.gs-pos-btn.gs-pos-long:not(.active) svg { color: #26a69a; }
.gs-pos-btn.gs-pos-short:not(.active) svg { color: #ef5350; }
.dt-btn.del:hover svg.gsi { color: #fff; }

/* ===== chart-next: block 12 (chart templates v2) ===== */
/* Classic Dark: fixed dark workspace */
body[data-page="chart"].chart-visual-theme-modern .chart-page {
  --bg:#131722; --bg2:#161a25; --bg3:#1a1e2b; --bgi:#222633;
  --brd:#2a2e39; --brd2:#363c4e;
  --txt:#b2b5be; --txt2:#8b8f9c; --txth:#d1d4dc;
  --acc:#2962ff; --grn:#26a69a; --red:#ef5350; --nav:#131722;
}
/* Classic Light (paper): TradingView-like light palette */
body[data-page="chart"].chart-visual-theme-paper .chart-page { --grn:#089981; --red:#f23645; --txt2:#5b6577; }

/* Amber: black workspace, amber labels, monospace */
body[data-page="chart"].chart-visual-theme-amber,
body[data-page="chart"].chart-visual-theme-amber .chart-page {
  --bg:#000000; --bg2:#060606; --bg3:#0b0b0b; --bgi:#161616;
  --brd:#2e2400; --brd2:#4d3c00;
  --txt:#e6a100; --txt2:#b07a00; --txth:#ffd479;
  --acc:#ffb000; --grn:#2bd36b; --red:#ff4141; --nav:#000000;
}
body[data-page="chart"].chart-visual-theme-amber { background:#000; }
body[data-page="chart"].chart-visual-theme-amber .chart-page { font-family:'Roboto Mono','Courier New',monospace; }
body[data-page="chart"].chart-visual-theme-amber .chart-page .pnl { border-color:#2e2400; }
body[data-page="chart"].chart-visual-theme-amber .dt-btn.active svg.gsi,
body[data-page="chart"].chart-visual-theme-amber .cdrop-btn.active,
body[data-page="chart"].chart-visual-theme-amber .cbtn.active,
body[data-page="chart"].chart-visual-theme-amber .tf-btn.active { color:#000; }

/* Print: white, monochrome, readable in black and white */
body[data-page="chart"].chart-visual-theme-print,
body[data-page="chart"].chart-visual-theme-print .chart-page {
  --bg:#ffffff; --bg2:#ffffff; --bg3:#f5f6f8; --bgi:#eceef2;
  --brd:#cfd4dc; --brd2:#aab2bf;
  --txt:#333a45; --txt2:#5b6270; --txth:#0b0f17;
  --acc:#1f2937; --grn:#1a1a1a; --red:#6b7280; --nav:#111827;
}
body[data-page="chart"].chart-visual-theme-print { background:#ffffff; }
body[data-page="chart"].chart-visual-theme-print .chart-page .pnl { border-color:#cfd4dc; box-shadow:none; }
body[data-page="chart"].chart-visual-theme-print .pnl-head { background:#f5f6f8; }
body[data-page="chart"].chart-visual-theme-print #klineChart,
body[data-page="chart"].chart-visual-theme-print .chart-placeholder { background:#ffffff; }
body[data-page="chart"].chart-visual-theme-print .dt-btn.active svg.gsi { color:#fff; }

/* Candle color presets: also recolor the page UI (price change, chips) */
body[data-page="chart"][data-gs-colors="asian"] .chart-page { --grn:#f6465d; --red:#0ecb81; }
body[data-page="chart"][data-gs-colors="cb"]    .chart-page { --grn:#4da3ff; --red:#ffa726; }
body[data-page="chart"][data-gs-colors="mono"]  .chart-page { --grn:#e6e9ef; --red:#7d8596; }
body[data-page="chart"][data-gs-colors="asian"].chart-visual-theme-paper .chart-page,
body[data-page="chart"][data-gs-colors="asian"].chart-visual-theme-print .chart-page { --grn:#d93a3a; --red:#0a8f55; }
body[data-page="chart"][data-gs-colors="cb"].chart-visual-theme-paper .chart-page,
body[data-page="chart"][data-gs-colors="cb"].chart-visual-theme-print .chart-page { --grn:#1565c0; --red:#e65100; }
body[data-page="chart"][data-gs-colors="mono"].chart-visual-theme-paper .chart-page,
body[data-page="chart"][data-gs-colors="mono"].chart-visual-theme-print .chart-page { --grn:#1a1a1a; --red:#767e8c; }

/* View menu: template cards + option chips */
#cdropViewMenu { min-width: 300px; max-height: calc(100vh - 150px); overflow-y: auto; }
.gst-hidden { display: none !important; }
.gst-box { padding: 2px 10px 8px; }
.gst-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 4px; }
.gst-card {
  display: flex; flex-direction: column; gap: 5px; padding: 5px; text-align: left; cursor: pointer;
  background: var(--bg3); border: 1px solid var(--brd); border-radius: 8px; color: var(--txt); font: 600 11px Inter, sans-serif;
}
.gst-card svg { display: block; border-radius: 4px; border: 1px solid rgba(128,128,128,.25); }
.gst-card span { padding: 0 2px 1px; }
.gst-card:hover { border-color: var(--brd2); color: var(--txth); }
.gst-card.active { border-color: var(--acc); box-shadow: 0 0 0 1px var(--acc); color: var(--txth); }
.gst-card:focus-visible, .gst-chip:focus-visible { outline: 2px solid var(--acc); outline-offset: 1px; }
.gst-auto { display: flex; align-items: center; gap: 8px; margin: 10px 2px 2px; font-size: 12px; color: var(--txt); cursor: pointer; }
.gst-auto input { accent-color: var(--acc); }
.gst-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 2px 4px; }
.gst-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px; cursor: pointer;
  font: 600 11px Inter, sans-serif; color: var(--txt); background: var(--bg3); border: 1px solid var(--brd); border-radius: 6px;
}
.gst-chip:hover { color: var(--txth); border-color: var(--brd2); }
.gst-chip.active { color: var(--txth); border-color: var(--acc); box-shadow: 0 0 0 1px var(--acc); }
.gst-sw { display: inline-flex; }
.gst-sw i { width: 9px; height: 12px; display: block; }
.gst-sw i:first-child { border-radius: 2px 0 0 2px; } .gst-sw i:last-child { border-radius: 0 2px 2px 0; }

/* ===== chart-next: block 13 (drawing tools) ===== */
#gsStickyBtn.on { background: var(--acc); border-color: var(--acc); color: #fff; }
body.theme-trader #gsStickyBtn.on, body.chart-visual-theme-amber #gsStickyBtn.on { color: #000; }
#gsStickyBtn:not(.on) .gsi-keyhole { display: none; }

/* ===== chart-next: block 14-16 (tools 2, drawings list, magnet) ===== */
#gsMagnetBtn.on { color: var(--acc); }
#gsMagnetBtn.on:hover { color: var(--acc); }
body.gs-custom-draw #klineChart, body.gs-custom-draw #klineChart canvas { cursor: crosshair !important; }
#gsObjBtn.active { background: var(--acc); border-color: var(--acc); color: #fff; }
body.chart-visual-theme-amber #gsObjBtn.active { color: #000; }

.gso-panel {
  position: fixed; z-index: 9300; width: 300px; display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg2); border: 1px solid var(--brd); border-radius: 10px; box-shadow: 0 14px 40px rgba(0,0,0,.45); color: var(--txt);
}
.gso-panel[hidden] { display: none; }
.gso-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--brd); background: var(--bg3); }
.gso-head strong { color: var(--txth); font-size: 13px; }
.gso-count { font-size: 11px; color: var(--txt2); flex: 1; }
.gso-x { background: none; border: 0; color: var(--txt2); font-size: 18px; line-height: 1; cursor: pointer; padding: 0 4px; }
.gso-x:hover { color: var(--txth); }
.gso-actions { display: flex; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--brd); }
.gso-actions button {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 5px; height: 28px; font: 600 11px Inter, sans-serif;
  color: var(--txt); background: var(--bg3); border: 1px solid var(--brd); border-radius: 6px; cursor: pointer; white-space: nowrap;
}
.gso-actions button:hover:not(:disabled) { color: var(--txth); border-color: var(--brd2); }
.gso-actions button:disabled { opacity: .45; cursor: default; }
.gso-actions button.danger:hover:not(:disabled), .gso-actions button.confirm { color: #fff; background: var(--red); border-color: var(--red); }
.gso-list { overflow-y: auto; padding: 4px; min-height: 60px; }
.gso-empty { padding: 22px 12px; text-align: center; font-size: 12px; color: var(--txt2); }
.gso-row { display: flex; align-items: center; gap: 4px; padding: 5px 6px; border-radius: 7px; cursor: pointer; }
.gso-row:hover { background: var(--bgi); }
.gso-row.sel { background: var(--bgi); box-shadow: inset 0 0 0 1px var(--acc); }
.gso-row.off .gso-main { opacity: .45; }
.gso-sw { width: 8px; height: 22px; border-radius: 3px; flex: 0 0 auto; margin-right: 4px; }
.gso-main { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.gso-main strong { font-size: 12px; color: var(--txth); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gso-main span { font-size: 10px; color: var(--txt2); font-family: 'Roboto Mono', monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gso-row button { width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; background: none; border: 0; border-radius: 5px; color: var(--txt2); cursor: pointer; flex: 0 0 auto; }
.gso-row button:hover { background: var(--bg3); color: var(--txth); }
.gso-row button.danger:hover { color: var(--red); }
.gso-foot { padding: 7px 12px; border-top: 1px solid var(--brd); font-size: 10px; color: var(--txt2); }
.gso-panel button:focus-visible { outline: 2px solid var(--acc); outline-offset: 1px; }

/* ===== chart-next: block 17 (chart metrics) ===== */
body[data-page="chart"] .ob-val.ob-pos { color: var(--grn); }
body[data-page="chart"] .ob-val.ob-neg { color: var(--red); }
body[data-page="chart"] .ob-val.ob-warn { color: #f59e0b; }
.ob-pair[title] { cursor: help; }
.gs-metric-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 10px; font-size: 11px; color: var(--txt2); }
.gs-metric-presets span { margin-right: 2px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: 10px; }
.gs-metric-presets button {
  height: 24px; padding: 0 10px; cursor: pointer; font: 600 11px Inter, sans-serif; color: var(--txt);
  background: var(--bg3); border: 1px solid var(--brd); border-radius: 6px;
}
.gs-metric-presets button:hover { color: var(--txth); border-color: var(--acc); }

/* Terminal: the custom metrics strip is shown as a normal row above the chart (it never overlaps the Terminal title line) */
body[data-page="chart"].chart-visual-theme-terminal #ohlcBar:not(.show) { display: none !important; }
body[data-page="chart"].chart-visual-theme-terminal #ohlcBar.show {
  display: flex !important; position: relative !important; left: auto !important; right: auto !important; top: auto !important;
  flex: 0 0 auto !important; width: 100% !important; min-width: 0 !important; box-sizing: border-box;
  padding: 3px 34px 3px 8px !important; border-radius: 0 !important; border-bottom: 1px solid #3c3c3c !important;
  background: #000 !important; z-index: 5; pointer-events: auto !important;
}
body[data-page="chart"].chart-visual-theme-terminal #ohlcBar .ohlc-data { gap: 1px !important; pointer-events: auto; overflow: visible !important; }
body[data-page="chart"].chart-visual-theme-terminal #ohlcBar .ob-topline,
body[data-page="chart"].chart-visual-theme-terminal #ohlcBar .ob-metrics { flex-wrap: wrap; white-space: normal; row-gap: 1px; column-gap: 12px; }
body[data-page="chart"].chart-visual-theme-terminal #ohlcBar .ob-lbl { color: #808080; font: 400 11px 'Roboto Mono','Courier New',monospace; letter-spacing: 0; }
body[data-page="chart"].chart-visual-theme-terminal #ohlcBar .ob-val { color: #ffffff; font: 600 11px 'Roboto Mono','Courier New',monospace; }
body[data-page="chart"].chart-visual-theme-terminal #ohlcBar .ob-val.ob-pos { color: #00ff00; }
body[data-page="chart"].chart-visual-theme-terminal #ohlcBar .ob-val.ob-neg { color: #ff3030; }
body[data-page="chart"].chart-visual-theme-terminal #ohlcBar .ob-val.ob-warn { color: #ffb000; }
body[data-page="chart"].chart-visual-theme-terminal #ohlcBar .chart-header-config-btn { background: #000; color: #808080; }

/* ===== block 18: panels above super-maximized chart ===== */
body.chart-panel-supermaximized #chartPanel { z-index: 7000; }
body.chart-panel-supermaximized .manual-candle-overlay,
body.chart-panel-supermaximized .chart-simulation-overlay { z-index: 14100; }

/* ===== block 19: collapsible chart metrics header ===== */
.ob-collapse-btn { pointer-events:auto; display:inline-flex; align-items:center; gap:3px; flex:0 0 auto; margin-right:6px; padding:1px 5px; height:16px; border:1px solid var(--brd); border-radius:4px; background:transparent; color:var(--txt2); font-size:9px; line-height:1; cursor:pointer; opacity:.65; }
.ob-collapse-btn:hover, .ob-collapse-btn:focus-visible { opacity:1; color:var(--acc); border-color:var(--acc); }
.ob-collapse-n { font:600 9px/1 'Segoe UI',Arial,sans-serif; }

/* v4: badge studi compatti, in riga (uno per ogni MA/EMA, anche sul volume) */
.ind-chip-row{position:absolute;display:flex;flex-wrap:wrap;justify-content:flex-end;gap:3px;pointer-events:none}
.ind-chip-row .indicator-close-btn,.ind-chip-row .indicator-close-btn.has-label{position:static;height:16px;padding:0 5px 0 6px;gap:4px;font:600 10px/1 'Roboto Mono','Courier New',monospace;box-shadow:0 2px 6px rgba(0,0,0,.18);background:rgba(12,16,24,.62);backdrop-filter:blur(3px);-webkit-backdrop-filter:blur(3px)}
.ind-chip-row .indicator-close-btn.has-label .ind-chip-dot{width:6px;height:6px}
.ind-chip-row .indicator-close-btn.has-label .ind-chip-x{font-size:12px;margin-left:1px}
.ind-chip-row .indicator-close-btn:hover,.ind-chip-row .indicator-close-btn:focus-visible{transform:none;box-shadow:0 3px 8px rgba(239,83,80,.28)}
body.theme-white .ind-chip-row .indicator-close-btn,body.theme-white .ind-chip-row .indicator-close-btn.has-label{background:rgba(255,255,255,.82)}
body.theme-trader .ind-chip-row .indicator-close-btn,body.theme-trader .ind-chip-row .indicator-close-btn.has-label{background:rgba(3,10,3,.8)}
