:root {
  color-scheme: dark;
  --bg: #070b16;
  --surface: rgba(13, 22, 42, 0.82);
  --surface-2: rgba(19, 31, 58, 0.92);
  --ink: #edf5ff;
  --muted: #8da0be;
  --line: rgba(129, 156, 206, 0.22);
  --accent: #26d9ff;
  --accent-2: #72f6a1;
  --accent-3: #ff5d73;
  --good: #72f6a1;
  --bad: #ff5d73;
  --warn: #ffb84d;
  --panel-glow: 0 0 0 1px rgba(38, 217, 255, 0.06), 0 0 40px rgba(38, 217, 255, 0.08);
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% -8%, rgba(37, 99, 235, 0.28), transparent 30%),
    radial-gradient(circle at 90% 4%, rgba(20, 184, 166, 0.16), transparent 32%),
    linear-gradient(135deg, #030712, #07111f 45%, #030712);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.82), rgba(0, 0, 0, 0.18));
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent 0 49.7%, rgba(38, 217, 255, 0.07) 50%, transparent 50.3%),
    linear-gradient(180deg, transparent 0 49.7%, rgba(114, 246, 161, 0.045) 50%, transparent 50.3%);
  background-size: 520px 520px;
  opacity: 0.35;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app {
  width: min(1560px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 18px 0 34px;
  min-height: 100vh;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
}

.app-nav {
  position: sticky;
  top: 18px;
  height: calc(100vh - 36px);
  min-height: 680px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.94), rgba(2, 6, 23, 0.88)),
    linear-gradient(135deg, rgba(38, 217, 255, 0.08), transparent);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.app-nav::before {
  content: "";
  position: absolute;
  inset: -40% -80% auto auto;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(38, 217, 255, 0.16), transparent 66%);
  pointer-events: none;
}

.app-main {
  min-width: 0;
  overflow: hidden;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(38, 217, 255, 0.45);
  border-radius: 14px;
  background: rgba(38, 217, 255, 0.12);
  color: var(--accent);
  font-weight: 900;
  letter-spacing: -0.08em;
}

.brand-block h1 {
  font-size: 20px;
}

.nav-menu {
  display: grid;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.nav-item {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  text-align: left;
  font-weight: 800;
}

.nav-item.active {
  border-color: rgba(38, 217, 255, 0.5);
  background: linear-gradient(135deg, rgba(38, 217, 255, 0.2), rgba(114, 246, 161, 0.1));
  color: var(--ink);
  box-shadow: 0 0 34px rgba(38, 217, 255, 0.1);
}

.nav-card {
  margin-top: auto;
  display: grid;
  gap: 7px;
  padding: 14px;
  border: 1px solid rgba(114, 246, 161, 0.24);
  border-radius: 16px;
  background: rgba(114, 246, 161, 0.08);
  color: var(--muted);
  position: relative;
  z-index: 1;
}

.nav-card strong {
  color: var(--accent-2);
}

.nav-card span,
.nav-card small {
  font-size: 12px;
}

.view-panel {
  display: none;
  min-width: 0;
}

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

.protected-gate {
  display: none;
}

.view-panel.auth-locked > :not(.protected-gate) {
  display: none !important;
}

.view-panel.auth-locked > .protected-gate {
  min-height: calc(100vh - 36px);
  display: grid;
  place-items: center;
}

.protected-gate-card {
  width: min(480px, 100%);
  display: grid;
  gap: 14px;
  padding: 22px;
  border: 1px solid rgba(38, 217, 255, 0.24);
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(38, 217, 255, 0.11), transparent 36%),
    linear-gradient(180deg, rgba(10, 18, 37, 0.96), rgba(4, 8, 18, 0.94));
  box-shadow: var(--panel-glow), var(--shadow);
}

.protected-gate-card p {
  color: var(--muted);
  line-height: 1.55;
}

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

.protected-form input {
  min-width: 0;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 14px;
  outline: none;
  color: var(--ink);
  background: rgba(2, 6, 23, 0.42);
}

.protected-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(38, 217, 255, 0.12);
}

.protected-message {
  min-height: 18px;
  color: var(--warn);
  font-size: 13px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 4px 0 18px;
  min-width: 0;
}

.hero-topbar p,
.topbar p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.5;
}

.hero-topbar {
  position: relative;
  min-height: 116px;
  margin-bottom: 14px;
  padding: 22px;
  border: 1px solid rgba(38, 217, 255, 0.2);
  border-radius: 24px;
  background:
    linear-gradient(120deg, rgba(38, 217, 255, 0.12), transparent 42%),
    radial-gradient(circle at 92% 12%, rgba(114, 246, 161, 0.16), transparent 30%),
    rgba(5, 10, 22, 0.76);
  box-shadow: var(--panel-glow), var(--shadow);
  overflow: hidden;
}

.hero-topbar::after {
  content: "";
  position: absolute;
  inset: auto 22px 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent-2), transparent);
  opacity: 0.8;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  margin-top: 4px;
  font-size: 30px;
  line-height: 1.1;
  font-weight: 760;
}

h2 {
  font-size: 18px;
  line-height: 1.3;
}

.toolbar,
.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.segmented,
.refresh,
.market-filter,
.asset-filter {
  min-height: 36px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  border-radius: 999px;
  padding: 0 14px;
  font-weight: 680;
}

.segmented.active,
.market-filter.active,
.asset-filter.active {
  color: #061018;
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.refresh {
  border-color: transparent;
  color: #061018;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.status-strip {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: rgba(8, 15, 31, 0.72);
  border-radius: 16px;
  color: var(--muted);
  font-size: 13px;
  min-width: 0;
}

.status-strip strong {
  color: var(--ink);
}

.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 16px;
  min-width: 0;
}

.sidebar,
.chart-section,
.panel,
.table-section,
.kpi-card {
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.88), rgba(8, 13, 28, 0.86)),
    rgba(15, 23, 42, 0.72);
  box-shadow: var(--shadow);
  border-radius: 18px;
  backdrop-filter: blur(18px);
}

.sidebar {
  position: sticky;
  top: 16px;
  height: calc(100vh - 32px);
  min-height: 620px;
  padding: 14px;
  overflow: auto;
  min-width: 0;
}

.filter-row {
  margin-bottom: 12px;
}

.market-filter,
.asset-filter {
  flex: 1 1 76px;
  padding: 0 8px;
}

.asset-filter-row {
  margin-bottom: 8px;
}

.instrument-list {
  display: grid;
  gap: 8px;
}

.instrument-button {
  width: 100%;
  min-height: 66px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  background: rgba(15, 23, 42, 0.72);
  color: var(--ink);
  text-align: left;
  border-radius: 14px;
  display: grid;
  gap: 5px;
}

.instrument-button.active {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(38, 217, 255, 0.2), rgba(114, 246, 161, 0.08));
  box-shadow: inset 0 0 0 1px rgba(38, 217, 255, 0.18), 0 12px 36px rgba(38, 217, 255, 0.08);
}

.instrument-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 760;
  line-height: 1.25;
}

.instrument-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--accent);
}

.instrument-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.workspace {
  display: grid;
  gap: 16px;
  min-width: 0;
  overflow: hidden;
}

.strategy-kpi-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 16px;
  min-width: 0;
}

.terminal-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.terminal-summary-item {
  position: relative;
  min-height: 82px;
  padding: 13px 14px;
  border: 1px solid rgba(129, 156, 206, 0.18);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(38, 217, 255, 0.11), transparent 38%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.86), rgba(5, 10, 22, 0.82));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), var(--panel-glow);
  overflow: hidden;
}

.terminal-summary-item::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: 0.65;
}

.terminal-summary-item span,
.terminal-summary-item small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.terminal-summary-item strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.terminal-summary-item small {
  margin-top: 7px;
}

.terminal-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 14px;
  align-items: start;
  min-width: 0;
}

.terminal-main,
.terminal-side {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.terminal-side {
  position: sticky;
  top: 18px;
}

.strategy-card {
  position: relative;
  min-height: 110px;
  padding: 13px 14px;
  border: 1px solid rgba(129, 156, 206, 0.2);
  border-left: 3px solid var(--strategy-color);
  border-radius: 16px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--strategy-color) 13%, transparent), transparent 40%),
    linear-gradient(180deg, rgba(12, 20, 39, 0.95), rgba(5, 10, 22, 0.9));
  box-shadow: 0 0 28px color-mix(in srgb, var(--strategy-color) 10%, transparent);
  overflow: hidden;
  min-width: 0;
}

.strategy-card::after {
  display: none;
}

.strategy-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.strategy-card-head strong {
  color: var(--ink);
}

.strategy-row-numbers {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 11px;
}

.strategy-equity {
  margin-top: 0;
  font-size: 25px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.strategy-return {
  margin-top: 0;
  font-size: 14px;
  font-weight: 850;
}

.strategy-card .up,
#tradeBody .up,
#positionBody .up {
  color: var(--good);
}

.strategy-card .down,
#tradeBody .down,
#positionBody .down {
  color: var(--bad);
}

.strategy-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
}

.strategy-metrics span {
  min-height: 25px;
  padding: 5px 7px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.strategy-position-chip {
  display: inline-flex;
  margin-top: 9px;
  min-height: 24px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  font-size: 11px;
  font-weight: 800;
}

.strategy-position-chip.live {
  color: #061018;
  background: var(--strategy-color);
}

.strategy-log-button {
  width: fit-content;
  min-height: 30px;
  margin-top: 10px;
  padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--strategy-color) 42%, rgba(129, 156, 206, 0.18));
  border-radius: 999px;
  background: color-mix(in srgb, var(--strategy-color) 10%, rgba(255, 255, 255, 0.04));
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
  box-shadow: 0 0 16px color-mix(in srgb, var(--strategy-color) 10%, transparent);
}

.strategy-log-button:hover {
  border-color: var(--strategy-color);
  color: var(--strategy-color);
}

.strategy-log-button.wide {
  width: 100%;
}

.strategy-chart-section {
  margin-bottom: 0;
}

.strategy-chart-shell {
  background:
    linear-gradient(180deg, rgba(12, 22, 45, 0.9), rgba(5, 9, 20, 0.94)),
    radial-gradient(circle at 20% 15%, rgba(38, 217, 255, 0.12), transparent 34%);
}

.terminal-card-primary .chart-shell {
  height: min(52vh, 560px);
  min-height: 420px;
}

.signal-board-body {
  display: grid;
  gap: 12px;
}

.signal-board-main {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(38, 217, 255, 0.08);
  border: 1px solid rgba(38, 217, 255, 0.18);
}

.signal-state {
  width: fit-content;
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  color: #061018;
  background: var(--accent);
  font-size: 11px;
  font-weight: 900;
}

.signal-board-main strong {
  font-size: 28px;
  line-height: 1;
  letter-spacing: -0.03em;
}

.signal-board-main small {
  color: var(--muted);
}

.signal-board-grid {
  display: grid;
  gap: 8px;
  margin: 0;
}

.signal-board-grid div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.signal-board-grid dt,
.signal-board-grid dd {
  margin: 0;
  font-size: 12px;
}

.signal-board-grid dt {
  color: var(--muted);
}

.signal-board-grid dd {
  color: var(--ink);
  font-weight: 800;
  text-align: right;
}

.signal-notes {
  display: grid;
  gap: 7px;
}

.signal-notes p {
  padding: 9px 10px;
  border-left: 2px solid var(--warn);
  border-radius: 10px;
  background: rgba(255, 184, 77, 0.07);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.live-crypto-panel,
.strategy-ops-panel,
.log-console-panel {
  background:
    linear-gradient(135deg, rgba(38, 217, 255, 0.08), transparent 34%),
    linear-gradient(180deg, rgba(9, 16, 34, 0.94), rgba(4, 8, 18, 0.92));
  box-shadow: var(--panel-glow), var(--shadow);
}

.live-crypto-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
}

.live-crypto-card {
  position: relative;
  min-width: 0;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--strategy-color) 34%, rgba(129, 156, 206, 0.18));
  border-radius: 16px;
  background:
    radial-gradient(circle at 100% 0, color-mix(in srgb, var(--strategy-color) 16%, transparent), transparent 34%),
    linear-gradient(180deg, rgba(10, 18, 37, 0.96), rgba(4, 8, 18, 0.94));
  overflow: hidden;
}

.live-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.live-summary-grid div {
  min-width: 0;
  padding: 9px;
  border: 1px solid rgba(129, 156, 206, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.live-summary-grid span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.live-summary-grid strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.live-event-list {
  display: grid;
  gap: 7px;
  margin-top: 11px;
}

.live-event-list div {
  display: grid;
  grid-template-columns: 132px 72px minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
  padding: 8px 9px;
  border-radius: 10px;
  background: rgba(2, 6, 23, 0.58);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
}

.live-event-list time {
  color: rgba(237, 245, 255, 0.6);
}

.live-event-list span {
  font-weight: 900;
}

.live-event-list p {
  color: var(--muted);
  line-height: 1.45;
}

.live-event-list .up {
  color: var(--good);
}

.live-event-list .down {
  color: var(--bad);
}

.live-event-list .warn {
  color: var(--warn);
}

.strategy-ops-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
}

.ops-card {
  position: relative;
  min-width: 0;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--strategy-color) 34%, rgba(129, 156, 206, 0.18));
  border-radius: 16px;
  background:
    radial-gradient(circle at 100% 0, color-mix(in srgb, var(--strategy-color) 18%, transparent), transparent 34%),
    linear-gradient(180deg, rgba(10, 18, 37, 0.96), rgba(4, 8, 18, 0.94));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025);
  overflow: hidden;
}

.ops-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--strategy-color);
  box-shadow: 0 0 18px var(--strategy-color);
}

.ops-card-head,
.ops-gridline,
.ops-detail-grid {
  display: grid;
  gap: 8px;
}

.ops-card-head {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.ops-card-head span,
.ops-detail-grid span,
.ops-gridline small {
  color: var(--muted);
  font-size: 11px;
}

.ops-card-head strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 15px;
}

.status-dot {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}

.status-dot::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 10px currentColor;
}

.status-dot.up {
  background: rgba(114, 246, 161, 0.12);
  color: var(--good);
}

.status-dot.down {
  background: rgba(255, 93, 115, 0.12);
  color: var(--bad);
}

.status-dot.warn {
  background: rgba(255, 184, 77, 0.12);
  color: var(--warn);
}

.ops-gridline {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 14px;
}

.ops-gridline > div,
.ops-detail-grid > div {
  min-width: 0;
  padding: 9px;
  border: 1px solid rgba(129, 156, 206, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.ops-gridline strong,
.ops-detail-grid strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ops-detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 8px;
}

.ops-position {
  display: grid;
  gap: 5px;
  margin-top: 10px;
  padding: 11px;
  border-radius: 13px;
  background: color-mix(in srgb, var(--strategy-color) 10%, rgba(255, 255, 255, 0.035));
  border: 1px solid color-mix(in srgb, var(--strategy-color) 24%, transparent);
}

.ops-position strong {
  color: var(--strategy-color);
}

.ops-position span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.mini-log {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.mini-log p {
  display: grid;
  grid-template-columns: 88px 58px minmax(0, 1fr);
  gap: 7px;
  align-items: start;
  min-width: 0;
  padding: 8px 9px;
  border-radius: 10px;
  background: rgba(2, 6, 23, 0.58);
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  line-height: 1.45;
}

.mini-log time,
.log-line time {
  color: rgba(237, 245, 255, 0.6);
}

.mini-log span,
.log-line b {
  text-transform: uppercase;
}

.ops-card .up,
.mini-log .up,
.log-line .up,
.ops-position .up {
  color: var(--good);
}

.ops-card .down,
.mini-log .down,
.log-line .down,
.ops-position .down {
  color: var(--bad);
}

.ops-card .warn,
.mini-log .warn,
.log-line .warn {
  color: var(--warn);
}

.log-console {
  max-height: 460px;
  overflow: auto;
  display: grid;
  gap: 1px;
  border: 1px solid rgba(38, 217, 255, 0.14);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(2, 6, 23, 0.78), rgba(2, 6, 23, 0.94)),
    repeating-linear-gradient(180deg, transparent 0 28px, rgba(38, 217, 255, 0.04) 29px);
}

.log-line {
  display: grid;
  grid-template-columns: 148px 90px 82px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-width: 0;
  padding: 10px 12px;
  border-left: 2px solid var(--strategy-color);
  background: rgba(255, 255, 255, 0.025);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.log-line span {
  color: var(--strategy-color);
  font-weight: 850;
}

.log-line p {
  color: var(--ink);
  line-height: 1.45;
}

.empty-log {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.strategy-log-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  padding: 22px;
}

.strategy-log-modal.open {
  display: grid;
}

.strategy-log-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(10px);
}

.strategy-log-dialog {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100vw - 32px));
  max-height: min(86vh, 860px);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(38, 217, 255, 0.28);
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(38, 217, 255, 0.1), transparent 32%),
    linear-gradient(180deg, rgba(8, 15, 31, 0.98), rgba(3, 7, 18, 0.98));
  box-shadow: 0 28px 100px rgba(0, 0, 0, 0.58), 0 0 48px rgba(38, 217, 255, 0.12);
  overflow: hidden;
}

.strategy-log-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.strategy-log-header p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.modal-close {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  font-weight: 850;
}

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

.strategy-log-summary div {
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid rgba(129, 156, 206, 0.15);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.035);
}

.strategy-log-summary span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.strategy-log-summary strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.strategy-log-table-wrap {
  min-height: 0;
  overflow: auto;
  border: 1px solid rgba(38, 217, 255, 0.16);
  border-radius: 16px;
}

.strategy-log-table {
  min-width: 1040px;
  background: rgba(2, 6, 23, 0.78);
}

.strategy-log-table th,
.strategy-log-table td {
  vertical-align: top;
}

.strategy-log-table th:nth-child(7),
.strategy-log-table td:nth-child(7) {
  max-width: 420px;
  white-space: normal;
  line-height: 1.45;
}

#strategyEquityCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.strategy-line::before {
  box-shadow: 0 0 14px currentColor;
}

.strategy-split {
  margin-bottom: 16px;
}

.compact-table table {
  min-width: 860px;
}

.empty-row {
  color: var(--muted);
  text-align: center !important;
  padding: 26px !important;
}

.strategy-description-list {
  display: grid;
  gap: 10px;
}

.strategy-rule-card {
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--strategy-color) 30%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--strategy-color) 8%, transparent);
}

.strategy-rule-card strong {
  color: var(--strategy-color);
}

.strategy-rule-card p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.strategy-rule-card ul {
  margin: 9px 0 0;
  padding-left: 18px;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.6;
}

.assumption-box {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid rgba(255, 184, 77, 0.28);
  border-radius: 14px;
  background: rgba(255, 184, 77, 0.08);
  color: var(--muted);
  font-size: 12px;
}

.assumption-box strong {
  color: var(--warn);
}

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

.kpi-card {
  padding: 13px 14px;
  min-height: 106px;
}

.kpi-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.kpi-value {
  margin-top: 8px;
  font-size: 26px;
  line-height: 1;
  font-weight: 820;
  font-variant-numeric: tabular-nums;
}

.kpi-foot {
  margin-top: 11px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.contract-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid rgba(38, 217, 255, 0.18);
  border-radius: 16px;
  background: rgba(38, 217, 255, 0.07);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.contract-notice strong {
  color: var(--ink);
}

.contract-notice span {
  display: inline-flex;
  margin-left: 8px;
  color: var(--accent);
  font-weight: 760;
}

.contract-notice p {
  max-width: 760px;
  text-align: right;
}

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

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

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

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

.chart-section,
.panel,
.table-section {
  padding: 14px;
  min-width: 0;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.section-head p,
.section-head span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.section-head.compact {
  align-items: center;
  min-height: 28px;
}

.legend-inline {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

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

.legend-item::before {
  content: "";
  width: 18px;
  height: 3px;
  border-radius: 999px;
  background: currentColor;
}

.legend-item.oi {
  color: var(--accent);
}

.legend-item.volume {
  color: var(--accent-2);
}

.legend-item.price {
  color: var(--accent-3);
}

.chart-shell {
  position: relative;
  width: 100%;
  height: 420px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
  overflow: hidden;
}

#trendCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.tooltip {
  position: absolute;
  min-width: 190px;
  max-width: 260px;
  padding: 10px 11px;
  border-radius: 7px;
  background: rgba(31, 36, 40, 0.94);
  color: #fff;
  font-size: 12px;
  line-height: 1.55;
  pointer-events: none;
  z-index: 5;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.7fr);
  gap: 16px;
  min-width: 0;
}

.split > * {
  min-width: 0;
}

.external-chart {
  height: 352px;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: var(--surface-2);
}

.external-chart iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.empty-state {
  height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

textarea {
  width: 100%;
  height: 198px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
  outline: none;
  line-height: 1.55;
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 122, 140, 0.14);
}

.readout {
  min-height: 112px;
  margin-top: 10px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 184, 77, 0.08);
  color: #ffdba3;
  font-size: 13px;
  line-height: 1.55;
}

.table-wrap {
  overflow: auto;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
}

table {
  width: 100%;
  min-width: 1240px;
  border-collapse: collapse;
  font-size: 13px;
  background: rgba(8, 15, 31, 0.72);
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

td small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

th:first-child,
td:first-child,
th:nth-child(2),
td:nth-child(2),
th:nth-child(4),
td:nth-child(4) {
  text-align: left;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #0d172e;
  color: var(--muted);
  font-size: 12px;
  backdrop-filter: blur(14px);
}

tbody tr:hover {
  background: rgba(38, 217, 255, 0.07);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(38, 217, 255, 0.12);
  color: #bdefff;
  font-size: 12px;
  font-weight: 700;
}

.signal-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.signal-pill.up {
  background: rgba(114, 246, 161, 0.14);
  color: var(--good);
}

.signal-pill.down {
  background: rgba(255, 93, 115, 0.14);
  color: var(--bad);
}

.signal-pill.warn {
  background: rgba(255, 184, 77, 0.14);
  color: var(--warn);
}

.contract-cell {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.contract-cell small {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

#biasTag {
  min-width: 66px;
  text-align: center;
  border-radius: 999px;
  padding: 4px 9px;
  color: #fff;
  background: var(--accent);
  font-weight: 750;
  white-space: nowrap;
}

.deposit-summary {
  margin-bottom: 14px;
}

.deposit-layout,
.deposit-chart-grid {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.deposit-layout {
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr);
  align-items: stretch;
  margin-bottom: 16px;
}

.deposit-chart-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 16px;
}

.deposit-range-panel {
  margin-bottom: 16px;
}

.deposit-range-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.deposit-input-panel,
.deposit-pie-panel {
  min-width: 0;
}

.deposit-date-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(129, 156, 206, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
}

.deposit-date-row label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.deposit-date-row input,
.deposit-input-grid input {
  border: 1px solid var(--line);
  outline: none;
  color: var(--ink);
  background: rgba(2, 6, 23, 0.42);
  font-variant-numeric: tabular-nums;
}

.deposit-date-row input:focus,
.deposit-input-grid input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(38, 217, 255, 0.12);
}

.deposit-date-row input {
  min-height: 34px;
  border-radius: 999px;
  padding: 0 12px;
}

.deposit-view-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 184, 77, 0.28);
  border-radius: 14px;
  background: rgba(255, 184, 77, 0.08);
  color: #ffdba3;
  font-size: 13px;
  font-weight: 760;
}

.deposit-view-banner.hidden {
  display: none;
}

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

.deposit-input-grid label {
  position: relative;
  display: grid;
  gap: 10px;
  min-width: 0;
  min-height: 94px;
  padding: 12px;
  border: 1px solid rgba(129, 156, 206, 0.16);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.025)),
    rgba(2, 6, 23, 0.32);
  overflow: hidden;
}

.deposit-input-grid label::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--deposit-color, var(--accent));
  box-shadow: 0 0 16px var(--deposit-color, var(--accent));
}

.deposit-input-grid label:nth-child(1) { --deposit-color: #26d9ff; }
.deposit-input-grid label:nth-child(2) { --deposit-color: #72f6a1; }
.deposit-input-grid label:nth-child(3) { --deposit-color: #ffb84d; }
.deposit-input-grid label:nth-child(4) { --deposit-color: #ff5d73; }
.deposit-input-grid label:nth-child(5) { --deposit-color: #a78bfa; }
.deposit-input-grid label:nth-child(6) { --deposit-color: #38bdf8; }
.deposit-input-grid label:nth-child(7) { --deposit-color: #34d399; }
.deposit-input-grid label:nth-child(8) { --deposit-color: #fb7185; }
.deposit-input-grid label:nth-child(9) { --deposit-color: #f97316; }
.deposit-input-grid label:nth-child(10) { --deposit-color: #2dd4bf; }

.deposit-input-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.deposit-input-grid input {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  border-radius: 10px;
  padding: 0 10px;
  font-size: 16px;
  font-weight: 820;
}

.deposit-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.deposit-save-status {
  min-height: 20px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.deposit-save-status.is-ok {
  color: var(--good);
}

.deposit-save-status.is-warning {
  color: var(--warn);
}

.deposit-chart-shell {
  position: relative;
  width: 100%;
  height: 360px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    radial-gradient(circle at 18% 18%, rgba(38, 217, 255, 0.09), transparent 35%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025));
  overflow: hidden;
}

.deposit-pie-shell {
  height: 318px;
}

.deposit-chart-shell canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.deposit-pie-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.deposit-pie-legend div {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 8px;
  row-gap: 2px;
  align-items: center;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid rgba(129, 156, 206, 0.13);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.deposit-legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  box-shadow: 0 0 12px currentColor;
}

.deposit-pie-legend strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deposit-pie-legend small {
  grid-column: 2;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.deposit-pie-legend small b {
  font: inherit;
}

.deposit-pie-legend .delta-up {
  color: var(--good);
}

.deposit-pie-legend .delta-down {
  color: var(--bad);
}

.deposit-pie-legend .delta-neutral {
  color: var(--muted);
}

.deposit-history-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.deposit-history-controls span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid rgba(129, 156, 206, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-weight: 760;
}

.deposit-history-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.deposit-history-row {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1fr) minmax(0, 0.8fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 46px;
  padding: 9px 10px;
  border: 1px solid rgba(129, 156, 206, 0.16);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--ink);
  text-align: left;
}

.deposit-history-row.active {
  border-color: rgba(38, 217, 255, 0.52);
  background: rgba(38, 217, 255, 0.09);
}

.deposit-history-row span,
.deposit-history-row small {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.deposit-history-row strong {
  overflow: hidden;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deposit-history-row small {
  text-align: right;
}

.deposit-summary .up,
.deposit-history-row .up {
  color: var(--good);
}

.deposit-summary .down,
.deposit-history-row .down {
  color: var(--bad);
}

.deposit-history-empty {
  min-height: 72px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(129, 156, 206, 0.22);
  border-radius: 14px;
  color: var(--muted);
}

@media (max-width: 1160px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-nav {
    position: static;
    height: auto;
    min-height: 0;
  }

  .nav-menu {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

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

  .sidebar {
    position: static;
    height: auto;
    min-height: 0;
  }

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

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

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

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

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

  .terminal-side {
    position: static;
    grid-template-columns: 1fr;
  }

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

  .strategy-ops-grid {
    grid-template-columns: 1fr;
  }

  .live-crypto-grid {
    grid-template-columns: 1fr;
  }

  .log-line {
    grid-template-columns: 132px 80px 72px minmax(0, 1fr);
  }

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

  .contract-notice {
    align-items: flex-start;
    flex-direction: column;
  }

  .contract-notice p {
    max-width: none;
    text-align: left;
  }

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

  .deposit-layout,
  .deposit-chart-grid {
    grid-template-columns: 1fr;
  }

  .deposit-range-controls {
    justify-content: flex-start;
  }

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

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

@media (max-width: 720px) {
  .app {
    width: min(100vw - 18px, 1480px);
    padding-top: 14px;
  }

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

  h1 {
    font-size: 24px;
  }

  .toolbar {
    width: 100%;
  }

  .segmented,
  .refresh {
    flex: 1 1 96px;
  }

  .instrument-list,
  .kpi-grid,
  .terminal-summary {
    grid-template-columns: 1fr;
  }

  .nav-menu,
  .deposit-input-grid,
  .deposit-pie-legend,
  .deposit-history-list {
    grid-template-columns: 1fr;
  }

  .deposit-history-row {
    grid-template-columns: 1fr;
  }

  .deposit-history-row small {
    text-align: left;
  }

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

  .terminal-card-primary .chart-shell {
    min-height: 360px;
    height: 380px;
  }

  .strategy-row-numbers {
    align-items: flex-start;
    flex-direction: column;
  }

  .ops-gridline,
  .ops-detail-grid,
  .mini-log p,
  .live-event-list div,
  .log-line {
    grid-template-columns: 1fr;
  }

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

  .strategy-log-modal {
    padding: 10px;
  }

  .strategy-log-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
    padding: 14px;
  }

  .strategy-log-header {
    flex-direction: column;
  }

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

  .section-head {
    flex-direction: column;
  }

  .legend-inline {
    justify-content: flex-start;
  }

  .chart-shell {
    height: 360px;
  }
}
