:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #050c12;
  --panel: rgba(8, 18, 27, 0.88);
  --panel-2: rgba(12, 25, 36, 0.72);
  --line: rgba(129, 151, 170, 0.18);
  --text: #edf4f7;
  --muted: #95a5b2;
  --green: #20e79a;
  --red: #ff5d63;
  --amber: #f5b319;
  --cyan: #20c7f4;
  --purple: #9b68ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 45% 0%, rgba(0, 132, 255, 0.16), transparent 36%),
    radial-gradient(circle at 20% 55%, rgba(0, 220, 178, 0.08), transparent 32%),
    var(--bg);
  color: var(--text);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.shell {
  width: min(1920px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 18px 0 28px;
}

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 28px;
  min-height: 48px;
}

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

.brand h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border: 2px solid #00e5d4;
  border-radius: 50%;
  position: relative;
  box-shadow: 0 0 28px rgba(0, 229, 212, 0.32);
}

.brand-mark::after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  top: 13px;
  height: 2px;
  border-radius: 4px;
  background: #00e5d4;
  transform: rotate(-38deg);
}

.mode-pill,
.runtime span,
.tabs span {
  border-radius: 7px;
  background: rgba(17, 43, 56, 0.82);
  color: var(--green);
  font-weight: 700;
}

.mode-pill {
  padding: 9px 13px;
  font-size: 13px;
  border: 1px solid rgba(32, 231, 154, 0.2);
}

.runtime {
  display: flex;
  align-items: center;
  gap: 28px;
  color: #d8e2e7;
  font-size: 14px;
}

.runtime span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  background: transparent;
  color: #d8e2e7;
}

.runtime i,
.pulse-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 18px rgba(32, 231, 154, 0.65);
}

.top-actions,
.strategy-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tool-button,
.strategy-actions button {
  min-height: 44px;
  padding: 0 20px;
  border-radius: 7px;
  background: linear-gradient(180deg, rgba(31, 45, 60, 0.95), rgba(20, 31, 43, 0.95));
  color: #dce7ec;
  border: 1px solid rgba(151, 170, 188, 0.12);
  font-weight: 800;
}

.tool-button.compact {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.strategy-actions button:not(.secondary) {
  color: #04110d;
  background: linear-gradient(180deg, #34f0b0, #12b978);
}

.strategy-actions .secondary {
  background: #13202c;
}

.strategy-panel {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) auto minmax(420px, 1fr);
  gap: 14px;
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  transition: all 0.2s ease;
}

.strategy-panel.is-collapsed {
  display: none;
}

.strategy-input {
  display: grid;
  gap: 8px;
}

label span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid rgba(129, 151, 170, 0.22);
  border-radius: 7px;
  background: rgba(6, 13, 20, 0.88);
  color: var(--text);
}

textarea {
  min-height: 82px;
  resize: vertical;
  padding: 11px 12px;
  line-height: 1.45;
}

input {
  min-height: 38px;
  padding: 0 10px;
}

.strategy-summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid rgba(129, 151, 170, 0.18);
  border-radius: 7px;
  color: #c3d0d8;
  background: rgba(5, 12, 18, 0.72);
  font-size: 13px;
}

.parameter-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.parameter-grid label {
  display: grid;
  gap: 7px;
}

.metric-strip,
.panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(25, 52, 71, 0.38), rgba(5, 13, 21, 0.82)),
    var(--panel);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.metric-strip {
  display: grid;
  grid-template-columns: 1.25fr repeat(6, 1fr);
  gap: 0;
  margin-top: 18px;
  padding: 18px 22px;
}

.metric-strip article {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 82px;
  padding: 0 20px;
  border-right: 1px solid var(--line);
}

.metric-strip article:last-child {
  border-right: 0;
}

.metric-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(32, 199, 244, 0.15);
  border: 1px solid rgba(32, 199, 244, 0.25);
  box-shadow: 0 0 26px rgba(32, 199, 244, 0.12);
}

.metric-icon.purple { background: rgba(155, 104, 255, 0.16); border-color: rgba(155, 104, 255, 0.25); }
.metric-icon.green { background: rgba(32, 231, 154, 0.14); border-color: rgba(32, 231, 154, 0.25); }
.metric-icon.amber { background: rgba(245, 179, 25, 0.15); border-color: rgba(245, 179, 25, 0.25); }
.metric-icon.cyan { background: rgba(32, 199, 244, 0.15); border-color: rgba(32, 199, 244, 0.25); }
.metric-icon.red { background: rgba(255, 93, 99, 0.14); border-color: rgba(255, 93, 99, 0.25); }
.metric-icon.neutral { background: rgba(154, 167, 179, 0.15); border-color: rgba(154, 167, 179, 0.25); }

.metric-strip span,
.mini-stats span {
  display: block;
  color: #c0cbd3;
  font-size: 14px;
  font-weight: 700;
}

.metric-strip strong,
.mini-stats strong {
  display: block;
  margin-top: 5px;
  color: var(--text);
  font-size: 22px;
}

.metric-strip small,
.mini-stats small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.signal-panel {
  margin-top: 18px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 62px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
}

.panel-title h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0;
}

.panel-title > span {
  color: var(--muted);
  font-size: 14px;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 13px 24px;
  border-bottom: 1px solid rgba(129, 151, 170, 0.14);
  text-align: left;
  white-space: nowrap;
}

th {
  color: #a9b5be;
  font-size: 13px;
  font-weight: 800;
}

td {
  color: #eef4f7;
}

.fav {
  width: 26px;
  color: #6f7d88;
  font-size: 18px;
}

.fav.hot {
  color: var(--amber);
}

.symbol-cell {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.coin {
  display: inline-grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.coin.btc { background: #f7931a; }
.coin.eth { background: #627eea; }
.coin.sol { background: linear-gradient(135deg, #9945ff, #14f195); }
.coin.xrp { background: #54616c; }

.direction-up,
.positive,
.profit {
  color: var(--green);
  font-weight: 800;
}

.direction-down,
.negative,
.loss {
  color: var(--red);
  font-weight: 800;
}

.time-low {
  color: var(--red);
  font-weight: 800;
}

.advice {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  min-height: 27px;
  border-radius: 6px;
  font-weight: 900;
  font-size: 13px;
}

.advice.watch {
  color: var(--amber);
  border: 1px solid rgba(245, 179, 25, 0.52);
  background: rgba(245, 179, 25, 0.12);
}

.advice.trade {
  color: var(--green);
  border: 1px solid rgba(32, 231, 154, 0.52);
  background: rgba(32, 231, 154, 0.12);
}

.is-signal {
  background: rgba(32, 231, 154, 0.08);
}

.bottom-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr 0.9fr;
  gap: 14px;
  margin-top: 14px;
}

.bottom-grid .panel {
  min-height: 360px;
  overflow: hidden;
}

.tabs {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tabs span {
  padding: 7px 13px;
  background: transparent;
  color: #c5d0d7;
  font-size: 13px;
}

.tabs span.active {
  background: rgba(32, 231, 154, 0.16);
  color: var(--green);
}

.mini-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  padding: 14px 24px 10px;
}

.mini-stats article {
  min-height: 88px;
  padding: 14px;
  border-radius: 7px;
  background: rgba(24, 37, 50, 0.75);
}

.chart-card {
  padding: 4px 24px 20px;
}

.chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #cbd6dd;
  font-weight: 800;
  margin-bottom: 10px;
}

.chart-head select {
  width: auto;
  min-height: 34px;
  padding: 0 12px;
  color: #cbd6dd;
}

.equity-chart {
  position: relative;
  display: grid;
  grid-template-rows: repeat(5, 1fr);
  height: 130px;
  overflow: hidden;
  border-radius: 7px;
}

.equity-chart span {
  color: #8f9fab;
  font-size: 12px;
  border-bottom: 1px dashed rgba(143, 159, 171, 0.22);
}

.equity-chart i {
  position: absolute;
  left: 42px;
  right: 6px;
  top: 64px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--green), transparent);
  box-shadow: 0 0 18px rgba(32, 231, 154, 0.32);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 250px;
  color: #8fa0aa;
  text-align: center;
}

.empty {
  margin: 0;
  padding: 18px 24px;
  color: #8fa0aa;
}

.empty-state strong {
  display: block;
  color: #d9e2e7;
  font-size: 16px;
  margin-bottom: 8px;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.row-actions button {
  min-height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  font-weight: 800;
  color: #05100d;
  background: var(--green);
}

.settlement-state {
  color: #a8b8c4;
  font-size: 12px;
  font-weight: 800;
}

.row-actions button.secondary {
  color: #f4f7f8;
  background: rgba(255, 93, 99, 0.28);
}

.activity-log {
  max-height: 300px;
  overflow: auto;
}

.activity-line {
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 14px;
  padding: 11px 24px;
  border-bottom: 1px solid rgba(129, 151, 170, 0.14);
}

.activity-line span {
  color: #91a1ad;
  font-size: 13px;
}

.activity-line p {
  margin: 0;
  color: #c4d0d8;
  font-size: 13px;
  line-height: 1.45;
}

@media (max-width: 1300px) {
  .metric-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .metric-strip article {
    border-bottom: 1px solid var(--line);
  }

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

@media (max-width: 760px) {
  body {
    min-width: 0;
  }

  .shell {
    width: min(100%, calc(100vw - 24px));
    padding: 12px 0 20px;
  }

  .topbar {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .brand {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
  }

  .brand h1 {
    font-size: 19px;
    line-height: 1.25;
  }

  .brand-mark {
    width: 26px;
    height: 26px;
  }

  .brand-mark::after {
    top: 11px;
  }

  .mode-pill {
    padding: 7px 10px;
  }

  .runtime,
  .top-actions,
  .strategy-actions {
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .runtime {
    font-size: 13px;
  }

  .tool-button,
  .strategy-actions button {
    min-height: 42px;
    padding: 0 13px;
    flex: 0 0 auto;
  }

  .strategy-panel {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .strategy-summary {
    align-items: flex-start;
    line-height: 1.45;
  }

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

  .metric-strip {
    grid-template-columns: 1fr 1fr;
    margin-top: 14px;
    padding: 0;
    overflow: hidden;
  }

  .metric-strip article {
    min-height: 88px;
    padding: 14px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }

  .metric-strip article:nth-child(2n) {
    border-right: 0;
  }

  .metric-icon {
    display: none;
  }

  .metric-strip span,
  .mini-stats span {
    font-size: 12px;
  }

  .metric-strip strong,
  .mini-stats strong {
    font-size: 18px;
  }

  .signal-panel {
    margin-top: 14px;
  }

  .panel-title {
    min-height: auto;
    padding: 14px;
    align-items: flex-start;
    flex-direction: column;
  }

  .panel-title h2 {
    font-size: 18px;
  }

  th,
  td {
    padding: 12px 14px;
    font-size: 13px;
  }

  table,
  tbody,
  tr,
  td {
    display: block;
  }

  thead {
    display: none;
  }

  .table-wrap {
    overflow-x: visible;
  }

  .signal-table,
  .trades-panel table {
    min-width: 0;
  }

  tbody {
    display: grid;
    gap: 10px;
    padding: 12px;
  }

  tr {
    border: 1px solid rgba(129, 151, 170, 0.16);
    border-radius: 8px;
    background: rgba(7, 17, 25, 0.76);
    overflow: hidden;
  }

  td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 42px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(129, 151, 170, 0.1);
    white-space: normal;
    text-align: right;
  }

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

  .signal-table td::before,
  .trades-panel td::before {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-align: left;
  }

  .signal-table td:nth-child(1) {
    display: none;
  }

  .signal-table td:nth-child(2)::before { content: "标的"; }
  .signal-table td:nth-child(3)::before { content: "方向"; }
  .signal-table td:nth-child(4)::before { content: "概率"; }
  .signal-table td:nth-child(5)::before { content: "价格优势"; }
  .signal-table td:nth-child(6)::before { content: "买价"; }
  .signal-table td:nth-child(7)::before { content: "剩余时间"; }
  .signal-table td:nth-child(8)::before { content: "建议"; }
  .signal-table td:nth-child(9)::before { content: "原因"; }

  .trades-panel td:nth-child(1)::before { content: "时间"; }
  .trades-panel td:nth-child(2)::before { content: "标的"; }
  .trades-panel td:nth-child(3)::before { content: "方向"; }
  .trades-panel td:nth-child(4)::before { content: "概率"; }
  .trades-panel td:nth-child(5)::before { content: "买价"; }
  .trades-panel td:nth-child(6)::before { content: "价格优势"; }
  .trades-panel td:nth-child(7)::before { content: "盈亏"; }
  .trades-panel td:nth-child(8)::before { content: "状态"; }

  .bottom-grid {
    gap: 12px;
    margin-top: 12px;
  }

  .bottom-grid .panel {
    min-height: auto;
  }

  .tabs {
    width: 100%;
    overflow-x: auto;
  }

  .tabs span {
    flex: 0 0 auto;
    padding: 7px 10px;
  }

  .mini-stats {
    grid-template-columns: 1fr 1fr;
    padding: 12px;
  }

  .mini-stats article {
    min-height: 78px;
    padding: 12px;
  }

  .chart-card {
    padding: 0 12px 14px;
  }

  .chart-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .activity-log {
    max-height: 360px;
  }

  .activity-line {
    grid-template-columns: 64px 1fr;
    gap: 10px;
    padding: 10px 14px;
  }

  .row-actions {
    justify-content: flex-end;
    min-width: 0;
    flex-wrap: wrap;
  }
}

@media (max-width: 420px) {
  .parameter-grid,
  .metric-strip,
  .mini-stats {
    grid-template-columns: 1fr;
  }

  .metric-strip article,
  .metric-strip article:nth-child(2n) {
    border-right: 0;
  }

  .top-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    overflow-x: visible;
  }

  .top-actions .tool-button {
    width: 100%;
    padding: 0 10px;
  }

  .top-actions .tool-button:last-child {
    grid-column: 1 / -1;
  }
}
