:root {
  color-scheme: dark;
  --bg: #0a0e15;
  --panel: #10151e;
  --panel-raised: #141b26;
  --border: #1d2738;
  --border-strong: #2b3950;
  --text: #e9eef6;
  --muted: #8c98ab;
  --accent: #2fbf8f;
  --accent-strong: #27a87c;
  --accent-soft: rgba(47, 191, 143, 0.15);
  --accent-text: #5ce0b0;
  --danger: #f6465d;
  --up: #2ebd85;
  --down: #f6465d;
  --warning: #e8a33d;

  --chart-bg: #0d1219;
  --chart-grid: rgba(140, 152, 171, 0.1);
  --chart-axis: #76839b;
  --chart-up: #2ebd85;
  --chart-down: #f6465d;
  --chart-volume-up: rgba(46, 189, 133, 0.32);
  --chart-volume-down: rgba(246, 70, 93, 0.28);
  --chart-boll-fill: rgba(96, 165, 250, 0.07);
  --chart-boll-line: rgba(96, 165, 250, 0.6);
  --chart-boll-basis: rgba(232, 163, 61, 0.85);
  --chart-vwap: #a78bfa;
  --chart-ppo: #60a5fa;
  --chart-ppo-signal: #f59e0b;
  --chart-reflex: #22d3ee;
  --chart-trendflex: #f472b6;
  --chart-hurst: #facc15;
  --chart-level: rgba(233, 238, 246, 0.5);
  --chart-level-support: rgba(46, 189, 133, 0.72);
  --chart-level-resistance: rgba(246, 70, 93, 0.72);
  --chart-level-opening: rgba(250, 204, 21, 0.72);
  --chart-level-previous: rgba(96, 165, 250, 0.72);
  --chart-avwap-high: rgba(246, 70, 93, 0.66);
  --chart-avwap-low: rgba(46, 189, 133, 0.66);
  --chart-crosshair: rgba(233, 238, 246, 0.32);
  --chart-osc-bg: rgba(140, 152, 171, 0.05);

  --shadow: 0 18px 48px rgba(2, 6, 12, 0.45);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  background:
    radial-gradient(1200px 620px at 12% -8%, rgba(47, 191, 143, 0.08), transparent 55%),
    radial-gradient(1000px 600px at 88% -12%, rgba(94, 162, 248, 0.07), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Анимированный фон: три дрейфующих световых пятна за контентом */
html::before,
body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  pointer-events: none;
  will-change: transform;
}

body::before {
  width: 62vmax;
  height: 62vmax;
  top: -24vmax;
  left: -16vmax;
  background: radial-gradient(circle, rgba(47, 191, 143, 0.14), transparent 62%);
  animation: bg-drift-a 44s ease-in-out infinite alternate;
}

body::after {
  width: 56vmax;
  height: 56vmax;
  bottom: -22vmax;
  right: -14vmax;
  background: radial-gradient(circle, rgba(94, 162, 248, 0.12), transparent 62%);
  animation: bg-drift-b 56s ease-in-out infinite alternate;
}

html::before {
  width: 44vmax;
  height: 44vmax;
  top: 30%;
  left: 38%;
  background: radial-gradient(circle, rgba(167, 139, 250, 0.09), transparent 62%);
  animation: bg-drift-c 68s ease-in-out infinite alternate;
}

@keyframes bg-drift-a {
  from {
    transform: translate3d(-4vw, -3vh, 0) scale(1);
  }
  to {
    transform: translate3d(14vw, 14vh, 0) scale(1.28);
  }
}

@keyframes bg-drift-b {
  from {
    transform: translate3d(5vw, 4vh, 0) scale(1.22);
  }
  to {
    transform: translate3d(-12vw, -12vh, 0) scale(0.95);
  }
}

@keyframes bg-drift-c {
  from {
    transform: translate3d(-9vw, 7vh, 0) scale(0.9);
  }
  to {
    transform: translate3d(9vw, -9vh, 0) scale(1.3);
  }
}

@media (prefers-reduced-motion: reduce) {
  html::before,
  body::before,
  body::after {
    animation: none;
  }
}

::selection {
  background: rgba(47, 191, 143, 0.3);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.shell {
  width: min(1360px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 36px;
}

.account-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 10px 14px;
  background: rgba(16, 21, 30, 0.72);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(2, 6, 12, 0.28);
  backdrop-filter: blur(12px);
}

.account-copy {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.account-copy strong {
  font-size: 13px;
}

.account-copy span {
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.account-email {
  max-width: 260px;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.subscription-badge {
  height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(246, 70, 93, 0.4);
  background: rgba(246, 70, 93, 0.11);
  color: #ff9aaa;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.subscription-badge.active {
  border-color: rgba(47, 191, 143, 0.45);
  background: var(--accent-soft);
  color: var(--accent-text);
}

.account-btn {
  height: 30px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.account-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.account-btn-primary {
  color: #07130f;
  border-color: transparent;
  background: linear-gradient(135deg, #5ce0b0, #5ea2f8);
}

.account-btn-primary:hover {
  color: #07130f;
  border-color: transparent;
  filter: brightness(1.04);
}

.toolbar,
.chart-panel {
  background: linear-gradient(180deg, var(--panel-raised), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(420px, auto);
  gap: 14px 20px;
  align-items: end;
  padding: 18px 20px;
  animation: rise 0.4s ease both;
}

.chart-panel {
  animation: rise 0.45s 0.06s ease both;
  display: flex;
  flex-direction: column;
}

/* порядок блоков: шапка → тулбар → sim-bar → график → легенда → метрики → DOM */
.chart-panel > .metrics {
  order: 1;
}
.chart-panel > .dom-panel {
  order: 2;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .toolbar,
  .chart-panel {
    animation: none;
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: 12px;
  background:
    linear-gradient(135deg, transparent 47%, rgba(255, 255, 255, 0.85) 48% 52%, transparent 53%),
    linear-gradient(135deg, #2fbf8f, #5ea2f8);
  box-shadow: 0 6px 18px rgba(47, 191, 143, 0.25);
}

h1 {
  margin: 0;
  font-size: 21px;
  font-weight: 750;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

#statusText {
  display: flex;
  align-items: center;
  gap: 7px;
}

#statusText::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--up);
  box-shadow: 0 0 6px rgba(46, 189, 133, 0.7);
}

#statusText.error::before {
  background: var(--down);
  box-shadow: 0 0 6px rgba(246, 70, 93, 0.7);
}

.quick {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  height: 28px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.chip:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.chip.active {
  color: var(--accent-text);
  border-color: rgba(47, 191, 143, 0.45);
  background: var(--accent-soft);
}

/* раскраска по дневному движению: сильный рост → насыщенный зелёный,
   слабый рост → тусклый зелёный, слабое падение → тусклый красный,
   сильное падение → насыщенный красный. .active (выбранный) сохраняет акцент. */
.chip:not(.active).chg-up-strong {
  color: #d6ffec;
  border-color: rgba(46, 189, 133, 0.7);
  background: rgba(46, 189, 133, 0.28);
}

.chip:not(.active).chg-up-soft {
  color: #7fd8b2;
  border-color: rgba(46, 189, 133, 0.32);
  background: rgba(46, 189, 133, 0.08);
}

.chip:not(.active).chg-down-soft {
  color: #e79aa6;
  border-color: rgba(246, 70, 93, 0.32);
  background: rgba(246, 70, 93, 0.08);
}

.chip:not(.active).chg-down-strong {
  color: #ffd9de;
  border-color: rgba(246, 70, 93, 0.7);
  background: rgba(246, 70, 93, 0.32);
}

/* дивиденды в этом месяце — жёлтая подсветка поверх цвета изменения */
.chip:not(.active).has-dividend {
  color: #2a2206;
  border-color: rgba(245, 197, 66, 0.9);
  background: rgba(245, 197, 66, 0.92);
  font-weight: 700;
}

/* относительная сила: акция идёт против рынка (сильнее при падении индекса или
   слабее при росте) — фиолетовый оттенок поверх обычной раскраски */
.chip:not(.active).chg-rs {
  color: #ece1ff;
  border-color: rgba(160, 120, 255, 0.85);
  background: rgba(140, 100, 255, 0.32);
  font-weight: 700;
}

.alert-toggle {
  margin-left: auto;
  height: 28px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.alert-toggle:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.alert-toggle.active {
  color: var(--accent-text);
  border-color: rgba(47, 191, 143, 0.45);
  background: var(--accent-soft);
}

.search {
  display: grid;
  grid-template-columns: minmax(160px, 240px) 124px;
  gap: 10px;
  align-items: end;
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  height: 44px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: rgba(10, 14, 21, 0.7);
  color: var(--text);
  padding: 0 14px;
  outline: none;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input::placeholder {
  color: var(--muted);
  font-weight: 500;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search button {
  height: 44px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: linear-gradient(180deg, #35cf9c, var(--accent-strong));
  color: #06281c;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 8px 20px rgba(47, 191, 143, 0.22);
  transition: filter 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.search button:hover {
  filter: brightness(1.07);
}

.search button:active {
  transform: translateY(1px);
}

.search button:disabled {
  cursor: wait;
  opacity: 0.6;
  box-shadow: none;
}

.chart-panel {
  margin-top: 16px;
  padding: 20px;
}

.chart-head {
  display: flex;
  gap: 20px;
  align-items: start;
}

.chart-ident {
  flex: 1;
  min-width: 0;
}

.chart-price {
  display: grid;
  justify-items: end;
  gap: 6px;
  flex: 0 0 auto;
}

.chart-price-value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.chart-price-change {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  background: rgba(140, 152, 171, 0.1);
}

.chart-price-change.positive {
  color: var(--up);
  background: rgba(46, 189, 133, 0.13);
}

.chart-price-change.negative {
  color: var(--down);
  background: rgba(246, 70, 93, 0.13);
}

.chart-price-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--up);
  background: rgba(46, 189, 133, 0.13);
}

.live-badge i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--up);
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.35;
    transform: scale(0.8);
  }
}

@media (prefers-reduced-motion: reduce) {
  .live-badge i {
    animation: none;
  }
}

.chart-title {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.chart-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.chart-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin-top: 14px;
  padding: 6px 8px;
  background: rgba(10, 14, 21, 0.45);
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
}

.toolbar-sep {
  align-self: stretch;
  width: 1px;
  margin: 3px 3px;
  background: var(--border);
}

.toolbar-spacer {
  flex: 1 1 0;
  min-width: 8px;
}

.periods,
.intervals {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: rgba(10, 14, 21, 0.6);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.period,
.interval {
  height: 30px;
  padding: 0 13px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease;
}

.period:hover:not(:disabled):not(.active),
.interval:hover:not(.active) {
  color: var(--text);
  background: rgba(140, 152, 171, 0.1);
}

.period.active,
.interval.active {
  background: var(--accent-soft);
  color: var(--accent-text);
}

.period:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.sim-toggle {
  height: 30px;
  padding: 0 13px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.sim-toggle:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.sim-toggle.active {
  color: var(--accent-text);
  border-color: rgba(47, 191, 143, 0.45);
  background: var(--accent-soft);
}

.dom-toggle {
  height: 30px;
  padding: 0 13px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.dom-toggle:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.dom-toggle.active {
  color: #ffd9a8;
  border-color: rgba(245, 158, 66, 0.5);
  background: rgba(245, 158, 66, 0.12);
}

.dom-toggle.locked {
  color: #f7c46c;
  border-color: rgba(232, 163, 61, 0.45);
  background: rgba(232, 163, 61, 0.1);
}

.dom-panel {
  margin-top: 14px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.dom-panel[hidden] {
  display: none;
}

.dom-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-bottom: 8px;
}

.dom-title {
  font-size: 13.5px;
}

.dom-status {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.dom-legend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.dom-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.dom-dot-bid {
  background: #2ebd85;
}

.dom-dot-ask {
  background: #f6465d;
  margin-left: 8px;
}

.dom-readout {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 8px;
}

.dom-verdict {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.dom-verdict.positive {
  color: #5ce0b0;
}

.dom-verdict.negative {
  color: #ff8a9a;
}

.dom-verdict.neutral {
  color: var(--muted);
}

.dom-verdict.warning {
  color: #f7c46c;
}

.dom-iceberg {
  font-size: 12.5px;
  font-weight: 600;
  color: #cbb3ff;
  background: rgba(140, 100, 255, 0.14);
  border: 1px solid rgba(160, 120, 255, 0.45);
  border-radius: 999px;
  padding: 2px 10px;
}

.dom-iceberg[hidden] {
  display: none;
}

.dom-wrap {
  position: relative;
  width: 100%;
  height: 320px;
  background: #070b11;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.dom-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.dom-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
  pointer-events: none;
}

.dom-hint[hidden] {
  display: none;
}

.sim-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  padding: 8px 12px;
  background: rgba(10, 14, 21, 0.6);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.sim-btn {
  width: 34px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text);
  font-size: 13px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.sim-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.sim-bar input[type="range"] {
  flex: 1;
  min-width: 120px;
  height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: var(--accent);
}

.sim-bar input[type="range"]:focus {
  box-shadow: none;
}

.sim-info {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.sim-speed {
  width: auto;
  height: 30px;
  padding: 0 8px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.metrics > div {
  background: linear-gradient(180deg, rgba(140, 152, 171, 0.06), rgba(140, 152, 171, 0.015));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  min-width: 0;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.metrics > div:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metrics strong {
  display: block;
  margin-top: 7px;
  overflow-wrap: anywhere;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.metrics small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

.metrics strong.positive,
.metrics strong.negative,
.metrics strong.neutral,
.metrics strong.warning {
  display: inline-block;
  margin-top: 8px;
  padding: 2px 10px;
  border-radius: 7px;
  font-size: 14px;
}

.metrics strong.positive {
  background: rgba(46, 189, 133, 0.12);
}

.metrics strong.negative {
  background: rgba(246, 70, 93, 0.12);
}

.metrics strong.warning {
  background: rgba(232, 163, 61, 0.12);
}

.metrics strong.neutral {
  background: rgba(140, 152, 171, 0.12);
}

.positive {
  color: var(--up);
}

.negative {
  color: var(--down);
}

.neutral {
  color: var(--muted);
}

.warning {
  color: var(--warning);
}

.chart-wrap {
  position: relative;
  width: 100%;
  height: min(130vh, 1800px);
  min-height: 1000px;
  margin-top: 0;
  border: 1px solid var(--border);
  border-radius: 0 0 12px 12px;
  overflow: hidden;
  background: var(--chart-bg);
  cursor: crosshair;
  touch-action: pan-y;
}

.chart-wrap.pannable {
  cursor: grab;
}

.chart-wrap.panning {
  cursor: grabbing;
}

.chart-wrap.selecting {
  cursor: pointer;
}

.reset-zoom {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  height: 28px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: rgba(13, 18, 25, 0.85);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.reset-zoom:hover {
  color: var(--text);
  border-color: var(--accent);
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.chart-wrap.loading::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  background: rgba(13, 18, 25, 0.45);
}

.chart-wrap.loading::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  z-index: 5;
  border-radius: 50%;
  border: 3px solid rgba(140, 152, 171, 0.25);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

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

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-hint {
  margin-left: auto;
  opacity: 0.7;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.dot-up {
  background: var(--chart-up);
}

.dot-down {
  background: var(--chart-down);
}

.dot-boll {
  background: #60a5fa;
}

.dot-basis {
  background: var(--chart-boll-basis);
}

.dot-vwap {
  background: var(--chart-vwap);
}

.dot-ppo {
  background: var(--chart-ppo);
}

.dot-reflex {
  background: var(--chart-reflex);
}

.dot-trendflex {
  background: var(--chart-trendflex);
}

.dot-cvd {
  background: var(--chart-boll-basis);
}

.dot-hurst {
  background: var(--chart-hurst);
}

.dot-profile {
  background: #fb923c;
}

.dot-levels {
  background: var(--chart-level-opening);
}

.dot-avwap {
  background: var(--chart-vwap);
}

.dot-cusum {
  background: var(--warning);
}

.tooltip {
  position: absolute;
  z-index: 3;
  min-width: 170px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: rgba(13, 18, 25, 0.92);
  backdrop-filter: blur(10px);
  box-shadow: 0 16px 32px rgba(2, 6, 12, 0.55);
  color: var(--text);
  pointer-events: none;
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.5;
}

.tooltip .tt-sep {
  border-top: 1px solid var(--border-strong);
  margin: 6px 0;
}

.tooltip .tt-fp i {
  font-style: normal;
}

.tooltip .fp-buy {
  color: var(--up);
}

.tooltip .fp-sell {
  color: var(--down);
}

.tooltip .tt-date {
  font-weight: 700;
  margin-bottom: 6px;
}

.tooltip .tt-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  color: var(--muted);
}

.tooltip .tt-row b {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.tooltip .tt-up b {
  color: var(--up);
}

.tooltip .tt-down b {
  color: var(--down);
}

.error {
  color: var(--danger);
}

.footnote {
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
  opacity: 0.75;
}

.toasts {
  position: fixed;
  top: 12px;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 8px;
  padding: 0 16px;
  pointer-events: none;
}

.toast {
  position: relative;
  width: min(300px, calc(100vw - 32px));
  pointer-events: auto;
  background: rgba(13, 18, 25, 0.95);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 11px 14px;
  cursor: pointer;
  box-shadow: 0 16px 32px rgba(2, 6, 12, 0.55);
  animation: toast-in 0.25s ease;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.up {
  border-left-color: var(--up);
}

.toast.down {
  border-left-color: var(--down);
}

.toast-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--accent);
  color: #08111a;
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(2, 6, 12, 0.55);
}

.toast.up .toast-badge {
  background: var(--up);
}

.toast.down .toast-badge {
  background: var(--down);
}

@keyframes toast-bump {
  0% {
    transform: scale(1);
  }
  35% {
    transform: scale(1.06);
  }
  100% {
    transform: scale(1);
  }
}

.toast.toast-bump {
  animation: toast-bump 0.4s ease;
}

.toast strong {
  display: block;
  font-size: 13.5px;
}

.toast span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.toast.toast-out {
  opacity: 0;
  transform: translateY(-6px);
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(3, 7, 12, 0.68);
  backdrop-filter: blur(10px);
}

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

.auth-dialog {
  position: relative;
  width: min(430px, 100%);
  padding: 18px;
  background: linear-gradient(180deg, var(--panel-raised), var(--panel));
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.auth-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}

.auth-close:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.auth-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-right: 42px;
  background: rgba(10, 14, 21, 0.72);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.auth-tab {
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.auth-tab.active {
  background: var(--accent-soft);
  color: var(--accent-text);
}

.auth-dialog h2 {
  margin: 16px 0 12px;
  font-size: 22px;
  line-height: 1.15;
}

.auth-message {
  margin: 0 0 12px;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid rgba(246, 70, 93, 0.35);
  background: rgba(246, 70, 93, 0.1);
  color: #ff9aaa;
  font-size: 13px;
}

.auth-message.success {
  border-color: rgba(47, 191, 143, 0.38);
  background: var(--accent-soft);
  color: var(--accent-text);
}

.auth-form,
.redeem-form {
  display: grid;
  gap: 12px;
}

.auth-field {
  display: grid;
  gap: 6px;
}

.auth-field span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.auth-field input {
  height: 42px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: rgba(10, 14, 21, 0.78);
  color: var(--text);
  padding: 0 12px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-field input:focus {
  border-color: rgba(47, 191, 143, 0.75);
  box-shadow: 0 0 0 3px rgba(47, 191, 143, 0.13);
}

.auth-submit,
.auth-secondary {
  height: 42px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 800;
}

.auth-submit {
  border: 0;
  background: linear-gradient(135deg, #5ce0b0, #5ea2f8);
  color: #07130f;
}

.auth-secondary {
  width: 100%;
  margin-top: 12px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
}

.auth-secondary:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.profile-panel {
  display: grid;
  gap: 12px;
}

.profile-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.profile-row span {
  color: var(--muted);
  font-size: 12px;
}

.profile-row strong {
  color: var(--text);
  font-size: 13px;
  text-align: right;
  overflow-wrap: anywhere;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
}

@media (max-width: 860px) {
  .account-topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .account-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

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

  .search {
    grid-template-columns: minmax(0, 1fr) 124px;
  }

  .chart-head {
    display: grid;
  }

  .chart-price {
    justify-items: start;
  }

  .chart-controls {
    justify-items: stretch;
  }

  .periods,
  .intervals {
    width: 100%;
  }

  .period,
  .interval {
    flex: 1;
    padding: 0 6px;
  }

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

@media (max-width: 520px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding: 10px 0 24px;
  }

  .toolbar,
  .chart-panel {
    padding: 14px;
  }

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

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

  .chart-wrap {
    height: 760px;
    min-height: 760px;
  }
}
