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

* {
  box-sizing: border-box;
}

html {
  background: #070b12;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background-color: #070b12;
  background-image: radial-gradient(110% 110% at 10% 0%, #151d2b 0%, #0d1118 58%, #070b12 100%);
  font-family: "Space Grotesk", sans-serif;
  position: relative;
}

.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;
}

.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: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.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 #3d5f86;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #c6ddf8;
  text-decoration: none;
  background: linear-gradient(180deg, #1a3958 0%, #14304a 100%);
  transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
}

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

.tz-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.72rem;
  color: var(--muted);
  background: #101722;
}

.tz-select {
  appearance: none;
  border: 1px solid #2f3c4f;
  background: #0e1520;
  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 9px;
  font-size: 0.76rem;
  background: #101722;
}

.badge-poll {
  border-color: #2f4a66;
  background: #122133;
  color: #9ec7ea;
  min-width: 104px;
  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: #87621f;
  background: #342812;
  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;
}

.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);
}

.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;
}

.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;
}

.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%);
}

#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);
}

.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;
}

.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-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;
}

.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-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;
}

@media (min-width: 1280px) and (min-height: 860px) {
  .dashboard {
    max-height: calc(100vh - 12px);
  }
}

.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: 720px) {
  .dashboard {
    width: 94vw;
    margin: 16px auto;
  }

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

  .topbar {
    gap: 12px;
  }

  .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";
  }
}
