:root {
  --bg: #0d1118;
  --panel: #131a24;
  --line: #253142;
  --ink: #e6edf7;
  --muted: #95a5bc;
  --accent: #3fb2ff;
  --accent-soft: #17334b;
  --profit: #3cd38f;
  --warn: #f6c85f;
  --danger: #ff6b7a;
  --shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  background: #060b14;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background-color: #060b14;
  background-image:
    radial-gradient(78% 62% at 100% -8%, rgba(58, 127, 188, 0.34) 0%, rgba(58, 127, 188, 0.06) 38%, transparent 68%),
    radial-gradient(85% 78% at -8% 30%, rgba(23, 56, 96, 0.28) 0%, rgba(23, 56, 96, 0.04) 45%, transparent 74%),
    linear-gradient(180deg, #08111d 0%, #070d17 36%, #050911 100%);
  background-repeat: no-repeat;
  background-attachment: fixed;
  font-family: "Space Grotesk", sans-serif;
  position: relative;
}

body.modal-open {
  overflow: hidden;
}

body.with-side-menu {
  padding-left: 220px;
}

.background-shape {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(18px);
}

.shape-a {
  width: 320px;
  height: 320px;
  background: #1f4868;
  right: -80px;
  top: -80px;
}

.shape-b {
  width: 260px;
  height: 260px;
  background: #1a3f33;
  left: -90px;
  bottom: -90px;
}

.dashboard {
  width: min(1520px, 97vw);
  margin: 8px auto;
  display: grid;
  gap: 8px;
  align-content: start;
  flex: 1;
}

body.with-side-menu .dashboard {
  width: auto;
  margin: 8px 8px 0;
  max-width: none;
}

.app-footer {
  width: 100%;
  margin: 8px 0 12px;
  margin-top: auto;
  text-align: center;
  min-height: 28px;
}

body.with-side-menu .app-footer {
  width: auto;
  margin: 8px 8px 12px;
  margin-top: auto;
}

.app-footer #app-version {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid #2a3f5c;
  background: rgba(13, 26, 44, 0.62);
  color: #bdd6f4;
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.03em;
}


.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 10px;
  transition: border-color 140ms ease, transform 140ms ease;
}

.panel:hover {
  border-color: #31445e;
  transform: translateY(-1px);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr) auto;
  grid-template-areas: "brand actions status";
  align-items: center;
  align-self: start;
  column-gap: 14px;
  min-height: 74px;
  padding: 10px 12px;
  border-color: #2c405b;
  background: linear-gradient(180deg, rgba(20, 31, 47, 0.95) 0%, rgba(16, 25, 40, 0.9) 100%);
}

.topbar-brand {
  grid-area: brand;
  min-width: 220px;
  height: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.topbar-brand-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.hamburger-btn {
  width: 32px;
  height: 28px;
  border-radius: 9px;
  border: 1px solid #3b5f85;
  background: linear-gradient(180deg, #1a3958 0%, #14304a 100%);
  color: #d8e9fb;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.hamburger-btn:hover {
  border-color: #5b8ed0;
  background: linear-gradient(180deg, #21486f 0%, #173855 100%);
}

.topbar-brand h1 {
  margin-top: 2px;
  line-height: 1.05;
  font-size: clamp(1.25rem, 2.1vw, 1.95rem);
}

.topbar-actions {
  grid-area: actions;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: nowrap;
  overflow-x: auto;
  min-height: 0;
  gap: 4px;
}

.topbar-status {
  grid-area: status;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  overflow-x: auto;
  min-height: 0;
  max-width: 100%;
}

.left-menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 29;
  background: rgba(3, 8, 14, 0.62);
  opacity: 0;
  transition: opacity 180ms ease;
  display: none;
}

.left-menu {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 220px;
  z-index: 20;
  border-right: 1px solid #2a3f5b;
  background: linear-gradient(180deg, #101b2b 0%, #0d1624 100%);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  padding: 14px;
  transform: translateX(0);
  transition: transform 180ms ease;
  display: grid;
  align-content: start;
  gap: 14px;
}

.left-menu.is-open {
  transform: translateX(0);
}

.left-menu-overlay.is-open {
  opacity: 1;
}

.left-menu-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 0;
  gap: 8px;
}

.left-menu-head p {
  margin: 0;
  font-size: 0.85rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #9eb5d2;
}

.left-menu-sub {
  margin: 3px 0 0;
  color: #7f97b6;
  font-size: 0.74rem;
}

.left-menu-section-title {
  margin: 0 0 8px;
  font-size: 0.7rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #7893b3;
}

.left-menu-close {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  border: 1px solid #35506f;
  background: #142233;
  color: #c3daf3;
  cursor: pointer;
  margin-left: auto;
  display: none;
}

.left-menu-links {
  display: grid;
  gap: 8px;
}

.left-menu-link {
  display: block;
  border: 1px solid #2f4867;
  border-radius: 10px;
  padding: 8px 10px;
  text-decoration: none;
  color: #cbe0f6;
  background: #112033;
  font-size: 0.86rem;
  font-weight: 600;
}

.left-menu-link:hover {
  border-color: #5b8ed0;
  background: #18314a;
}

.left-menu-link.is-active {
  border-color: #5b8ed0;
  background: linear-gradient(180deg, #21486f 0%, #173855 100%);
  color: #e1f0ff;
}

body.with-side-menu.sidebar-hidden {
  padding-left: 0;
}

body.with-side-menu.sidebar-hidden .left-menu {
  transform: translateX(-100%);
}

body.with-side-menu.sidebar-hidden .dashboard {
  width: min(1520px, 97vw);
  margin: 8px auto;
}

body.with-side-menu.sidebar-hidden .app-footer {
  width: 100%;
  margin-left: 0;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--muted);
  font-size: 0.8rem;
}

h1,
h2 {
  margin: 2px 0 0;
}

h1 {
  font-size: clamp(1.05rem, 1.9vw, 1.65rem);
}

h2 {
  font-size: 1rem;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.top-nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #cfe3fa;
  text-decoration: none;
  background: transparent;
  transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
}

.top-nav-link:hover {
  border-color: #4f739f;
  background: rgba(33, 69, 106, 0.34);
  color: #e1f0ff;
}

.top-nav-link.is-active {
  border-color: #4f739f;
  background: #1f3f5f;
  color: #e5f2ff;
}

.tz-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #2f4868;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.76rem;
  color: #9eb8d9;
  background: #101d2e;
}

.tz-select {
  appearance: none;
  border: 1px solid #314c6a;
  background: #0d1a29;
  color: var(--ink);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.72rem;
  max-width: 172px;
}

.badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.78rem;
  background: #0f1d2e;
}

.badge-poll {
  border-color: #345274;
  background: #15273b;
  color: #a8cdf0;
  width: 132px;
  flex: 0 0 132px;
  display: inline-flex;
  justify-content: center;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.badge-live {
  border-color: #226247;
  background: #123425;
  color: #7df0ba;
}

.badge-error {
  border-color: #6a2330;
  background: #31131b;
  color: #ff9cab;
}

.badge-lock {
  border-color: #8b651f;
  background: #392b12;
  color: #ffd58c;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.grid {
  display: grid;
  gap: 8px;
}

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

.metric-card {
  padding: 10px;
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, rgba(63, 178, 255, 0.8), rgba(60, 211, 143, 0.4));
}

.metric-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metric-value {
  margin: 6px 0 3px;
  font-size: clamp(1rem, 1.7vw, 1.4rem);
  font-weight: 700;
}

.metric-foot {
  margin: 0;
  color: var(--muted);
  font-size: 0.77rem;
}

.wallet-balance {
  margin-top: 4px;
  display: grid;
  gap: 2px;
  align-content: start;
}

.wallet-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.wallet-asset {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}

.wallet-amount {
  font-size: clamp(1rem, 1.45vw, 1.25rem);
  line-height: 1.15;
}

.wallet-row-total {
  padding-top: 4px;
  margin-top: 2px;
  border-top: 1px dashed #2a3a4f;
}

.wallet-row-total .wallet-asset {
  color: #cbe4ff;
}

.wallet-row-total .wallet-amount {
  font-weight: 700;
}

.vip-profile {
  margin-top: 4px;
  display: grid;
  gap: 2px;
  align-content: start;
}

.vip-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 8px;
}

.vip-key {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}

.vip-value {
  font-size: clamp(0.92rem, 1.2vw, 1.05rem);
  line-height: 1.15;
  text-align: right;
  white-space: nowrap;
}

.vip-row-source {
  margin-top: 2px;
  padding-top: 4px;
  border-top: 1px dashed #2a3a4f;
}

.vip-row-source .vip-value {
  font-size: 0.82rem;
  color: #9fb3cc;
}

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

.summary-item {
  border: 1px solid var(--line);
  background: #101722;
  border-radius: 12px;
  padding: 10px 12px;
}

.summary-value {
  margin: 8px 0 0;
  font-size: 1rem;
  font-weight: 600;
}

.formula-line {
  margin: 0 0 8px;
  font-size: 0.8rem;
  color: var(--muted);
}

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

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

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

.main-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.column-stack {
  display: grid;
  gap: 8px;
  align-content: start;
}

.panel-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.panel-tag {
  font-size: 0.72rem;
  border: 1px dashed var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--muted);
}

.orders-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.orders-filter {
  background: #0d1725;
  color: #b9cee8;
  border: 1px solid #30465f;
  border-radius: 999px;
  font-size: 0.72rem;
  padding: 4px 10px;
  height: 28px;
}

.panel-tag-button {
  background: transparent;
  cursor: pointer;
}

.panel-tag-button:hover {
  border-color: #5b8ed0;
  color: #cbe4ff;
}

.panel-tag-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.conciliation-apply-btn {
  appearance: none;
  border: 1px solid #2e8b5f;
  border-radius: 10px;
  padding: 6px 11px;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-color: #2e8b5f;
  background: linear-gradient(180deg, #1f6d4a 0%, #18563b 100%);
  color: #e6fff2;
  font-weight: 600;
  font-size: 0.74rem;
  letter-spacing: 0.02em;
  box-shadow: none;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.conciliation-apply-btn:hover:not(:disabled) {
  border-color: #58c98e;
  background: linear-gradient(180deg, #258157 0%, #1b6646 100%);
  color: #f2fff8;
  transform: translateY(-1px);
}

.conciliation-apply-btn:disabled {
  border-color: #2f5d4a;
  background: #1a2d25;
  color: #8bb29f;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.92;
}

.login-page {
  width: min(560px, 95vw);
  display: block;
  flex: 0 0 auto;
  margin-top: 72px;
  margin-bottom: 10px;
}

.login-card {
  height: auto;
  min-height: 0;
  padding: 18px;
  border-color: #2d4360;
  background:
    radial-gradient(90% 120% at 100% 0%, rgba(63, 178, 255, 0.12) 0%, rgba(63, 178, 255, 0) 58%),
    linear-gradient(180deg, #121b29 0%, #101824 100%);
}

.login-header {
  align-items: flex-start;
  margin-bottom: 8px;
}

.login-subtitle {
  margin-bottom: 16px;
}

.auth-uri {
  word-break: break-all;
}

.twofa-qr {
  width: 176px;
  height: 176px;
  border-radius: 10px;
  border: 1px solid #2f4867;
  background: #ffffff;
  padding: 8px;
}

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

.login-label {
  color: #b9cde5;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.login-input {
  height: 40px;
  border: 1px solid #355070;
  background: #0c1420;
  color: #ecf4ff;
  border-radius: 10px;
  padding: 0 12px;
  font-size: 0.92rem;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.login-input::placeholder {
  color: #7795b6;
}

.login-input:focus {
  outline: none;
  border-color: #5ea6e8;
  box-shadow: 0 0 0 3px rgba(63, 178, 255, 0.15);
}

.login-submit {
  margin-top: 4px;
  height: 40px;
  border: 1px solid #2f6699;
  border-radius: 999px;
  background: linear-gradient(180deg, #23557f 0%, #1a4162 100%);
  color: #dcecff;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
}

#login-form .login-submit {
  margin-top: 12px;
}

.login-submit:hover {
  border-color: #6fb5f4;
  color: #f0f7ff;
}

.login-submit-secondary {
  border-color: #2f7f66;
  background: linear-gradient(180deg, #24644f 0%, #1d4d3d 100%);
}

.register-section {
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px dashed #2a3b51;
  display: none;
}

.register-title {
  margin: 0;
  font-size: 1.08rem;
}

.auth-message {
  margin-top: 14px;
  min-height: 20px;
  color: #ffb8b8;
}


.tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 700;
  cursor: help;
  vertical-align: middle;
  background: #0f1722;
}

.tip:hover::after {
  content: attr(data-tip);
  position: absolute;
  z-index: 20;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  width: min(280px, 70vw);
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0b1320;
  color: var(--ink);
  font-size: 0.74rem;
  line-height: 1.35;
  box-shadow: var(--shadow);
  white-space: normal;
  text-transform: none;
  letter-spacing: normal;
}

.price-strip {
  height: 210px;
  border: 1px solid var(--line);
  border-radius: 14px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  align-items: end;
  gap: 7px;
  padding: 10px;
  background: linear-gradient(180deg, #111926 0%, #0f1722 100%);
}

.price-point {
  border-radius: 8px 8px 2px 2px;
  background: linear-gradient(180deg, #62c9ff 0%, #2a79b1 100%);
}

.p1 { height: 30%; }
.p2 { height: 42%; }
.p3 { height: 48%; }
.p4 { height: 56%; }
.p5 { height: 50%; }
.p6 { height: 64%; }
.p7 { height: 71%; }
.p8 { height: 84%; }

.price-axis {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.82rem;
}

.vwap-chart {
  display: grid;
  gap: 12px;
}

.vwap-row {
  display: grid;
  grid-template-columns: 96px 1fr 110px;
  align-items: center;
  gap: 10px;
}

.vwap-label,
.vwap-value {
  font-size: 0.86rem;
}

.vwap-bar-track {
  height: 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #101722;
  overflow: hidden;
}

.vwap-bar {
  height: 100%;
  background: linear-gradient(90deg, #39c6ff 0%, #59a9ff 100%);
  transition: width 220ms ease;
}

.vwap-bar.alt {
  background: linear-gradient(90deg, #3cd38f 0%, #49b97d 100%);
}

.vwap-bar.neutral {
  background: linear-gradient(90deg, #7b8ba7 0%, #96a7c4 100%);
}

.vwap-bar.warm {
  background: linear-gradient(90deg, #f2a43a 0%, #e37a38 100%);
}

.rule-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.rule-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 7px;
  background: #101722;
  transition: border-color 130ms ease, background 130ms ease;
}

.rule-list li:hover {
  border-color: #355074;
  background: #121d2c;
}

.rule-name {
  margin: 0;
  font-weight: 600;
}

.rule-range {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.76rem;
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 4px 8px;
}

.quote-row .rule-name {
  margin-bottom: 4px;
}

.quote-price {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.ask-tag {
  background: rgba(63, 178, 255, 0.14);
}

.bid-tag {
  background: rgba(60, 211, 143, 0.14);
}

.timeline {
  margin: 0;
  padding: 0 0 0 20px;
  display: grid;
  gap: 6px;
  max-height: 180px;
  overflow: auto;
}

.timeline li {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 8px;
  background: #101722;
}

.timeline li p {
  margin: 0;
}

.timeline li p + p {
  margin-top: 3px;
  color: var(--muted);
}

.orders-board {
  display: grid;
  gap: 6px;
  max-height: 420px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
}

.orders-board::-webkit-scrollbar {
  width: 10px;
}

.orders-board::-webkit-scrollbar-track {
  background: #0d1725;
  border-radius: 10px;
}

.orders-board::-webkit-scrollbar-thumb {
  background: #2f496a;
  border-radius: 10px;
  border: 2px solid #0d1725;
}

.orders-board::-webkit-scrollbar-thumb:hover {
  background: #3e6492;
}

.layout-enabled-panel {
  position: relative;
  resize: both;
  overflow: hidden;
  min-width: 280px;
  min-height: 140px;
}

.layout-enabled-panel.metric-card {
  min-width: 280px;
  min-height: 150px;
}

.layout-enabled-panel.market-panel {
  min-width: 620px;
  min-height: 460px;
}

.layout-enabled-panel.strategy-panel {
  min-width: 560px;
  min-height: 320px;
}

.layout-enabled-panel.orders-panel {
  min-width: 560px;
  min-height: 280px;
}

.layout-enabled-panel.profit-panel,
.layout-enabled-panel.next-panel,
.layout-enabled-panel.timeline-panel,
.layout-enabled-panel.position-panel {
  min-width: 420px;
  min-height: 220px;
}

.layout-panel-toolbar {
  position: absolute;
  top: 6px;
  right: 8px;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  max-width: calc(100% - 16px);
  gap: 6px;
}

.layout-enabled-panel.layout-toolbar-offset .layout-panel-toolbar {
  top: 36px;
  right: auto;
  left: 8px;
}

.layout-panel-btn {
  border: 1px solid #2f4867;
  background: #0e1a29;
  color: #cbe4ff;
  border-radius: 8px;
  padding: 0 8px;
  height: 24px;
  font-size: 0.74rem;
  line-height: 1;
  cursor: pointer;
}

.layout-panel-btn:hover {
  border-color: #5b8ed0;
}

.layout-panel-btn[data-layout-drag] {
  cursor: grab;
  width: 28px;
  padding: 0;
  font-size: 0.9rem;
  font-weight: 700;
}

.layout-panel-btn[data-layout-collapse] {
  width: 28px;
  padding: 0;
  font-size: 0.9rem;
  font-weight: 700;
}

.layout-dragging {
  opacity: 0.72;
  outline: 2px dashed #5b8ed0;
}

.layout-dropzone-active {
  outline: 1px dashed #3f638c;
  outline-offset: 4px;
}

.panel.layout-collapsed {
  min-height: 48px;
  resize: none;
  overflow: hidden;
}

.chain-ledger {
  margin-top: 8px;
  display: grid;
  gap: 6px;
  max-height: none;
  overflow: visible;
}

.chain-ledger-row {
  border: 1px solid #314a67;
  border-radius: 10px;
  background: #0f1a29;
  padding: 7px 9px;
}

.chain-ledger-head {
  margin: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: #d8e7fb;
  font-size: 0.75rem;
  overflow-wrap: anywhere;
}

.chain-ledger-head-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.chain-direction-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  border: 1px solid #3a5f86;
  color: #9db8dd;
  background: rgba(22, 42, 66, 0.35);
}

.chain-direction-badge.buy {
  border-color: #2f6f4f;
  color: #74e6b1;
  background: rgba(27, 77, 55, 0.28);
}

.chain-direction-badge.sell {
  border-color: #7a4d1f;
  color: #ffc68a;
  background: rgba(95, 58, 20, 0.28);
}

.chain-ledger-meta {
  margin: 4px 0 0;
  color: #9eb6d3;
  font-size: 0.72rem;
  overflow-wrap: anywhere;
}

.chain-ledger-legs {
  margin: 4px 0 0;
  color: #8ea7c8;
  font-size: 0.7rem;
  overflow-wrap: anywhere;
}

.chain-steps {
  margin: 6px 0 0;
  display: grid;
  gap: 5px;
}

.chain-step {
  border: 1px solid #263c57;
  border-radius: 8px;
  padding: 5px 7px;
  background: #0d1725;
}

.chain-step-line {
  margin: 0;
  color: #9eb5d3;
  font-size: 0.69rem;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.manual-order-form {
  display: grid;
  grid-template-columns: minmax(170px, 220px) minmax(280px, 1fr) minmax(220px, 1fr);
  grid-template-areas: "left amount auto";
  gap: 10px;
  align-items: start;
  margin: 0 0 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(16, 24, 37, 0.75) 0%, rgba(13, 20, 31, 0.75) 100%);
}

.manual-order-form label {
  display: grid;
  gap: 4px;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #9cb4d3;
}

.manual-field-amount {
  grid-area: amount;
}

.manual-left-stack {
  grid-area: left;
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  align-content: start;
}

.manual-left-stack .manual-field-side,
.manual-left-stack .manual-field-mode,
.manual-left-stack .manual-field-currency,
.manual-left-stack .manual-field-submit {
  grid-area: auto;
}

.manual-left-stack .manual-field-submit {
  justify-self: stretch;
}

.manual-left-stack .manual-field-submit {
  width: 100%;
}

.manual-field-auto {
  grid-area: auto;
  min-width: 0;
}

.manual-input {
  -webkit-appearance: none;
  appearance: none;
  background: #0b1420;
  color: var(--ink);
  border: 1px solid #30465f;
  border-radius: 8px;
  padding: 9px 10px;
  height: 40px;
  line-height: 1.2;
  font-size: 0.95rem;
  font-weight: 500;
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.manual-amount-wrap {
  display: grid;
  gap: 6px;
}

.manual-amount-slider {
  --slider-fill: 0%;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  margin: 0;
  height: 20px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    #5b8ed0 0%,
    #5b8ed0 var(--slider-fill),
    #152536 var(--slider-fill),
    #152536 100%
  );
  border: 1px solid #2f4867;
  cursor: pointer;
}

.manual-amount-slider::-webkit-slider-runnable-track {
  height: 6px;
  background: transparent;
  border-radius: 999px;
}

.manual-amount-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -6px;
  border-radius: 999px;
  border: 2px solid #d7e8ff;
  background: #7fb1f0;
  box-shadow: 0 0 0 3px rgba(91, 142, 208, 0.22);
}

.manual-amount-slider::-moz-range-track {
  height: 6px;
  background: transparent;
  border-radius: 999px;
}

.manual-amount-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid #d7e8ff;
  background: #7fb1f0;
  box-shadow: 0 0 0 3px rgba(91, 142, 208, 0.22);
}

.manual-amount-meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
  color: #9cb4d3;
  font-size: 0.7rem;
}

.manual-scheduled-target {
  margin-top: 4px;
  display: grid;
  gap: 4px;
}

.manual-scheduled-target .metric-foot {
  margin: 0;
  font-size: 0.68rem;
  line-height: 1.35;
  text-transform: none;
  letter-spacing: normal;
  color: #8ea7c7;
}

.manual-scheduled-board {
  display: grid;
  gap: 6px;
  margin: 4px 0 8px;
}

.manual-scheduled-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid #2b435f;
  border-radius: 8px;
  background: #0d1726;
}

.manual-scheduled-item .line {
  margin: 0;
  color: #9cb4d3;
  font-size: 0.72rem;
}

.manual-scheduled-item .line strong {
  color: #d7e8ff;
  font-weight: 600;
}

.manual-scheduled-item.is-executed {
  border-color: #2b5f48;
}

.manual-scheduled-item.is-cancelled {
  border-color: #5f2b38;
}

.manual-scheduled-cancel {
  min-width: 92px;
  height: 34px;
}

.manual-amount-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border: 1px solid #2d4058;
  border-radius: 8px;
  background: rgba(10, 18, 29, 0.72);
  white-space: normal;
}

.manual-input:hover {
  border-color: #3c5f86;
  background: #0d1725;
}

.manual-input:focus {
  outline: none;
  border-color: #5b8ed0;
  box-shadow: 0 0 0 2px rgba(91, 142, 208, 0.2);
}

select.manual-input {
  padding-right: 30px;
  background-image:
    linear-gradient(45deg, transparent 50%, #9cb4d3 50%),
    linear-gradient(135deg, #9cb4d3 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 3px),
    calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.manual-submit {
  border: 1px solid #3f638c;
  background: linear-gradient(180deg, #1a3958 0%, #14304a 100%);
  color: #cbe4ff;
  border-radius: 8px;
  padding: 0 14px;
  height: 40px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}

.manual-submit:hover:not([disabled]) {
  border-color: #5b8ed0;
  background: linear-gradient(180deg, #20476d 0%, #183754 100%);
  transform: translateY(-1px);
}

.manual-submit[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.manual-order-msg {
  min-height: 1.2em;
  margin: 2px 0 10px;
  color: #9cb4d3;
  font-size: 0.78rem;
}

.manual-order-msg.is-success {
  color: #7be3b6;
}

.manual-order-msg.is-error {
  color: #ff9aa7;
}

.auto-realize-panel {
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(16, 24, 37, 0.88) 0%, rgba(13, 20, 31, 0.88) 100%);
}

.auto-realize-title {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.auto-realize-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  align-items: start;
}

.auto-realize-group {
  display: grid;
  gap: 4px;
}

.auto-realize-label {
  display: grid;
  gap: 4px;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #9cb4d3;
}

.auto-realize-input {
  width: 100%;
  text-align: right;
}

.auto-realize-threshold-row {
  display: block;
}

.auto-realize-input-row {
  margin-top: 6px;
  display: block;
  max-width: 140px;
}

.auto-realize-input-row .auto-realize-input {
  width: 100%;
  min-width: 0;
}

.auto-realize-slider {
  display: block;
  width: 100%;
}

.auto-realize-slider {
  --auto-fill: 0%;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 22px;
  margin: 0;
  border-radius: 999px;
  border: 1px solid #2f4867;
  background: linear-gradient(
    90deg,
    #5b8ed0 0%,
    #5b8ed0 var(--auto-fill),
    #152536 var(--auto-fill),
    #152536 100%
  );
  cursor: pointer;
}

.auto-realize-slider::-webkit-slider-runnable-track {
  height: 6px;
  background: transparent;
  border-radius: 999px;
}

.auto-realize-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -5px;
  border-radius: 999px;
  border: 2px solid #d7e8ff;
  background: #7fb1f0;
}

.auto-realize-slider::-moz-range-track {
  height: 6px;
  background: transparent;
  border-radius: 999px;
}

.auto-realize-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid #d7e8ff;
  background: #7fb1f0;
}

.auto-realize-slider:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auto-realize-toggle {
  min-width: 110px;
  justify-self: stretch;
}

.auto-realize-toggle.is-active {
  border-color: #7a2f3a;
  background: linear-gradient(180deg, #3a1820 0%, #2b1218 100%);
  color: #ffb6bf;
}

.auto-realize-hint {
  margin: 0;
  font-size: 0.7rem;
}

.auto-realize-state {
  margin-top: 6px;
  display: inline-flex;
  padding: 3px 8px;
  border: 1px solid #2d4058;
  border-radius: 999px;
  background: rgba(10, 18, 29, 0.65);
}

.auto-distance {
  margin: 2px 0 0;
  font-size: 0.72rem;
  color: var(--muted);
}

.market-board {
  display: grid;
  gap: 6px;
}

.history-card {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  background: #101722;
}

.history-scales {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 8px;
}

.history-title-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.history-scale-btn {
  border: 1px solid #2f3c4f;
  background: #0e1520;
  color: var(--muted);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.74rem;
  cursor: pointer;
}

.history-scale-btn:hover {
  border-color: #3f638c;
  color: var(--ink);
}

.history-scale-btn.is-active {
  border-color: #3f638c;
  background: #15304a;
  color: #cbe4ff;
}

.history-chart {
  width: 100%;
  height: 330px;
  display: block;
  border: 1px solid #25384e;
  border-radius: 10px;
  background: linear-gradient(180deg, #0f1b2a 0%, #0c1522 100%);
}

#graph-chart {
  height: 440px;
}

#history-chart {
  height: 440px;
}

.history-chart-wrap {
  position: relative;
}

.volume-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 8px 0 6px;
}

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

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

.volume-legend-item.buy .volume-dot {
  background: rgba(47, 209, 139, 0.72);
}

.volume-legend-item.sell .volume-dot {
  background: rgba(255, 107, 122, 0.72);
}

.history-tooltip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  min-width: 170px;
  max-width: 260px;
  border: 1px solid #31507a;
  border-radius: 10px;
  background: rgba(7, 14, 24, 0.96);
  box-shadow: var(--shadow);
  padding: 7px 9px;
  color: var(--ink);
  font-size: 0.72rem;
  line-height: 1.35;
}

.market-row {
  display: grid;
  grid-template-columns: 108px 1fr auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 7px;
  background: #101722;
  transition: border-color 130ms ease, background 130ms ease;
}

.market-row:hover {
  border-color: #355074;
  background: #121d2c;
}

.market-name,
.market-value,
.market-delta {
  margin: 0;
}

.market-name {
  font-size: 0.8rem;
  color: var(--muted);
}

.market-value {
  font-size: 0.9rem;
}

.market-delta {
  font-size: 0.78rem;
  color: var(--muted);
}

.network-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.network-block h3 {
  margin: 0 0 8px;
  font-size: 0.86rem;
  color: #b9ccef;
}

.network-kv {
  display: grid;
  gap: 6px;
}

.network-kv-row {
  display: grid;
  grid-template-columns: 124px 1fr;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid #22354e;
  border-radius: 10px;
  background: #101722;
}

.network-k {
  color: var(--muted);
  font-size: 0.76rem;
}

.network-v {
  font-size: 0.78rem;
  color: #d5e4ff;
  word-break: break-word;
}

.network-v-lines {
  display: grid;
  gap: 2px;
}

.network-table-wrap {
  overflow-x: auto;
}

.network-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.network-table th,
.network-table td {
  border-bottom: 1px solid #22354e;
  padding: 7px 8px;
  text-align: left;
}

.network-table th {
  color: #9db7dc;
  font-weight: 600;
}

.network-table tr.is-selected td {
  background: rgba(47, 209, 139, 0.08);
}

@media (max-width: 700px) {
  .network-kv-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

.order-row {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 7px;
  background: #101722;
  display: grid;
  gap: 1px;
  transition: border-color 130ms ease, background 130ms ease;
}

.order-row:hover {
  border-color: #355074;
  background: #121d2c;
}

.order-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 1px;
}

.order-row p {
  margin: 0;
}

.order-head-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.order-side {
  font-weight: 700;
}

.order-side.buy {
  color: var(--profit);
}

.order-side.sell {
  color: #7dbbff;
}

.order-meta {
  color: var(--muted);
  font-size: 0.76rem;
}

.order-extra {
  color: #a9b8cf;
  font-size: 0.78rem;
}

.target-price-highlight {
  color: #f7931a;
  font-weight: 700;
}

.order-kind-badges {
  display: inline-flex;
  gap: 5px;
}

.order-kind-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.62rem;
  letter-spacing: 0.05em;
  border: 1px solid #30465f;
  background: #0f1b2a;
  color: #b8d4f8;
}

.order-kind-badge.market {
  border-color: #466992;
  color: #a7cbff;
}

.order-kind-badge.swap {
  border-color: #2f6f57;
  color: #8de0be;
}

.order-kind-badge.manual {
  border-color: #6b5f2d;
  color: #f3d98f;
}

.order-kind-badge.strategy {
  border-color: #2d5f6b;
  color: #8fdaf3;
}

.order-summary {
  margin-bottom: 6px;
  padding: 6px 8px;
  border: 1px dashed #355074;
  border-radius: 10px;
  color: #9bc2ff;
  background: #0f1b2a;
  font-size: 0.77rem;
}

.order-realize {
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.order-realize-title {
  color: #8ea9c9;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
}

.order-realize-choice {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 1px solid #2f4867;
  border-radius: 10px;
  background: #0f1b2a;
  color: #b6c9e4;
  font-size: 0.72rem;
  cursor: pointer;
}

.order-realize-choice input[type="radio"] {
  margin: 0;
  accent-color: #5b8ed0;
}

.order-realize-choice-label {
  color: #b6c9e4;
}

.order-realize-choice-value {
  color: #8fdab7;
  font-weight: 600;
}

.order-realize-choice input[type="radio"]:checked + .order-realize-choice-label {
  color: #d5e7ff;
}

.order-realize-choice:has(input[type="radio"]:checked) {
  border-color: #5b8ed0;
  background: #12243a;
}

.order-realize-choice:has(input[type="radio"][disabled]) {
  opacity: 0.55;
  cursor: not-allowed;
}

.order-realize-btn {
  border: 1px solid #3f638c;
  background: linear-gradient(180deg, #1a3958 0%, #14304a 100%);
  color: #cbe4ff;
  border-radius: 8px;
  padding: 3px 9px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.order-realize-btn:hover:not([disabled]) {
  border-color: #5b8ed0;
  background: linear-gradient(180deg, #20476d 0%, #183754 100%);
}

.order-realize-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.order-close-btn {
  border-color: #7a2f3a;
  background: linear-gradient(180deg, #3a1820 0%, #2b1218 100%);
  color: #ffb6bf;
}

.order-close-btn:hover:not([disabled]) {
  border-color: #a64452;
  background: linear-gradient(180deg, #4a1d27 0%, #34161d 100%);
}

.order-realize-calc {
  margin-top: 2px;
  color: #9cb4d3;
  font-size: 0.72rem;
}

.strategies-board {
  display: grid;
  gap: 10px;
  margin: 4px 0 8px;
}

.strategy-row {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #101722;
}

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

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

.strategy-summary-chip {
  border: 1px solid #314663;
  border-radius: 12px;
  padding: 8px 10px;
  background: linear-gradient(180deg, #101c2b 0%, #0c1523 100%);
  display: grid;
  gap: 2px;
}

.strategy-summary-label {
  color: #8ea7c8;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.strategy-summary-value {
  color: #dce8f8;
  font-size: 0.95rem;
  line-height: 1.1;
}

.strategy-summary-sub {
  color: #9fb4d0;
  font-size: 0.75rem;
  white-space: nowrap;
}

.strategy-summary-kv {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.strategy-summary-ccy {
  opacity: 0.85;
  font-size: 0.85em;
}

.strategy-row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.strategy-row-head-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.strategy-row-title {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  color: #e3ecfa;
}

.strategy-side-badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid #315a86;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #9db8dd;
  line-height: 1;
}

.strategy-side-badge.buy {
  border-color: #2f6f4f;
  color: #74e6b1;
  background: rgba(27, 77, 55, 0.28);
}

.strategy-side-badge.sell {
  border-color: #7a4d1f;
  color: #ffc68a;
  background: rgba(95, 58, 20, 0.28);
}

.strategy-phase {
  display: inline-flex;
  align-items: center;
  border: 1px solid #315a86;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #9db8dd;
}

.strategy-phase.sell {
  border-color: #7a4d1f;
  color: #ffc68a;
  background: rgba(95, 58, 20, 0.28);
}

.strategy-phase.both {
  border-color: #5d4d87;
  color: #c9b7ff;
  background: rgba(58, 45, 88, 0.28);
}

.strategy-phase.danger {
  border-color: #7c3542;
  color: #ff9cab;
  background: rgba(88, 30, 40, 0.32);
}

.strategy-inline-grid {
  margin-top: 8px;
  display: grid;
  gap: 4px;
}

.strategy-inline-line {
  margin: 0;
  display: block;
  color: #9cb2cd;
  font-size: 0.75rem;
  line-height: 1.45;
}

.strategy-inline-key {
  color: #8ea6c5;
  font-size: 0.75rem;
  letter-spacing: 0.01em;
  margin-right: 4px;
}

.strategy-row-foot {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.4;
}

.strategy-row-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

.strategy-debug-btn {
  border: 1px solid #315a86;
  border-radius: 999px;
  padding: 5px 11px;
  background: rgba(24, 45, 71, 0.32);
  color: #9db8dd;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
}

.strategy-debug-btn:hover {
  border-color: #4a78ab;
  background: rgba(29, 54, 84, 0.45);
  color: #c7daf3;
}

.strategy-trace {
  margin-top: 10px;
  border-top: 1px solid rgba(72, 94, 122, 0.45);
  padding-top: 10px;
}

.strategy-trace-title {
  margin: 0 0 6px;
  color: #8ea6c5;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.strategy-trace-sections {
  display: grid;
  gap: 14px;
}

.strategy-trace-section {
  border: 1px solid rgba(54, 73, 99, 0.65);
  border-radius: 16px;
  padding: 12px 12px 4px;
  background: rgba(11, 17, 28, 0.65);
}

.strategy-trace-section-title {
  margin: 0 0 10px;
  color: #8ea6c5;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.strategy-trace-graph {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0;
}

.strategy-trace-node {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}

.strategy-trace-node:last-child .strategy-trace-connector::after {
  display: none;
}

.strategy-trace-section .strategy-trace-node:last-child .strategy-trace-card {
  margin-bottom: 2px;
}

.strategy-trace-connector {
  position: relative;
  display: block;
}

.strategy-trace-connector::before {
  content: "";
  position: absolute;
  top: 16px;
  left: 50%;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 2px solid #3b516f;
  background: #142032;
  transform: translate(-50%, -50%);
}

.strategy-trace-connector::after {
  content: "";
  position: absolute;
  top: 16px;
  bottom: -8px;
  left: calc(50% - 1px);
  width: 2px;
  background: linear-gradient(180deg, rgba(74, 99, 132, 0.9) 0%, rgba(53, 71, 96, 0.28) 100%);
}

.strategy-trace-node.pass .strategy-trace-connector::before {
  border-color: #2f6f4f;
  background: #153226;
}

.strategy-trace-node.fail .strategy-trace-connector::before {
  border-color: #7c3542;
  background: #351a21;
}

.strategy-trace-node.info .strategy-trace-connector::before {
  border-color: #315a86;
  background: #15253a;
}

.strategy-trace-node.skip .strategy-trace-connector::before {
  border-color: #7a4d1f;
  background: #352514;
}

.strategy-trace-card {
  margin-bottom: 10px;
  border: 1px solid #30425d;
  border-radius: 14px;
  padding: 10px 12px;
  background: linear-gradient(180deg, rgba(16, 25, 38, 0.95) 0%, rgba(12, 19, 30, 0.98) 100%);
  box-shadow: inset 0 1px 0 rgba(111, 143, 187, 0.06);
}

.strategy-trace-card.pass {
  border-color: rgba(47, 111, 79, 0.9);
}

.strategy-trace-card.fail {
  border-color: rgba(124, 53, 66, 0.95);
}

.strategy-trace-card.info {
  border-color: rgba(49, 90, 134, 0.95);
}

.strategy-trace-card.skip {
  border-color: rgba(122, 77, 31, 0.95);
}

.strategy-trace-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.strategy-trace-node-title {
  color: #dce8f8;
  font-size: 0.83rem;
  line-height: 1.3;
}

.strategy-trace-node-detail {
  margin: 8px 0 0;
  color: #b5c6dd;
  font-size: 0.78rem;
  line-height: 1.5;
  word-break: break-word;
}

.strategy-trace-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  border-radius: 999px;
  padding: 2px 7px;
  border: 1px solid #3b516f;
  background: rgba(27, 39, 58, 0.75);
  color: #afc2df;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.strategy-trace-badge.pass {
  border-color: #2f6f4f;
  background: rgba(27, 77, 55, 0.28);
  color: #74e6b1;
}

.strategy-trace-badge.fail {
  border-color: #7c3542;
  background: rgba(88, 30, 40, 0.32);
  color: #ff9cab;
}

.strategy-trace-badge.info {
  border-color: #315a86;
  background: rgba(24, 45, 71, 0.32);
  color: #9db8dd;
}

.strategy-trace-badge.skip {
  border-color: #7a4d1f;
  background: rgba(95, 58, 20, 0.28);
  color: #ffc68a;
}

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

.strategy-debug-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.strategy-debug-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 10, 18, 0.78);
  backdrop-filter: blur(4px);
}

.strategy-debug-dialog {
  position: relative;
  width: min(760px, calc(100vw - 32px));
  max-height: min(82vh, 920px);
  overflow: auto;
  border: 1px solid #314663;
  border-radius: 18px;
  background: linear-gradient(180deg, #111a28 0%, #0c1320 100%);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.48);
  padding: 18px 18px 20px;
}

.strategy-debug-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.strategy-debug-eyebrow {
  margin: 0 0 4px;
  color: #8ea6c5;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.strategy-debug-title {
  margin: 0;
  color: #e3ecfa;
  font-size: 1.15rem;
}

.strategy-debug-close {
  border: 1px solid #3d5576;
  border-radius: 999px;
  padding: 6px 12px;
  background: rgba(20, 31, 47, 0.9);
  color: #b6c9e3;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.strategy-debug-close:hover {
  border-color: #56749a;
  color: #e1ecfb;
}

.strategy-debug-subtitle {
  margin: 10px 0 0;
  color: #9cb2cd;
  font-size: 0.78rem;
}

.strategy-debug-body {
  margin-top: 14px;
}

.strategy-conflict-note {
  margin: 0;
  border: 1px solid #5c4730;
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(70, 52, 27, 0.25);
  color: #e7c98f;
  font-size: 0.75rem;
}

.position-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px 14px;
}

.position-grid p {
  margin: 0;
}

.risk-bar {
  display: inline-block;
  width: 120px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #172132;
  margin-right: 8px;
  vertical-align: middle;
  overflow: hidden;
}

.risk-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #39c6ff 0%, #3cd38f 100%);
}

.mono,
code {
  font-family: "IBM Plex Mono", monospace;
}

@media (max-width: 1024px) {
  .metrics,
  .main-grid,
  .summary-strip {
    grid-template-columns: 1fr 1fr;
  }
  .manual-order-form {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "left amount"
      "auto auto";
  }
  .manual-left-stack .manual-field-submit {
    width: auto;
    min-width: 180px;
  }
  .timeline {
    max-height: none;
  }
  .orders-board {
    max-height: 340px;
  }
  .strategy-summary-grid {
    grid-template-columns: 1fr;
  }
  .strategy-row {
    padding: 10px;
  }
  .strategy-row-title {
    font-size: 0.75rem;
  }
  .strategy-inline-line {
    font-size: 0.75rem;
  }
}

@media (max-width: 960px) {
  body.with-side-menu {
    padding-left: 0;
  }

  body.with-side-menu .dashboard,
  body.with-side-menu.sidebar-hidden .dashboard {
    width: min(1520px, 97vw);
    margin: 8px auto;
  }

  body.with-side-menu .app-footer,
  body.with-side-menu.sidebar-hidden .app-footer {
    width: 100%;
    margin-left: 0;
  }

  body.with-side-menu .left-menu {
    width: min(280px, 84vw);
    z-index: 30;
    transform: translateX(-100%);
  }

  body.with-side-menu .left-menu-overlay {
    display: block;
  }

  body.with-side-menu .left-menu-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

@media (max-width: 720px) {
  body.with-side-menu {
    padding-left: 0;
  }

  body.with-side-menu .dashboard,
  body.with-side-menu.sidebar-hidden .dashboard {
    width: 94vw;
    margin: 16px auto;
  }

  body.with-side-menu .app-footer,
  body.with-side-menu.sidebar-hidden .app-footer {
    width: 100%;
    margin-left: 0;
  }

  .dashboard {
    width: 94vw;
    margin: 16px auto;
  }

  .login-page {
    margin-top: 22px;
  }

  .login-card {
    padding: 14px;
  }

  .topbar,
  .metrics,
  .main-grid,
  .summary-strip {
    grid-template-columns: 1fr;
    display: grid;
  }

  .topbar {
    grid-template-areas:
      "brand"
      "actions"
      "status";
    gap: 12px;
    height: auto;
    min-height: 0;
  }

  .topbar-actions,
  .topbar-status {
    flex-wrap: wrap;
    overflow-x: visible;
  }

  .price-strip {
    height: 170px;
  }

  .market-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .manual-order-form {
    grid-template-columns: 1fr;
    grid-template-areas:
      "left"
      "amount"
      "auto";
  }

  .vip-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .vip-value {
    text-align: left;
    white-space: normal;
  }

  .strategy-debug-modal {
    padding: 12px;
  }

  .strategy-debug-dialog {
    width: min(760px, calc(100vw - 24px));
    max-height: calc(100vh - 24px);
    padding: 14px;
  }

  .strategy-debug-head {
    flex-direction: column;
    align-items: stretch;
  }

  .strategy-debug-close {
    width: 100%;
  }
}

@media (max-width: 900px) {
  .metrics,
  .main-grid,
  .summary-strip {
    grid-template-columns: 1fr;
  }

  .column-stack {
    gap: 10px;
  }

  .panel {
    padding: 9px;
  }

  .panel-title-row {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 6px;
  }

  .orders-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .orders-filter {
    max-width: 100%;
  }

  .history-chart-wrap {
    min-height: 280px;
  }

  .layout-enabled-panel,
  .layout-enabled-panel.metric-card,
  .layout-enabled-panel.market-panel,
  .layout-enabled-panel.strategy-panel,
  .layout-enabled-panel.orders-panel,
  .layout-enabled-panel.profit-panel,
  .layout-enabled-panel.next-panel,
  .layout-enabled-panel.timeline-panel,
  .layout-enabled-panel.position-panel {
    width: 100% !important;
    max-width: 100%;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    resize: none;
    overflow: visible;
  }

  .layout-panel-toolbar,
  .layout-enabled-panel.layout-toolbar-offset .layout-panel-toolbar {
    position: static;
    top: auto;
    right: auto;
    left: auto;
    margin: 0 0 6px auto;
    max-width: 100%;
  }
}
