:root {
  --bg: #f4f7f5;
  --surface: #ffffff;
  --surface-2: #edf5f1;
  --ink: #14211f;
  --muted: #64736f;
  --line: #d7e1dd;
  --green: #008f5a;
  --green-soft: #dcf7ea;
  --red: #c93545;
  --red-soft: #fde4e8;
  --amber: #b86f00;
  --amber-soft: #fff0ce;
  --blue: #1769aa;
  --blue-soft: #e0f0ff;
  --shadow: 0 14px 40px rgba(20, 33, 31, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

body.settings-modal-open {
  overflow: hidden;
}

body.privacy-mode #mainnetWalletBalance,
body.privacy-mode #mainnetSummaryBalance,
body.privacy-mode #mainnetAvailableBalance,
body.privacy-mode #mainnetUnrealizedPnl,
body.privacy-mode #mainnetSymbolPrice,
body.privacy-mode #mainnetPositionsList,
body.privacy-mode #mainnetOrdersList,
body.privacy-mode #accountMainnetState,
body.privacy-mode #accountTestnetState,
body.privacy-mode #tradeHistory td:nth-child(5),
body.privacy-mode #tradeHistory td:nth-child(8),
body.privacy-mode #tradeHistory td:nth-child(9) {
  filter: blur(6px);
  user-select: none;
}

body.privacy-mode #mainnetWalletBalance::selection,
body.privacy-mode #mainnetSummaryBalance::selection,
body.privacy-mode #mainnetAvailableBalance::selection,
body.privacy-mode #mainnetUnrealizedPnl::selection {
  background: transparent;
}

.headline-alert-banner {
  position: fixed;
  top: 12px;
  left: 50%;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(920px, calc(100vw - 36px));
  min-height: 54px;
  padding: 12px 18px;
  border: 2px solid #fecaca;
  border-radius: 8px;
  background: #dc2626;
  color: #fff;
  box-shadow: 0 18px 50px rgba(220, 38, 38, 0.34);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -130%);
}

.headline-alert-banner strong {
  flex: 0 0 auto;
  font-size: 18px;
  letter-spacing: 0;
}

.headline-alert-banner span {
  min-width: 0;
  overflow: hidden;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.headline-alert-banner.show {
  animation: headlineBannerDrop 2.2s ease-in-out both;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.top-bar,
.panel,
.history-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.top-bar {
  min-height: 76px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand,
.status-strip,
.panel-head,
.history-actions {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
}

.brand-image {
  width: 42px;
  height: 42px;
  border-radius: 8px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 18px;
}

.status-strip {
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-pill,
.timer-chip,
.source-pill,
.symbol-chip,
.result-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border-radius: 8px;
  padding: 4px 10px;
  font-weight: 700;
  white-space: nowrap;
}

.status-live {
  background: var(--green-soft);
  color: var(--green);
}

.status-neutral {
  background: var(--surface-2);
  color: var(--muted);
}

.status-success {
  background: var(--green-soft);
  color: var(--green);
}

.status-warning {
  background: rgba(245, 158, 11, 0.16);
  color: #d97706;
}

.status-danger {
  background: var(--red-soft);
  color: var(--red);
}

.terminal-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(460px, 1.2fr) minmax(340px, 0.95fr);
  gap: 14px;
  margin-top: 14px;
  align-items: start;
}

.panel {
  min-height: 0;
  padding: 16px;
  overflow: hidden;
}

.panel-head {
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
  margin-bottom: 14px;
}

.ghost-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 6px 10px;
  font-weight: 700;
}

.ghost-button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.ghost-button.danger:hover {
  border-color: var(--red);
  color: var(--red);
}

.feed-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.news-panel {
  display: flex;
  flex-direction: column;
}

.ghost-button.active {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
}

.ghost-button.sound-warning {
  border-color: var(--amber);
  background: var(--amber-soft);
  color: var(--amber);
}

.news-feed {
  display: grid;
  align-content: start;
  gap: 10px;
  height: clamp(360px, calc(100vh - 250px), 560px);
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.news-radar {
  display: none;
}

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

.radar-stats div,
.radar-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.radar-stats div {
  min-height: 54px;
  padding: 8px 10px;
}

.radar-stats span,
.radar-title {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.radar-stats strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 16px;
  overflow-wrap: anywhere;
}

.radar-block {
  padding: 10px;
}

.radar-title {
  margin-bottom: 7px;
}

.radar-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 28px;
}

.radar-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
}

button.radar-chip {
  cursor: pointer;
}

button.radar-chip:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.source-radar {
  display: grid;
  gap: 7px;
}

.source-radar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.source-radar-row strong {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.news-item {
  width: 100%;
  border: 1px solid var(--line);
  border-left: 5px solid var(--blue);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 12px;
  text-align: left;
  transition: border-color 0.16s ease, transform 0.16s ease, background 0.16s ease;
}

.news-item:hover,
.news-item.active {
  border-color: var(--blue);
  background: #f7fbff;
}

.news-item:active {
  transform: translateY(1px);
}

.news-item.high {
  border-left-color: var(--red);
}

.news-item.medium {
  border-left-color: var(--amber);
}

.news-empty {
  min-height: 100%;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 18px;
  text-align: center;
}

.news-empty strong {
  color: var(--ink);
  font-size: 16px;
}

.news-empty span {
  max-width: 320px;
  line-height: 1.5;
  font-size: 13px;
  font-weight: 700;
}

@keyframes headlineBannerDrop {
  0% {
    opacity: 0;
    transform: translate(-50%, -130%);
  }

  10%,
  85% {
    opacity: 1;
    transform: translate(-50%, 0);
  }

  18%,
  34%,
  50% {
    background: #991b1b;
  }

  26%,
  42%,
  58% {
    background: #dc2626;
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -130%);
  }
}

.news-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}

.news-source-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}

.source-pill {
  min-height: 24px;
  font-size: 12px;
  background: var(--surface-2);
  color: var(--ink);
}

.transport-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.transport-pill.transport-tg {
  border-color: #cfe7ff;
  background: #eef6ff;
  color: #155e9d;
}

.transport-pill.transport-ws {
  border-color: #c9efde;
  background: #ebfaf2;
  color: #11714a;
}

.transport-pill.transport-sim {
  border-color: #f0e2b3;
  background: #fff7de;
  color: #8a6500;
}

.news-time {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.news-text {
  margin: 0 0 10px;
  line-height: 1.45;
  font-size: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.mini-chips,
.symbol-chips,
.keyword-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.symbol-chip {
  min-height: 26px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 13px;
}

button.symbol-chip {
  padding: 4px 10px;
}

.symbol-chip.selected {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
}

.symbol-chip.candidate {
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
}

.symbol-chip.candidate.selected {
  border-color: #d97706;
  background: rgba(245, 158, 11, 0.2);
  color: #92400e;
}

.keyword-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 8px;
  padding: 3px 8px;
  background: #f3f6f5;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.news-scan-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 8px;
  align-items: start;
}

.selected-news {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  min-height: 118px;
  max-height: 220px;
  overflow: auto;
  scrollbar-width: thin;
  background: #fbfdfc;
}

.selected-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 9px;
}

#selectedText {
  margin: 0;
  font-size: 16px;
  line-height: 1.44;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.symbol-area {
  margin-top: 11px;
}

.manual-symbol {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.manual-symbol input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
  text-transform: uppercase;
}

.manual-symbol input:focus {
  outline: 2px solid var(--blue-soft);
  border-color: var(--blue);
}

.section-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}

.market-card {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.market-card strong {
  display: block;
  font-size: 18px;
  overflow-wrap: anywhere;
}

.market-card small {
  display: block;
  min-height: 18px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  margin-top: 3px;
}

.kline-panel {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.kline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.kline-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
}

.kline-intervals {
  display: inline-flex;
  gap: 6px;
  flex: 0 0 auto;
}

.kline-interval {
  min-width: 42px;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 800;
}

.kline-interval.active {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
}

.kline-chart-wrap {
  position: relative;
  height: 195px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfa 100%);
}

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

.kline-expand-button {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 2;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

.kline-expand-button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.kline-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.56);
}

.kline-modal.open {
  display: flex;
}

.kline-modal-panel {
  width: min(1280px, calc(100vw - 48px));
  height: min(820px, calc(100vh - 48px));
  display: grid;
  grid-template-rows: auto minmax(360px, 1fr);
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(229, 231, 235, 0.9);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
}

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

.kline-modal-head h2 {
  margin: 2px 0 0;
  color: var(--ink);
  font-size: 20px;
}

.kline-modal-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.kline-modal-close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
}

#klineModalCanvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.kline-empty {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
  background: rgba(255, 255, 255, 0.84);
}

.kline-chart-wrap.empty .kline-empty {
  display: flex;
}

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

.kline-stats div {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--surface-2);
}

.kline-stats span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.kline-stats strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 15px;
  overflow-wrap: anywhere;
}

.kline-status {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.45;
}

.timer-chip {
  background: var(--amber-soft);
  color: var(--amber);
  min-width: 68px;
}

kbd {
  min-width: 34px;
  min-height: 28px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  border: 1px solid #b9c7c2;
  border-bottom-width: 3px;
  border-radius: 6px;
  background: #f7faf8;
  font-weight: 800;
}

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

.trade-panel-head {
  align-items: flex-end;
}

.trade-mode-inline {
  min-width: 248px;
  max-width: 290px;
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #f9fcfb 0%, #ffffff 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.trade-mode-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.trade-mode-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.trade-mode-select-wrap {
  position: relative;
}

.trade-mode-select-wrap::after {
  content: "▾";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #7b8b86;
  font-size: 13px;
  font-weight: 900;
  pointer-events: none;
}

.trade-mode-inline select {
  width: 100%;
  min-height: 40px;
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 36px 7px 10px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 1px rgba(15, 23, 42, 0.03);
}

.trade-mode-inline select:focus {
  outline: 2px solid var(--blue-soft);
  border-color: var(--blue);
}

.trade-mode-hint {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  font-weight: 700;
}

.trade-mode-inline.mode-sim {
  border-color: rgba(22, 163, 74, 0.18);
  background: linear-gradient(180deg, rgba(236, 253, 245, 0.76) 0%, #ffffff 100%);
}

.trade-mode-inline.mode-sim .trade-mode-badge {
  background: rgba(22, 163, 74, 0.14);
  color: var(--green);
}

.trade-mode-inline.mode-sim .trade-mode-select-wrap::after {
  color: var(--green);
}

.trade-mode-inline.mode-testnet {
  border-color: rgba(37, 99, 235, 0.18);
  background: linear-gradient(180deg, rgba(239, 246, 255, 0.9) 0%, #ffffff 100%);
}

.trade-mode-inline.mode-testnet .trade-mode-badge {
  background: rgba(37, 99, 235, 0.12);
  color: var(--blue);
}

.trade-mode-inline.mode-testnet .trade-mode-select-wrap::after {
  color: var(--blue);
}

.trade-mode-inline.mode-mainnet {
  border-color: rgba(245, 158, 11, 0.25);
  background: linear-gradient(180deg, rgba(255, 247, 237, 0.95) 0%, #ffffff 100%);
}

.trade-mode-inline.mode-mainnet .trade-mode-badge {
  background: rgba(245, 158, 11, 0.18);
  color: #b45309;
}

.trade-mode-inline.mode-mainnet .trade-mode-select-wrap::after {
  color: #b45309;
}

.trade-form-wide {
  grid-column: 1 / -1;
}

.trade-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.trade-form input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
}

.trade-form select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
}

.trade-form input:focus {
  outline: 2px solid var(--blue-soft);
  border-color: var(--blue);
}

.trade-form select:focus {
  outline: 2px solid var(--blue-soft);
  border-color: var(--blue);
}

.margin-type-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.margin-type-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.margin-type-button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.margin-type-button:focus {
  outline: 2px solid var(--blue-soft);
  border-color: var(--blue);
}

.margin-type-button.active {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
}

.trade-form-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  font-weight: 700;
}

.risk-box {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdfc;
}

.risk-box div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 32px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.risk-box div:last-of-type {
  border-bottom: 0;
}

.risk-box strong {
  color: var(--ink);
}

#riskMessage {
  margin: 12px 0 0;
  color: var(--green);
  font-weight: 700;
  line-height: 1.45;
}

.risk-box.warn #riskMessage {
  color: var(--amber);
}

.risk-box.danger #riskMessage {
  color: var(--red);
}

.guard-panel {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfb;
  padding: 12px;
}

.news-panel .guard-panel {
  background: #fbfdfc;
}

.guard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.risk-state-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  background: #edf3f2;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.risk-state-badge.ok {
  background: var(--green-soft);
  color: var(--green);
}

.risk-state-badge.warn {
  background: var(--amber-soft);
  color: #7a4d00;
}

.risk-state-badge.danger {
  background: var(--red-soft);
  color: var(--red);
}

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

.guard-grid + .guard-grid,
.guard-note,
.guard-api {
  margin-top: 10px;
}

.guard-grid div {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 9px 10px;
}

.guard-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}

.guard-grid strong {
  display: block;
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.guard-note {
  border-radius: 8px;
  background: #edf3f2;
  color: #385452;
  padding: 10px 12px;
  line-height: 1.45;
  font-weight: 700;
}

.guard-note.warn {
  background: var(--amber-soft);
  color: #7a4d00;
}

.guard-note.danger {
  background: var(--red-soft);
  color: var(--red);
}

.guard-api {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
}

.guard-api strong {
  display: block;
  margin-bottom: 8px;
}

.guard-api.danger {
  border-color: #f0c5cc;
  background: #fff6f7;
}

.mainnet-read-panel[hidden] {
  display: none;
}

.mainnet-read-panel {
  background: linear-gradient(180deg, #f9fcfb 0%, #f4faf7 100%);
}

.mainnet-live-panel[hidden] {
  display: none;
}

.trade-panel.mainnet-mode {
  border-color: #f2b8bf;
  box-shadow: 0 18px 48px rgba(201, 53, 69, 0.12);
}

.mainnet-live-panel {
  background: linear-gradient(180deg, #fff8f8 0%, #fffdfb 100%);
}

.mainnet-unlock-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.mainnet-unlock-list label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.mainnet-unlock-list input[type="text"] {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
}

.mainnet-live-panel .testnet-actions {
  margin-top: 10px;
}

.mainnet-live-panel > .ghost-button {
  width: 100%;
  margin-top: 10px;
}

.mainnet-head {
  align-items: center;
}

.mainnet-toggle {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.mainnet-toggle:hover .mainnet-head-copy strong,
.mainnet-toggle:hover .mainnet-toggle-text {
  color: var(--blue);
}

.mainnet-head-copy {
  min-width: 0;
}

.mainnet-head-copy strong,
.mainnet-head-copy span {
  display: block;
}

.mainnet-head-copy strong {
  font-size: 16px;
}

.mainnet-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.mainnet-toggle-text {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.mainnet-summary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.mainnet-summary-pill {
  flex: 1 1 132px;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px 10px;
}

.mainnet-summary-pill span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.mainnet-summary-pill strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
  line-height: 1.15;
  word-break: break-word;
}

.mainnet-read-body {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.mainnet-read-body[hidden] {
  display: none;
}

.mainnet-read-panel.collapsed {
  padding-bottom: 14px;
}

.mainnet-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.9fr);
  gap: 10px;
}

.mainnet-hero-balance,
.mainnet-hero-side-item,
.mainnet-metric-card,
.mainnet-quiet-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.mainnet-hero-balance {
  padding: 12px;
}

.mainnet-hero-label,
.mainnet-hero-side-item span,
.mainnet-metric-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.mainnet-hero-balance strong {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-size: 30px;
  font-weight: 900;
  line-height: 1.05;
  word-break: break-word;
}

.mainnet-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.mainnet-hero-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.mainnet-hero-side {
  display: grid;
  gap: 10px;
}

.mainnet-hero-side-item {
  min-height: 78px;
  padding: 10px 12px;
}

.mainnet-hero-side-item strong {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-size: 22px;
  font-weight: 900;
  word-break: break-word;
}

.mainnet-metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.mainnet-metric-card {
  min-height: 84px;
  padding: 10px 12px;
}

.mainnet-metric-card.wide {
  grid-column: span 2;
}

.mainnet-metric-card strong {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-size: 20px;
  font-weight: 900;
  line-height: 1.15;
  word-break: break-word;
}

.mainnet-metric-card.emphasis strong {
  color: var(--blue);
  font-size: 24px;
}

.mainnet-metric-card small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
}

.mainnet-risk-card .guard-list {
  font-size: 12px;
}

.mainnet-quiet-state {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}

.mainnet-lists {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 10px;
}

.mainnet-list-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
}

.mainnet-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.mainnet-list-block strong {
  font-size: 14px;
}

.mainnet-mini-list {
  display: grid;
  gap: 8px;
  max-height: 176px;
  overflow: auto;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.mainnet-mini-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  padding: 10px;
}

.mainnet-mini-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.mainnet-mini-item strong,
.mainnet-mini-item span {
  display: block;
}

.mainnet-mini-item strong {
  color: var(--ink);
  font-size: 13px;
  margin-bottom: 0;
}

.mainnet-mini-item span + span {
  margin-top: 2px;
}

.mainnet-mini-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.mainnet-mini-tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.mainnet-mini-empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  color: var(--muted);
  padding: 10px 12px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
}

.guard-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.5;
}

.guard-list li + li {
  margin-top: 4px;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.settings-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.settings-entry-button {
  flex: 0 0 auto;
  min-width: 108px;
}

.settings-entry-copy {
  min-width: 0;
}

.settings-entry-copy strong,
.settings-entry-copy span {
  display: block;
}

.settings-entry-copy strong {
  font-size: 14px;
}

.settings-entry-copy span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.action-button {
  min-height: 66px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  font-size: 17px;
  font-weight: 800;
}

.action-button.long {
  background: var(--green);
}

.action-button.short {
  background: var(--red);
}

.action-button.close {
  background: #45524f;
}

.action-button:hover {
  filter: brightness(0.95);
}

.action-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.safety-note {
  margin-top: 12px;
  min-height: 0;
  border-radius: 8px;
  background: var(--amber-soft);
  color: #6d4200;
  padding: 10px 12px;
  line-height: 1.45;
  font-weight: 700;
}

.safety-note.danger {
  background: var(--red-soft);
  color: var(--red);
}

.safety-note.success {
  background: var(--green-soft);
  color: var(--green);
}

.testnet-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.control-actions {
  margin-top: 10px;
}

.ghost-button.strong {
  font-weight: 800;
}

.history-panel {
  margin-top: 14px;
  padding: 16px;
}

.trade-panel {
  align-self: start;
  position: sticky;
  top: 12px;
}

.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(20, 33, 31, 0.42);
}

.settings-modal.open {
  display: flex;
}

.settings-modal-panel {
  width: min(1040px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(20, 33, 31, 0.2);
}

.settings-modal-head,
.settings-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settings-modal-head {
  margin-bottom: 12px;
}

.settings-modal-close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
}

.settings-modal-body {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 14px;
  align-items: start;
}

.account-modal-panel {
  width: min(980px, calc(100vw - 48px));
  padding: 0;
  overflow: hidden;
}

.account-modal-body {
  grid-template-columns: minmax(300px, 0.92fr) minmax(360px, 1.08fr);
  gap: 0;
  align-items: stretch;
  min-height: 460px;
  max-height: calc(100vh - 122px);
  overflow: auto;
}

.account-modal-head {
  margin: 0;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #f6faf8 100%);
}

.account-modal-head .settings-modal-close {
  flex: 0 0 auto;
}

.account-modal-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.account-hero-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100%;
  padding: 22px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(0, 143, 90, 0.1), rgba(23, 105, 170, 0.08)),
    #f7fbf9;
}

.account-hero-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(0, 143, 90, 0.26);
  border-radius: 8px;
  background: #fff;
  color: var(--green);
  font-size: 20px;
  font-weight: 900;
  box-shadow: 0 10px 28px rgba(20, 33, 31, 0.08);
}

.account-hero-card h3 {
  margin: 4px 0 8px;
  font-size: 24px;
  line-height: 1.12;
}

.account-hero-card p {
  margin: 0;
  color: #3b504d;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.65;
}

.account-feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: auto;
}

.account-feature-grid div,
.account-api-summary div {
  min-height: 66px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
}

.account-feature-grid span,
.account-api-summary span,
.account-session-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.account-feature-grid strong,
.account-api-summary strong,
.account-session-summary strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.account-security-note {
  padding: 12px;
  border: 1px solid #ffd88a;
  border-radius: 8px;
  background: #fff7df;
  color: #7a4d00;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.5;
}

.account-login-card,
.account-api-card {
  margin: 18px;
}

.account-login-card {
  align-self: start;
}

.account-api-card {
  grid-column: 2;
  margin-top: 0;
}

.account-card-head strong {
  display: block;
  margin-top: 4px;
  font-size: 17px;
}

.account-step {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
}

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

.account-login-form .settings-save-button,
.account-login-form label.settings-wide {
  grid-column: 1;
}

.account-primary-button {
  min-height: 44px;
  border-color: var(--green);
  background: var(--green);
  color: #fff;
  font-size: 15px;
}

.account-primary-button:hover {
  border-color: #00734a;
  background: #00734a;
  color: #fff;
}

.account-session-summary {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4faf8;
}

.account-api-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.account-api-summary strong.configured {
  color: var(--green);
}

.account-api-hint {
  margin-top: 10px;
}

.account-api-form {
  margin-top: 12px;
}

.account-api-form input[readonly] {
  background: #f7faf8;
  cursor: text;
}

.account-button {
  min-height: 30px;
}

.settings-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  padding: 12px;
}

.risk-settings-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.settings-preset-row,
.risk-mode-hint {
  grid-column: span 2;
}

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

.settings-preset-button {
  min-height: 40px;
}

.risk-mode-hint {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4faf8;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}

.risk-settings-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.risk-settings-form label.settings-wide {
  grid-column: span 2;
}

.security-status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.security-status-grid div {
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
}

.security-status-grid span,
.security-status-grid strong {
  display: block;
}

.security-status-grid span {
  color: var(--muted);
  font-size: 12px;
}

.security-status-grid strong {
  margin-top: 7px;
  color: var(--ink);
}

.risk-settings-form label.is-disabled {
  opacity: 0.58;
}

.risk-settings-form input[type="number"],
.risk-settings-form input[type="text"],
.risk-settings-form input[type="password"],
.risk-settings-form select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
}

.risk-settings-form input[type="number"]:disabled,
.risk-settings-form input[type="text"]:disabled,
.risk-settings-form input[type="password"]:disabled,
.risk-settings-form select:disabled {
  background: #f3f5f4;
  color: #7d8a87;
  cursor: not-allowed;
}

.risk-toggle {
  grid-column: span 2;
  display: flex !important;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0 12px;
}

.risk-toggle input {
  width: 16px;
  height: 16px;
}

.settings-save-button {
  grid-column: span 2;
}

.ai-insight {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfa;
  padding: 8px 10px;
}

.ai-insight-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ai-insight-head strong {
  font-size: 13px;
  font-weight: 900;
}

.ai-insight-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.ai-insight-body {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.42;
}

.ai-insight-body p {
  margin: 0;
}

.ai-insight-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.ai-insight-metrics span,
.ai-insight-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.ai-insight-metrics span {
  border: 1px solid rgba(31, 136, 61, 0.18);
  background: rgba(31, 136, 61, 0.08);
  color: #156f32;
}

.ai-insight-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.ai-insight-tags span {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
}

.ai-news-grade {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 8px;
  align-items: center;
  margin: 6px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 7px 8px;
}

.ai-news-grade-main {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ai-news-grade-main strong {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 2px 8px;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  font-weight: 950;
}

.ai-news-grade-main span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.ai-news-grade-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.ai-news-grade-copy b {
  color: var(--ink);
  font-size: 13px;
}

.ai-news-grade-copy small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.ai-news-grade.grade-s {
  border-color: rgba(213, 63, 79, 0.34);
  background: rgba(213, 63, 79, 0.06);
}

.ai-news-grade.grade-s .ai-news-grade-main strong {
  background: var(--red);
}

.ai-news-grade.grade-a {
  border-color: rgba(245, 158, 11, 0.38);
  background: rgba(245, 158, 11, 0.08);
}

.ai-news-grade.grade-a .ai-news-grade-main strong {
  background: #b7791f;
}

.ai-news-grade.grade-b {
  border-color: rgba(20, 111, 222, 0.28);
  background: rgba(20, 111, 222, 0.06);
}

.ai-news-grade.grade-b .ai-news-grade-main strong {
  background: var(--blue);
}

.ai-news-grade.grade-c {
  background: #f8faf9;
}

.ai-news-grade.grade-c .ai-news-grade-main strong {
  background: #6b7280;
}

.ai-trade-suggestion {
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 8px;
}

.ai-trade-suggestion.actionable {
  border-color: rgba(31, 136, 61, 0.24);
  background: rgba(31, 136, 61, 0.04);
}

.ai-trade-suggestion.blocked {
  border-color: rgba(213, 63, 79, 0.22);
  background: rgba(213, 63, 79, 0.05);
}

.ai-trade-suggestion.compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 34px;
}

.ai-trade-suggestion.compact strong {
  color: var(--ink);
  font-size: 13px;
}

.ai-trade-suggestion.compact span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.ai-trade-suggestion-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.ai-trade-suggestion-head strong {
  font-size: 14px;
  color: var(--ink);
}

.ai-trade-suggestion-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.ai-trade-suggestion-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.ai-trade-suggestion-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  padding: 7px 8px;
}

.ai-trade-suggestion-grid span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.ai-trade-suggestion-grid strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 14px;
}

.ai-trade-suggestion p {
  margin: 8px 0 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
}

.ai-trade-suggestion small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-weight: 700;
}

.ai-apply-button {
  width: 100%;
  min-height: 34px;
  margin-top: 9px;
  border: 1px solid rgba(20, 111, 222, 0.35);
  border-radius: 8px;
  background: rgba(20, 111, 222, 0.08);
  color: var(--blue);
  font-weight: 900;
}

.ai-apply-button:hover:not(:disabled) {
  background: rgba(20, 111, 222, 0.14);
}

.ai-apply-button:disabled {
  border-color: var(--line);
  background: #f1f5f4;
  color: var(--muted);
  cursor: not-allowed;
}

.ai-insight.pending {
  border-color: rgba(20, 111, 222, 0.2);
  background: rgba(20, 111, 222, 0.05);
}

.ai-insight.pending .ai-insight-badge {
  color: var(--blue);
}

.ai-insight.error {
  border-color: rgba(213, 63, 79, 0.2);
  background: rgba(213, 63, 79, 0.06);
}

.ai-insight.error .ai-insight-badge {
  color: var(--red);
}

.ai-insight.success {
  border-color: rgba(31, 136, 61, 0.18);
  background: rgba(31, 136, 61, 0.05);
}

.ai-insight.success .ai-insight-badge {
  color: #156f32;
}

.ai-insight.muted {
  background: #f8faf9;
}

.settings-tools-slot {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.settings-tools-slot .testnet-actions,
.settings-tools-slot .control-actions {
  margin-top: 0;
}

.settings-risk-slot {
  margin-top: 10px;
}

.settings-risk-slot .guard-panel {
  margin-top: 0;
}

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

.review-stats div {
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  padding: 11px;
}

.review-stats span,
.history-filters span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 7px;
}

.review-stats strong {
  display: block;
  font-size: 22px;
  overflow-wrap: anywhere;
}

.history-filters {
  display: grid;
  grid-template-columns: minmax(150px, 0.9fr) minmax(220px, 1.2fr) minmax(150px, 0.8fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.history-filters label {
  display: grid;
}

.history-filters input,
.history-filters select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 7px 10px;
}

.history-filters input:focus,
.history-filters select:focus {
  outline: 2px solid var(--blue-soft);
  border-color: var(--blue);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1560px;
  background: #fff;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
}

.history-pair-cell {
  display: grid;
  gap: 4px;
}

.history-pair-cell small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

th {
  color: var(--muted);
  background: #f8fbfa;
  font-size: 12px;
  text-transform: uppercase;
}

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

.direction-long {
  color: var(--green);
  font-weight: 800;
}

.direction-short {
  color: var(--red);
  font-weight: 800;
}

.result-pill.open {
  background: var(--blue-soft);
  color: var(--blue);
}

.result-pill.win {
  background: var(--green-soft);
  color: var(--green);
}

.result-pill.loss {
  background: var(--red-soft);
  color: var(--red);
}

.result-pill.lose {
  background: var(--red-soft);
  color: var(--red);
}

.result-pill.flat {
  background: var(--surface-2);
  color: var(--muted);
}

.pnl-positive {
  color: var(--green);
  font-weight: 800;
}

.pnl-negative {
  color: var(--red);
  font-weight: 800;
}

.snapshot-cell {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.snapshot-cell.pending {
  color: var(--muted);
  font-weight: 700;
}

.floating-pnl {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 72px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.floating-pnl.pending,
.pnl-flat {
  color: var(--muted);
}

.live-price {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 96px;
  min-height: 30px;
  border-radius: 8px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  background: #f7faf8;
  color: var(--ink);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.live-price.up {
  border-color: rgba(0, 143, 90, 0.35);
  background: var(--green-soft);
  color: var(--green);
}

.live-price.down {
  border-color: rgba(201, 53, 69, 0.35);
  background: var(--red-soft);
  color: var(--red);
}

.live-price.flat {
  background: var(--blue-soft);
  color: var(--blue);
}

.live-price.settled {
  background: #fff;
  color: var(--muted);
}

.close-button {
  min-height: 30px;
  border: 1px solid var(--red);
  border-radius: 8px;
  background: #fff;
  color: var(--red);
  padding: 4px 10px;
  font-weight: 800;
}

.close-button:hover {
  background: var(--red-soft);
}

.close-button:disabled {
  border-color: var(--line);
  color: var(--muted);
  cursor: default;
}

.empty-row {
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1180px) {
  .terminal-grid {
    grid-template-columns: 1fr;
  }

  .panel {
    min-height: auto;
  }

  .trade-panel {
    position: static;
  }

  .settings-modal-body {
    grid-template-columns: 1fr;
  }

  .account-modal-body {
    grid-template-columns: 1fr;
  }

  .account-hero-card {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .account-api-card {
    grid-column: auto;
    margin-top: 0;
  }

  .news-feed {
    height: 420px;
  }
}

@media (max-width: 720px) {
  body {
    -webkit-text-size-adjust: 100%;
  }

  .app-shell {
    width: min(100vw - 18px, 1500px);
    padding-top: 9px;
  }

  .terminal-grid {
    gap: 10px;
  }

  .focus-panel {
    order: 1;
  }

  .trade-panel {
    order: 2;
  }

  .news-panel {
    order: 3;
  }

  .top-bar,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .status-strip {
    justify-content: flex-start;
  }

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

  .panel,
  .history-panel {
    padding: 12px;
  }

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

  .ghost-button {
    min-height: 38px;
  }

  .market-card,
  .account-feature-grid,
  .account-api-summary,
  .mainnet-summary-row,
  .mainnet-hero,
  .mainnet-metric-grid,
  .trade-form,
  .action-grid,
  .mainnet-lists,
  .risk-settings-form,
  .review-stats,
  .history-filters {
    grid-template-columns: 1fr;
  }

  .risk-toggle,
  .settings-preset-row,
  .risk-mode-hint,
  .settings-save-button {
    grid-column: auto;
  }

  .settings-preset-row {
    grid-template-columns: 1fr;
  }

  .mainnet-metric-card.wide {
    grid-column: auto;
  }

  .mainnet-toggle {
    width: 100%;
  }

  .selected-news {
    max-height: 34vh;
    overflow: auto;
  }

  #selectedText {
    font-size: 16px;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  .news-radar {
    display: none;
  }

  .news-feed {
    height: 280px;
  }

  .kline-chart-wrap {
    min-height: 220px;
  }

  .action-grid {
    position: sticky;
    bottom: 8px;
    z-index: 20;
    grid-template-columns: 1fr 1fr 1fr;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(244, 247, 245, 0.96);
    box-shadow: 0 -10px 24px rgba(20, 33, 31, 0.08);
  }

  .action-button {
    min-height: 58px;
    padding: 10px 6px;
    font-size: 16px;
  }

  .table-wrap {
    max-height: 320px;
  }
}
