:root {
  color-scheme: dark;
  --bg: #070b14;
  --surface: rgba(16, 24, 40, 0.82);
  --surface-solid: #101828;
  --surface-raised: #162033;
  --surface-soft: rgba(255, 255, 255, 0.035);
  --text: #f5f7fb;
  --muted: #8d9bb2;
  --border: rgba(148, 163, 184, 0.15);
  --border-strong: rgba(148, 163, 184, 0.28);
  --primary: #7c8cff;
  --primary-strong: #6074f4;
  --cyan: #45d7e8;
  --green: #37d39a;
  --red: #ff6685;
  --amber: #f8bd55;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.28);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 12% -10%, rgba(96, 116, 244, 0.20), transparent 34rem),
    radial-gradient(circle at 88% 6%, rgba(69, 215, 232, 0.10), transparent 28rem),
    linear-gradient(180deg, #090e19 0%, var(--bg) 55%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.012) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.012) 1px, transparent 1px);
  background-size: 36px 36px;
  content: "";
  mask-image: linear-gradient(to bottom, black, transparent 80%);
  pointer-events: none;
}

a {
  color: #a8b4ff;
  text-decoration: none;
}

a:hover {
  color: #c7ceff;
}

button,
input,
textarea {
  font: inherit;
}

button,
a,
input,
textarea {
  transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 0 max(24px, calc((100vw - 1440px) / 2));
  border-bottom: 1px solid var(--border);
  background: rgba(7, 11, 20, 0.78);
  backdrop-filter: blur(18px) saturate(140%);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  font-weight: 720;
  letter-spacing: -0.02em;
}

.brand:hover {
  color: white;
}

.brand-mark {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 11px;
  color: white;
  background: linear-gradient(145deg, var(--primary), #825ee8 58%, var(--cyan));
  box-shadow: 0 8px 22px rgba(96, 116, 244, 0.28);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: -0.02em;
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 5px;
}

.topbar nav > a,
.link-button {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 13px;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.topbar nav > a:hover,
.topbar nav > a.active,
.link-button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.topbar nav > a.active {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.inline {
  display: inline;
}

.container {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 38px 24px 72px;
}

.page-heading,
.card-heading,
.execution-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.page-heading {
  margin-bottom: 25px;
}

.page-heading h1,
.login-card h1 {
  margin: 3px 0 7px;
  font-size: clamp(28px, 3vw, 38px);
  line-height: 1.08;
  letter-spacing: -0.045em;
}

.eyebrow {
  margin: 0 0 6px;
  color: #9fafff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h2 {
  margin: 0 0 14px;
  font-size: 17px;
  letter-spacing: -0.02em;
}

p {
  line-height: 1.55;
}

.muted,
.empty {
  color: var(--muted);
}

.card,
.metric,
.login-card {
  border: 1px solid var(--border);
  background: linear-gradient(145deg, rgba(22, 32, 51, 0.90), rgba(12, 19, 32, 0.88));
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.card {
  position: relative;
  margin-bottom: 22px;
  padding: 23px;
  overflow: hidden;
  border-radius: var(--radius);
}

.card::before {
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  content: "";
  pointer-events: none;
}

.card-heading {
  margin-bottom: 18px;
}

.card-heading h2 {
  margin-bottom: 3px;
}

.card-heading p {
  margin: 0;
  font-size: 13px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(205px, 1fr));
  gap: 13px;
  margin-bottom: 22px;
}

.metric-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.metric {
  position: relative;
  min-height: 118px;
  padding: 18px 19px;
  overflow: hidden;
  border-radius: 15px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.17);
}

.metric::after {
  position: absolute;
  top: -28px;
  right: -24px;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: rgba(124, 140, 255, 0.08);
  content: "";
}

.metric:hover {
  border-color: rgba(124, 140, 255, 0.26);
  transform: translateY(-1px);
}

.metric > span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 780;
  letter-spacing: 0.105em;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin: 11px 0 6px;
  overflow-wrap: anywhere;
  color: #fbfcff;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.035em;
}

.metric small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(330px, 0.72fr);
  align-items: start;
  gap: 22px;
}

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

label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: #c9d3e4;
  font-size: 13px;
  font-weight: 600;
}

input,
textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  outline: none;
  color: var(--text);
  background: rgba(5, 10, 19, 0.70);
}

input:focus,
textarea:focus {
  border-color: rgba(124, 140, 255, 0.72);
  box-shadow: 0 0 0 4px rgba(124, 140, 255, 0.12);
}

button {
  min-height: 40px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: white;
  background: linear-gradient(135deg, var(--primary-strong), #765dde);
  box-shadow: 0 8px 20px rgba(96, 116, 244, 0.18);
  font-weight: 730;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.09);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

.danger-button {
  background: linear-gradient(135deg, #d83c5c, #ad2448);
  box-shadow: 0 8px 20px rgba(216, 60, 92, 0.16);
}

.success-button {
  background: linear-gradient(135deg, #18a876, #087b61);
  box-shadow: 0 8px 20px rgba(24, 168, 118, 0.17);
}

.full-width {
  width: 100%;
}

.controls hr {
  margin: 23px 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.badge,
.status-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 5px 9px;
  border: 1px solid rgba(148, 163, 184, 0.13);
  border-radius: 999px;
  color: #cbd5e5;
  background: rgba(148, 163, 184, 0.11);
  font-size: 10px;
  font-weight: 820;
  letter-spacing: 0.065em;
  text-transform: uppercase;
}

.status-chip {
  gap: 7px;
  padding: 8px 12px;
}

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

.badge.danger,
.status-chip.offline,
.badge.sell {
  border-color: rgba(255, 102, 133, 0.20);
  color: #ff8fa6;
  background: rgba(255, 102, 133, 0.10);
}

.badge.buy,
.status-chip.online {
  border-color: rgba(55, 211, 154, 0.20);
  color: #66e3b5;
  background: rgba(55, 211, 154, 0.10);
}

.alert {
  margin: 0 0 18px;
  padding: 13px 15px;
  border: 1px solid;
  border-radius: 12px;
  font-size: 13px;
}

.alert.error {
  border-color: rgba(255, 102, 133, 0.28);
  color: #ffc1ce;
  background: rgba(255, 102, 133, 0.10);
}

.alert.success {
  border-color: rgba(55, 211, 154, 0.28);
  color: #a7f3d4;
  background: rgba(55, 211, 154, 0.10);
}

.alert.warning {
  border-color: rgba(248, 189, 85, 0.30);
  color: #ffe0a6;
  background: rgba(248, 189, 85, 0.10);
}

.login-card {
  position: relative;
  width: min(440px, calc(100vw - 32px));
  margin: 10vh auto;
  padding: 36px;
  overflow: hidden;
  border-radius: 22px;
}

.login-card::before {
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), #9d6cff, var(--cyan));
  content: "";
}

.login-mark {
  width: 46px;
  height: 46px;
  margin-bottom: 25px;
  border-radius: 14px;
  font-size: 13px;
}

.login-card .muted {
  margin: 0 0 26px;
}

.table-wrap {
  margin: 0 -8px;
  overflow: auto;
}

table {
  width: 100%;
  border-spacing: 0;
  border-collapse: separate;
  font-size: 13px;
}

th,
td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

th {
  color: #8290a7;
  font-size: 10px;
  font-weight: 820;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

tbody tr {
  transition: background-color 140ms ease;
}

tbody tr:hover {
  background: rgba(124, 140, 255, 0.045);
}

.actions-column {
  position: sticky;
  z-index: 2;
  right: -1px;
  min-width: 112px;
  background: var(--surface-solid);
  text-align: right;
}

thead .actions-column {
  z-index: 3;
}

tbody tr:hover .actions-column {
  background: #151e30;
}

.table-action {
  display: inline-flex;
  min-height: 32px;
  padding: 6px 10px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(124, 140, 255, 0.32);
  border-radius: 9px;
  color: #c9d0ff;
  background: rgba(124, 140, 255, 0.10);
  font-size: 12px;
  font-weight: 730;
}

.table-action:hover {
  border-color: rgba(124, 140, 255, 0.58);
  color: white;
  background: rgba(124, 140, 255, 0.18);
}

.positive {
  color: var(--green) !important;
}

.negative {
  color: var(--red) !important;
}

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

.profit-value {
  display: inline-flex;
  min-width: 74px;
  padding: 4px 8px;
  justify-content: flex-end;
  border: 1px solid currentColor;
  border-radius: 8px;
  background: color-mix(in srgb, currentColor 8%, transparent);
  font-weight: 760;
  font-variant-numeric: tabular-nums;
}

.running-notice {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 14px 0 18px;
  padding: 13px 14px;
  border: 1px solid rgba(55, 211, 154, 0.24);
  border-radius: 12px;
  background: rgba(55, 211, 154, 0.08);
}

.running-notice strong,
.running-notice small {
  display: block;
}

.running-notice small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.status-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(55, 211, 154, 0.12), 0 0 16px rgba(55, 211, 154, 0.6);
}

.range-buttons {
  display: flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(4, 9, 17, 0.55);
}

.range-buttons button {
  min-height: 30px;
  padding: 4px 10px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  box-shadow: none;
  font-size: 11px;
}

.range-buttons button:hover,
.range-buttons button.active {
  color: white;
  background: rgba(124, 140, 255, 0.18);
  filter: none;
  transform: none;
}

.chart-container {
  position: relative;
  width: 100%;
  height: 310px;
  min-height: 310px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.09);
  border-radius: 13px;
  background: rgba(5, 10, 19, 0.52);
}

.chart-container canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.chart-empty {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: grid;
  padding: 24px;
  place-items: center;
  color: var(--muted);
  background: radial-gradient(circle at center, rgba(124, 140, 255, 0.06), transparent 60%);
  text-align: center;
  font-size: 13px;
  pointer-events: none;
}

.chart-empty[hidden] {
  display: none;
}

.execution {
  padding: 20px 2px;
  border-top: 1px solid var(--border);
}

.execution:first-of-type {
  border-top: 0;
}

.execution-heading {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.details {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr;
  gap: 7px 14px;
  margin-top: 16px;
  font-size: 13px;
}

.details dt {
  color: var(--muted);
}

.details dd {
  margin: 0;
}

details {
  margin-top: 11px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(5, 10, 19, 0.55);
}

summary {
  color: #cbd5e5;
  font-size: 13px;
  font-weight: 680;
  cursor: pointer;
}

pre {
  max-height: 520px;
  padding: 15px;
  overflow: auto;
  border: 1px solid rgba(148, 163, 184, 0.08);
  border-radius: 11px;
  color: #bdcbe1;
  background: #070c15;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.json-editor {
  min-height: 680px;
  resize: vertical;
  font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.settings-layout {
  grid-template-columns: minmax(0, 1.25fr) minmax(310px, 0.75fr);
}

.apply-form {
  display: flex;
  align-items: center;
  gap: 7px;
}

.apply-form input {
  min-width: 145px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  border: 0;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

code {
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: #cdd4ff;
  background: rgba(5, 10, 19, 0.72);
  font-size: 0.9em;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: #344158;
  background-clip: padding-box;
}

@media (max-width: 1100px) {
  .two-column,
  .settings-layout {
    grid-template-columns: 1fr;
  }

  .controls {
    order: -1;
  }
}

@media (max-width: 720px) {
  .topbar {
    align-items: center;
    min-height: 62px;
    padding: 0 13px;
  }

  .brand > span:last-child {
    display: none;
  }

  .topbar nav {
    gap: 1px;
  }

  .topbar nav > a,
  .link-button {
    min-height: 35px;
    padding: 0 9px;
    font-size: 12px;
  }

  .container {
    padding: 27px 13px 55px;
  }

  .page-heading,
  .card-heading {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .card {
    padding: 18px;
    border-radius: 15px;
  }

  .chart-container {
    height: 270px;
    min-height: 270px;
  }

  .details {
    grid-template-columns: auto 1fr;
  }

  .apply-form {
    min-width: 430px;
  }
}

@media (max-width: 480px) {
  .metric-grid,
  .metric-grid.compact {
    grid-template-columns: 1fr;
  }

  .metric {
    min-height: 103px;
  }

  .range-buttons {
    width: 100%;
  }

  .range-buttons button {
    flex: 1;
  }

  .login-card {
    margin: 6vh auto;
    padding: 28px 23px;
  }
}
