:root {
  --bg: #0b0f14;
  --bg-soft: #111821;
  --panel: #121922;
  --panel-2: #0f151d;
  --panel-3: #111821;
  --line: rgba(148, 163, 184, 0.18);
  --text: #e5eef7;
  --muted: #94a3b8;
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.12);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.12);
  --yellow: #f59e0b;
  --glow: 0 14px 34px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.06), transparent 24rem),
    linear-gradient(180deg, #0b0f14 0%, #080b10 100%);
}

body::before {
  content: none;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 18%, rgba(34, 197, 94, 0.2), transparent 24rem),
    radial-gradient(circle at 85% 72%, rgba(245, 158, 11, 0.1), transparent 22rem),
    linear-gradient(180deg, #0b0f14 0%, #080b10 100%);
}

.matrix-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.88;
}

.login-body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(8, 11, 16, 0.58), rgba(8, 11, 16, 0.18), rgba(8, 11, 16, 0.62)),
    radial-gradient(circle at center, transparent 0, rgba(8, 11, 16, 0.68) 78%);
}

.login-shell {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(320px, 460px) minmax(280px, 420px);
  width: min(960px, 100%);
  min-height: 560px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(18, 25, 34, 0.88);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.48), 0 0 80px rgba(34, 197, 94, 0.08);
  backdrop-filter: blur(18px);
}

.login-panel,
.login-aside {
  padding: 44px;
}

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: linear-gradient(180deg, rgba(18, 25, 34, 0.94), rgba(13, 19, 27, 0.94));
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 34px;
}

.login-brand h1 {
  font-size: 30px;
}

.login-form {
  display: grid;
  gap: 16px;
}

.login-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.login-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 15px;
  color: var(--text);
  font-size: 15px;
  background: rgba(8, 11, 16, 0.72);
  outline: none;
}

.login-form input:focus {
  border-color: rgba(34, 197, 94, 0.62);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.12);
}

.login-error {
  border: 1px solid rgba(239, 68, 68, 0.28);
  border-radius: 8px;
  padding: 12px 14px;
  color: #fecaca;
  background: rgba(239, 68, 68, 0.12);
}

.login-aside {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 26px;
  background:
    linear-gradient(180deg, rgba(34, 197, 94, 0.15), rgba(245, 158, 11, 0.07)),
    rgba(16, 23, 32, 0.9);
}

.login-aside h2 {
  max-width: 340px;
  font-size: 28px;
  line-height: 1.12;
}

.login-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.login-stat-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(8, 11, 16, 0.45);
}

.login-stat-grid span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.login-stat-grid strong {
  color: var(--text);
}

@media (max-width: 760px) {
  .login-shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .login-panel,
  .login-aside {
    padding: 28px;
  }

  .login-aside {
    min-height: 240px;
  }
}

.ticker-shell {
  position: sticky;
  top: 0;
  z-index: 20;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: rgba(4, 10, 6, 0.94);
  backdrop-filter: blur(16px);
}

.ticker-tape {
  overflow: hidden;
  padding: 10px 0;
}

.ticker-track {
  display: flex;
  width: max-content;
  animation: tickerScroll 45s linear infinite;
  will-change: transform;
}

.ticker-strip {
  display: flex;
  gap: 10px;
  padding-inline: 14px;
}

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--text);
  white-space: nowrap;
  background: var(--panel-2);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.ticker-item:hover {
  transform: translateY(-1px);
  border-color: rgba(94, 255, 127, 0.35);
}

.ticker-item.pulse-up {
  box-shadow: 0 0 0 1px rgba(94, 255, 127, 0.16), 0 0 28px rgba(94, 255, 127, 0.14);
}

.ticker-item.pulse-down {
  box-shadow: 0 0 0 1px rgba(255, 94, 108, 0.16), 0 0 28px rgba(255, 94, 108, 0.14);
}

.ticker-item em,
.watch-right em,
.delta {
  font-style: normal;
  font-weight: 800;
}

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

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

.desk {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 360px;
  gap: 16px;
  width: min(1600px, calc(100% - 24px));
  margin: 14px auto 20px;
}

.left-rail,
.right-rail,
.center-stage {
  min-width: 0;
}

.brand-card,
.rail-panel,
.desk-panel,
.trade-box,
.chart-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(18, 25, 34, 0.98), rgba(13, 19, 27, 0.98));
  box-shadow: var(--glow);
}

.brand-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px;
  margin-bottom: 16px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  color: #051009;
  font-weight: 900;
  letter-spacing: 0.08em;
  background: linear-gradient(135deg, var(--green), #aaff60);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 34px;
  letter-spacing: -0.04em;
}

h2 {
  font-size: 18px;
  letter-spacing: -0.03em;
}

.rail-panel,
.desk-panel,
.trade-box {
  padding: 18px;
  margin-bottom: 16px;
}

.compact {
  padding-bottom: 16px;
}

.rail-head,
.headline-bar,
.price-row,
.position-top,
.trade-top,
.performance-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  background: var(--green-soft);
}

.badge.live::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(94, 255, 127, 0.4);
  animation: pulse 1.4s infinite;
}

.watchlist,
.position-stack,
.ledger-stack,
.recommendation-stack,
.news-feed {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.watch-item,
.reco-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  color: var(--text);
  text-align: left;
  background: var(--panel-3);
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
  width: 100%;
}

.watch-item:hover,
.reco-card:hover,
.position-card:hover,
.ledger-card:hover {
  transform: translateY(-1px);
  border-color: rgba(34, 197, 94, 0.42);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(34, 197, 94, 0.08);
}

.watch-item.selected {
  border-color: rgba(94, 255, 127, 0.55);
  background: rgba(94, 255, 127, 0.08);
}

.watchlist-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 14px;
}

.watchlist-form input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  color: var(--text);
  background: rgba(8, 11, 16, 0.72);
  outline: none;
}

.watchlist-form input:focus {
  border-color: rgba(34, 197, 94, 0.55);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.watch-remove {
  position: absolute;
  right: 8px;
  top: 8px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 50%;
  color: var(--muted);
  background: rgba(8, 11, 16, 0.74);
  cursor: pointer;
  transition: transform 140ms ease, color 140ms ease, border-color 140ms ease;
}

.watch-remove:hover {
  color: #fecaca;
  border-color: rgba(239, 68, 68, 0.4);
  transform: scale(1.06);
}

.watch-item strong,
.symbol {
  font-weight: 900;
}

.watch-item span,
.news-item span,
.muted-stamp {
  color: var(--muted);
  font-size: 12px;
}

.watch-right {
  text-align: right;
}

.watch-item,
.position-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.headline-bar {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 16px;
  background: linear-gradient(180deg, rgba(18, 25, 34, 0.98), rgba(13, 19, 27, 0.98));
  box-shadow: var(--glow);
}

.price-row h2 {
  font-size: 28px;
}

.price-row strong {
  font-size: 44px;
  letter-spacing: -0.05em;
}

.head-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.action-button,
.ghost-button {
  border-radius: 8px;
  padding: 12px 16px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease, filter 120ms ease, background 120ms ease;
}

.action-button {
  border: 0;
  color: #041009;
  background: linear-gradient(135deg, var(--green), #7aff5e);
  box-shadow: 0 12px 34px rgba(94, 255, 127, 0.2);
}

.action-button:hover {
  filter: brightness(1.08);
  box-shadow: 0 14px 34px rgba(94, 255, 127, 0.28);
}

.action-button:active,
.ghost-button:active,
.timeframe-button:active,
.ticker-item:active,
.reco-card:active,
.watch-item:active {
  transform: translateY(1px) scale(0.98);
}

.button-pop {
  animation: buttonPop 180ms ease;
}

button:disabled {
  opacity: 0.62;
  cursor: progress;
}

.action-button.submit {
  width: 100%;
}

.ghost-button {
  border: 1px solid var(--line);
  color: var(--text);
  background: transparent;
}

.ghost-button:hover {
  border-color: rgba(34, 197, 94, 0.42);
  background: rgba(34, 197, 94, 0.08);
  box-shadow: 0 8px 22px rgba(34, 197, 94, 0.08);
}

.ghost-button.small {
  padding: 8px 10px;
  font-size: 12px;
}

.chart-panel {
  padding: 18px;
}

.chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.timeframe-group {
  display: inline-flex;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(7, 12, 9, 0.88);
}

.timeframe-button {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  color: var(--muted);
  font-weight: 900;
  background: transparent;
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.timeframe-button.active {
  color: #051009;
  background: linear-gradient(135deg, var(--green), #b6ff7a);
  box-shadow: 0 10px 22px rgba(94, 255, 127, 0.18);
}

.timeframe-button:hover {
  transform: translateY(-1px);
}

.chart-meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.meta-box,
.mini-metric,
.metric {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: rgba(15, 22, 16, 0.92);
}

.meta-box span,
.mini-metric span,
.metric span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.meta-box strong,
.mini-metric strong,
.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 18px;
}

.chart-stage {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0c1219;
}

.chart-svg {
  display: block;
  width: 100%;
  height: 420px;
  transform-origin: center bottom;
}

.chart-svg.chart-animate {
  animation: chartFloat 420ms ease-out;
}

.chart-bg {
  fill: transparent;
}

.grid-line {
  stroke: rgba(124, 145, 130, 0.18);
  stroke-width: 1;
  stroke-dasharray: 6 8;
}

.axis-label {
  fill: #607364;
  font-size: 11px;
}

.chart-line {
  fill: none;
  stroke: var(--green);
  stroke-width: 1.4;
  opacity: 0.82;
}

.tick-line {
  fill: none;
  stroke: #d2ff72;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: none;
}

.chart-area {
  fill: url(#areaFill);
}

.wick {
  stroke-width: 1.4;
}

.wick.up,
.candle.up,
.volume.up {
  stroke: var(--green);
  fill: rgba(34, 197, 94, 0.82);
}

.wick.down,
.candle.down,
.volume.down {
  stroke: var(--red);
  fill: rgba(239, 68, 68, 0.78);
}

.price-guide {
  stroke: rgba(94, 255, 127, 0.28);
  stroke-width: 1;
  stroke-dasharray: 4 8;
}

.price-dot {
  fill: var(--green);
  filter: none;
}

.chart-pulse {
  position: absolute;
  right: 22px;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(94, 255, 127, 0.92);
  box-shadow: 0 0 0 0 rgba(94, 255, 127, 0.36);
  transform: translateY(-50%);
  opacity: 0;
}

.chart-pulse.active {
  opacity: 1;
  animation: pulse 1.4s infinite;
}

.chart-overlay {
  position: static;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  width: 100%;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: rgba(15, 21, 29, 0.72);
}

.overlay-box {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 24, 34, 0.92);
}

.overlay-box span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.overlay-box strong {
  display: block;
  margin-top: 8px;
  font-size: 18px;
}

.analysis-strip {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  color: var(--yellow);
  font-size: 14px;
  line-height: 1.6;
  background: rgba(210, 255, 114, 0.08);
}

.bottom-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.news-item {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(11, 17, 12, 0.9);
}

.news-item p {
  line-height: 1.45;
}

.returns-grid {
  grid-template-columns: repeat(5, 1fr);
}

.trade-form {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.trade-form input,
.trade-form select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  color: var(--text);
  background: #0b120d;
  outline: none;
}

.dual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.position-card,
.reco-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(11, 17, 12, 0.9);
}

.watch-item,
.position-card,
.reco-card {
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.watch-item:hover,
.position-card:hover,
.reco-card:hover {
  transform: translateY(-2px);
  border-color: rgba(94, 255, 127, 0.26);
}

.position-card.compact .symbol,
.reco-card .symbol.small {
  font-size: 18px;
}

.position-card.compact .metrics,
.reco-card .metrics.compact {
  grid-template-columns: repeat(3, 1fr);
}

.position-card .metrics,
.reco-card .metrics {
  display: grid;
  gap: 1px;
  padding: 0 12px 12px;
}

.position-card .position-top,
.reco-card .position-top {
  padding: 14px 14px 10px;
}

.metric.up strong,
.mini-metric.up strong,
.score-pill,
.delta.up {
  color: var(--green);
}

.metric.down strong,
.mini-metric.down strong,
.delta.down {
  color: var(--red);
}

.score-pill {
  font-size: 18px;
}

.position-card.up {
  border-color: rgba(94, 255, 127, 0.24);
}

.position-card.down {
  border-color: rgba(255, 94, 108, 0.24);
}

.position-detail-row,
.ledger-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 0 14px 12px;
  color: var(--muted);
  font-size: 12px;
}

.position-detail-row {
  border-top: 1px solid rgba(96, 131, 88, 0.12);
  margin-top: 6px;
  padding-top: 12px;
  flex-wrap: wrap;
}

.ledger-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 0 8px;
  background: rgba(11, 17, 12, 0.9);
}

.ledger-card.up {
  border-color: rgba(94, 255, 127, 0.24);
}

.ledger-card.down {
  border-color: rgba(255, 94, 108, 0.24);
}

.ledger-card .position-top {
  padding: 0 14px 10px;
}

.ledger-line.muted {
  color: #6b7d70;
}

.auto-controls,
.action-feed,
.mini-grid {
  display: grid;
  gap: 10px;
}

.auto-controls {
  grid-template-columns: 1fr 1fr;
  margin-bottom: 12px;
}

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

.action-feed {
  margin-top: 12px;
}

.action-pill {
  border-radius: 999px;
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 900;
}

.action-pill.open {
  color: var(--green);
  background: var(--green-soft);
}

.action-pill.close {
  color: var(--red);
  background: var(--red-soft);
}

.empty-state {
  padding: 20px 8px;
  color: var(--muted);
  text-align: center;
}

.empty-state.compact {
  padding: 8px 4px;
  text-align: left;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(94, 255, 127, 0.36);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(94, 255, 127, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(94, 255, 127, 0);
  }
}

@keyframes tickerScroll {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

@keyframes buttonPop {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(0.96);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes chartFloat {
  from {
    opacity: 0.72;
    transform: translateY(6px) scale(0.996);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 1320px) {
  .desk {
    grid-template-columns: 280px 1fr;
  }

  .right-rail {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
}

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

  .right-rail,
  .bottom-grid,
  .chart-meta,
  .chart-overlay,
  .returns-grid,
  .position-card.compact .metrics,
  .reco-card .metrics.compact,
  .auto-controls,
  .dual {
    grid-template-columns: 1fr;
  }

  .right-rail {
    display: block;
  }

  .price-row {
    flex-wrap: wrap;
  }

  .chart-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}
