:root {
  color-scheme: dark;
  --sidebar-w: clamp(214px, 14.2vw, 244px);
  --right-col: clamp(320px, 23vw, 380px);
  --how-col: clamp(260px, 18vw, 320px);
  --gap: clamp(8px, 0.75vw, 12px);
  --bg: #02070d;
  --panel: rgba(6, 20, 32, 0.86);
  --panel-strong: rgba(8, 27, 43, 0.96);
  --line: rgba(76, 173, 255, 0.18);
  --line-strong: rgba(40, 137, 255, 0.78);
  --blue: #1268ff;
  --cyan: #04c8ff;
  --green: #33d66b;
  --orange: #ffb02e;
  --pink: #c874ff;
  --red: #ff4f69;
  --text: #f5f8ff;
  --muted: #93a4b9;
  --shadow: 0 0 28px rgba(20, 116, 255, 0.24);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  height: 100vh;
  max-height: 100vh;
  width: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 50% 0%, rgba(24, 120, 255, 0.12), transparent 28rem),
    linear-gradient(180deg, #02070d 0%, #04111d 100%);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0;
}

h1,
h2,
h3,
h4,
button,
strong,
th {
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 600;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: var(--gap);
  height: 100vh;
  max-height: 100vh;
  width: 100%;
  padding: var(--gap);
  overflow: hidden;
}

.sidebar {
  position: sticky;
  top: var(--gap);
  height: calc(100vh - (var(--gap) * 2));
  overflow: hidden;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(4, 16, 27, 0.9);
  box-shadow: inset 0 0 26px rgba(20, 173, 255, 0.04);
}

.brand {
  text-align: center;
  padding: 2px 0 clamp(46px, 5.2vh, 66px);
}

.brand img {
  width: clamp(86px, 7.4vw, 116px);
  height: clamp(86px, 7.4vw, 116px);
  object-fit: contain;
  display: block;
  margin: 0 auto 8px;
}

.brand h1 {
  margin: 0;
  font-size: clamp(20px, 1.55vw, 25px);
  line-height: 1.04;
}

.brand p {
  margin: 3px 0 0;
  color: var(--cyan);
  font-weight: 700;
}

.side-block,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.side-block {
  padding: 10px;
  margin-bottom: 9px;
}

.language-spacer {
  height: 4px;
  pointer-events: none;
}

.auth-block {
  margin-top: 18px;
  margin-bottom: 0;
}

.side-title {
  font-size: 13px;
  margin-bottom: 7px;
  color: #d9e5f5;
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid rgba(136, 178, 215, 0.24);
  background: rgba(2, 11, 20, 0.72);
  color: var(--text);
  border-radius: 6px;
  outline: none;
}

.input,
.select {
  height: 36px;
  padding: 0 10px;
}

.textarea {
  min-height: 96px;
  padding: 10px 12px;
  resize: vertical;
}

.signal-test-panel {
  margin-top: 12px;
}

.signal-textarea {
  height: 142px;
  min-height: 142px;
  max-height: 142px;
  resize: none;
  overflow: hidden;
  line-height: 1.28;
}

.field {
  display: grid;
  gap: 5px;
  margin-bottom: 8px;
}

.field label {
  color: var(--muted);
  font-size: 12px;
}

.hint {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
}

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

.check-row {
  display: flex;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  align-items: center;
}

.primary,
.ghost,
.danger {
  height: 38px;
  border-radius: 6px;
  border: 1px solid rgba(74, 158, 255, 0.45);
  color: var(--text);
  background: rgba(9, 33, 54, 0.9);
}

.primary {
  width: 100%;
  background: linear-gradient(180deg, #1268ff, #0850df);
  border-color: rgba(74, 174, 255, 0.85);
  box-shadow: 0 0 18px rgba(18, 104, 255, 0.28);
  font-weight: 700;
}

.danger {
  width: 100%;
  border-color: rgba(255, 79, 105, 0.55);
  background: rgba(84, 18, 32, 0.82);
}

.ghost {
  padding: 0 12px;
}

.save-settings {
  width: 100%;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 36px;
  border: 1px solid rgba(33, 119, 255, 0.52);
  border-radius: 6px;
  background: rgba(6, 54, 115, 0.52);
  color: var(--text);
  text-decoration: none;
}

.link-button.active {
  border-color: var(--line-strong);
  background: rgba(18, 104, 255, 0.72);
  box-shadow: 0 0 14px rgba(18, 104, 255, 0.22);
}

.status-pill {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: var(--radius);
  border: 1px solid rgba(51, 214, 107, 0.18);
  background: rgba(14, 58, 41, 0.33);
}

.api-status-card,
.bitget-affiliate-card {
  min-height: 114px;
  height: 114px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.bitget-affiliate-card {
  padding-top: 12px;
  padding-bottom: 12px;
}

.status-pill.bad {
  border-color: rgba(255, 79, 105, 0.28);
  background: rgba(58, 14, 24, 0.33);
}

.status-pill.pending {
  border-color: rgba(255, 176, 32, 0.32);
  background: rgba(74, 47, 8, 0.30);
}

.status-pill.pending strong {
  color: var(--orange);
}

.status-pill strong {
  color: var(--green);
  font-size: 17px;
}

.status-pill.bad strong {
  color: var(--red);
}

.delete-api {
  margin-top: 8px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--green);
  display: inline-block;
}

.dot.bad {
  background: var(--red);
}

.dot.pending {
  background: var(--orange);
}

.api-result {
  margin-top: 10px;
  padding: 9px 11px;
  border-left: 3px solid var(--orange);
  color: var(--muted);
}

.api-result.valid { border-color: var(--green); color: var(--green); }
.api-result.invalid { border-color: var(--red); color: var(--red); }

.main {
  min-width: 0;
  min-height: 0;
  width: 100%;
  display: grid;
  height: calc(100vh - (var(--gap) * 2));
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  overflow: hidden;
}

.top {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(142px, 180px) minmax(142px, 180px) var(--right-col);
  gap: var(--gap);
  align-items: stretch;
  min-width: 0;
}

.top-title {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 12px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(4, 15, 27, 0.82);
}

.top-title h2 {
  margin: 0;
  font-size: 22px;
}

.top-title p,
.muted {
  margin: 0;
  color: var(--muted);
}

.stat {
  padding: 12px 14px;
  min-height: 82px;
}

.stat span {
  display: block;
  color: var(--muted);
}

.stat strong {
  display: block;
  color: var(--green);
  font-size: clamp(21px, 1.45vw, 25px);
  line-height: 1.1;
}

.stat.locked strong {
  color: var(--orange);
}

.stat.error strong {
  color: var(--red);
}

.content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--right-col);
  gap: var(--gap);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.left-stack {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: var(--gap);
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.panel {
  padding: clamp(10px, 0.8vw, 14px);
  min-width: 0;
}

.panel h3 {
  margin: 0 0 9px;
  font-size: clamp(16px, 1.05vw, 18px);
}

.subtitle {
  color: var(--muted);
  margin: -4px 0 10px;
  font-size: 13px;
}

.channel-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 14px;
  min-width: 0;
}

.channel,
.strategy-card,
.trade-button,
.percent-card,
.badge {
  border: 1px solid rgba(92, 151, 205, 0.22);
  background: rgba(3, 17, 29, 0.78);
  border-radius: var(--radius);
}

.channel,
.strategy-card {
  position: relative;
  text-align: left;
  color: var(--text);
}

.channel {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px;
  min-height: 92px;
  padding: 10px;
  overflow: hidden;
}

.channel-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: var(--cyan);
  font-weight: 800;
  font-size: 17px;
}

.channel h4,
.strategy-card h4 {
  margin: 0 0 5px;
  font-size: clamp(12px, 0.82vw, 14px);
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.channel p,
.strategy-card p,
.status-small {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.channel-risk {
  display: inline-block;
  margin-top: 5px;
  font-size: 10px;
  line-height: 1;
  font-weight: 700;
}

.selected {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
  background: rgba(5, 35, 70, 0.9);
}

.channel.selected::after,
.strategy-card.selected::after {
  content: "OK";
  position: absolute;
  right: 8px;
  top: 8px;
  font-size: 10px;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 4px;
  padding: 2px 4px;
  background: var(--blue);
}

.strategy-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}

.strategy-card {
  min-height: 0;
  height: clamp(94px, 11.4vh, 108px);
  padding: 8px 9px;
  overflow: hidden;
}

.strategy-card h4 {
  padding-right: 78px;
}

.strategy-heading {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 6px;
  align-items: start;
  margin-bottom: 4px;
}

.strategy-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: var(--cyan);
  border: 1px solid rgba(4, 200, 255, 0.34);
  background: rgba(4, 200, 255, 0.08);
  font-size: 10px;
  font-weight: 700;
}

.kv {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 6px;
  font-size: clamp(9.6px, 0.66vw, 11.2px);
  line-height: 1.1;
}

.kv span:nth-child(odd) {
  color: var(--muted);
}

.risk-low {
  color: var(--green);
}

.risk-mid {
  color: var(--orange);
}

.risk-high {
  color: var(--red);
}

.gain {
  color: var(--cyan);
}

.gain-high {
  color: var(--pink);
}

.recommended {
  position: absolute;
  top: 6px;
  right: 34px;
  color: #bfe5ff;
  font-size: 10px;
  background: rgba(18, 104, 255, 0.9);
  border: 1px solid rgba(125, 197, 255, 0.7);
  border-radius: 4px;
  padding: 2px 6px;
  line-height: 1;
  max-width: calc(100% - 44px);
  white-space: nowrap;
}

.right-stack {
  display: grid;
  gap: var(--gap);
  align-content: start;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

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

.trade-button,
.percent-card {
  height: 40px;
  color: var(--text);
}

.percent-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 7px;
}

.percent-card {
  display: grid;
  place-items: center;
  text-align: center;
  font-size: 13px;
  padding: 5px;
}

.percent-card strong {
  display: block;
  font-size: 14px;
}

.percent-card:disabled {
  opacity: 0.38;
  box-shadow: none;
}

.cap-line {
  margin-top: 8px;
  font-size: 12px;
}

.amount-validation {
  margin: 7px 0 0;
  font-size: 12px;
  font-weight: 700;
}

.amount-validation.valid {
  color: var(--green);
}

.amount-validation.invalid {
  color: var(--orange);
}

.api-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ready-badges {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.badge {
  height: 34px;
  min-width: 0;
  color: var(--muted);
  display: grid;
  place-items: center;
  text-align: center;
  font-size: clamp(8.6px, 0.62vw, 10.2px);
  padding: 3px;
  overflow-wrap: normal;
  word-break: normal;
  white-space: normal;
  line-height: 1.05;
  overflow: hidden;
}

.trades-badge {
  white-space: nowrap;
  font-size: clamp(8.4px, 0.58vw, 9.8px);
}

.badge.ok {
  color: #dcffe8;
  border-color: rgba(51, 214, 107, 0.7);
  background: rgba(17, 93, 48, 0.76);
}

.start {
  height: 50px;
  font-size: clamp(16px, 1.05vw, 19px);
  background: linear-gradient(180deg, #31d66d, #149447);
  border-color: rgba(111, 255, 161, 0.85);
  box-shadow: 0 0 22px rgba(51, 214, 107, 0.28);
}

.info-box {
  min-height: 48px;
  display: grid;
  place-items: center;
  text-align: center;
  color: #d9e5f5;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(3, 17, 29, 0.7);
  padding: 10px;
  font-size: 13px;
}

.mini-info {
  min-height: 36px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.25;
}

.start-infos {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.bottom-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  margin-top: var(--gap);
}

.left-stack,
.dashboard-panel,
.strategy-table-panel,
.how-card {
  min-height: 0;
  overflow: hidden;
}

.dashboard-content {
  grid-template-columns: minmax(0, 1fr) var(--right-col);
  grid-template-rows: minmax(0, 1fr);
}

.bottom-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--how-col);
  gap: var(--gap);
  align-items: stretch;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.right-start-column {
  display: grid;
  gap: var(--gap);
  align-content: start;
  min-width: 0;
  min-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
}

.strategy-table-panel {
  height: 100%;
  align-self: stretch;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.how-card {
  height: 100%;
  align-self: stretch;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.table-wrap {
  overflow-x: hidden;
  min-height: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: clamp(11.2px, 0.78vw, 13px);
  table-layout: fixed;
  height: 100%;
}

th,
td {
  border: 1px solid rgba(92, 151, 205, 0.18);
  padding: 5px 7px;
  text-align: center;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

th {
  color: #d9e5f5;
  font-weight: 600;
  background: rgba(3, 17, 29, 0.6);
}

td:nth-child(2),
th:nth-child(2) {
  text-align: left;
}

tr.active-row {
  background: rgba(18, 104, 255, 0.28);
  outline: 1px solid rgba(18, 104, 255, 0.62);
}

.steps {
  display: grid;
  gap: 8px;
  margin-top: 5px;
  align-content: start;
  min-height: 0;
}

.step {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.12;
  padding: 6px;
  border: 1px solid rgba(76, 173, 255, 0.13);
  border-radius: 6px;
  background: rgba(3, 17, 29, 0.45);
}

.step span {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--blue);
  box-shadow: 0 0 10px rgba(18, 104, 255, 0.42);
  font-size: 11px;
}

.step p {
  margin: 0;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 9px;
}

.small-link {
  border: 0;
  background: transparent;
  color: var(--cyan);
  padding: 0;
  font-size: 12px;
}

.warning {
  color: #d9e5f5;
  font-size: 12px;
  line-height: 1.45;
  border-left: 2px solid var(--orange);
  padding-left: 10px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.72);
  padding: 20px;
}

.modal {
  width: min(560px, 100%);
  border: 1px solid rgba(51, 214, 107, 0.45);
  border-radius: var(--radius);
  background: #061422;
  padding: 20px;
  box-shadow: 0 0 44px rgba(51, 214, 107, 0.18);
}

.modal h3 {
  margin: 0 0 10px;
}

.log-list {
  display: grid;
  gap: 7px;
  overflow: hidden;
}

.signal-card {
  min-height: clamp(150px, 22vh, 220px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.log-item {
  border: 1px solid rgba(92, 151, 205, 0.16);
  border-radius: 6px;
  padding: 8px;
  color: var(--muted);
  font-size: 12px;
}

.log-item strong {
  color: var(--text);
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 20;
  border: 1px solid var(--line-strong);
  background: #061b2e;
  border-radius: var(--radius);
  padding: 12px 14px;
  color: var(--text);
  box-shadow: var(--shadow);
}

@media (max-width: 1180px) {
  html,
  body,
  #app {
    height: auto;
    max-height: none;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .top {
    grid-template-columns: minmax(240px, 1fr) repeat(3, minmax(130px, 1fr));
  }

  .shell,
  .main,
  .content,
  .left-stack,
  .right-stack,
  .bottom-layout,
  .right-start-column,
  .dashboard-panel,
  .strategy-table-panel,
  .how-card {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .shell {
    min-height: 100vh;
  }

  .main,
  .left-stack {
    grid-template-rows: auto;
  }

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

  .bottom-layout {
    grid-template-columns: minmax(0, 1fr) var(--how-col);
  }

  .right-start-column {
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
  }

  .right-stack {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
  }

  .right-stack > .panel:last-child {
    grid-column: 1 / -1;
  }

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

  table {
    min-width: 820px;
    height: auto;
  }
}

@media (max-width: 980px) {
  .shell,
  .top,
  .bottom-layout,
  .right-start-column {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    overflow: visible;
  }

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

@media (min-width: 1500px) {
  .button-grid,
  .percent-grid {
    grid-template-columns: repeat(6, 1fr);
  }

  .ready-badges {
    grid-template-columns: repeat(5, 1fr);
  }
}

@media (max-height: 940px) and (min-width: 1181px) {
  :root {
    --gap: 8px;
    --sidebar-w: 214px;
    --right-col: 320px;
  }

  .sidebar {
    padding: 8px;
  }

  .brand {
    padding-bottom: 12px;
  }

  .brand img {
    width: 68px;
    height: 68px;
    margin-bottom: 4px;
  }

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

  .brand p,
  .muted,
  .warning {
    font-size: 11px;
  }

  .side-block {
    padding: 7px;
    margin-bottom: 6px;
  }

  .language-spacer {
    height: 3px;
  }

  .input,
  .select,
  .primary,
  .ghost,
  .danger,
  .link-button {
    height: 31px;
  }

  .field {
    gap: 3px;
    margin-bottom: 4px;
  }

  #auth-form + .row {
    margin-top: 5px !important;
  }

  .check-row,
  .small-link {
    font-size: 10px;
  }

  .side-block > div[style*="height:8px"] {
    height: 5px !important;
  }

  .status-pill {
    padding: 6px;
    gap: 2px;
    font-size: 11px;
  }

  .api-status-card,
  .bitget-affiliate-card {
    min-height: 92px;
    height: 92px;
  }

  .status-pill strong {
    font-size: 14px;
  }

  .side-block h2 {
    margin: 3px 0 !important;
    font-size: 19px;
  }

  .signal-test-panel {
    margin-top: 8px;
  }

  .signal-textarea {
    height: 112px;
    min-height: 112px;
    max-height: 112px;
  }

  .side-block p {
    margin-top: 2px;
    margin-bottom: 5px;
  }

  .top-title,
  .stat {
    min-height: 66px;
    padding: 9px 12px;
  }

  .stat strong {
    font-size: 19px;
  }

  .panel {
    padding: 8px;
  }

  .panel h3 {
    margin-bottom: 6px;
    font-size: 15px;
  }

  .subtitle {
    margin-bottom: 7px;
    font-size: 11px;
  }

  .channel-grid {
    gap: 6px;
    margin-bottom: 9px;
  }

  .channel {
    min-height: 78px;
    padding: 7px;
    grid-template-columns: 26px minmax(0, 1fr);
  }

  .channel-icon,
  .strategy-icon {
    width: 23px;
    height: 23px;
    font-size: 9px;
  }

  .channel h4,
  .strategy-card h4 {
    font-size: 11px;
    margin-bottom: 2px;
  }

  .channel p,
  .strategy-card p,
  .status-small {
    font-size: 10px;
  }

  .channel-risk {
    margin-top: 3px;
    font-size: 8.8px;
  }

  .strategy-grid {
    gap: 6px;
  }

  .strategy-card {
    height: 90px;
    padding: 6px 7px;
  }

  .strategy-heading {
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 5px;
    margin-bottom: 3px;
  }

  .kv {
    font-size: 9.5px;
    gap: 2px 5px;
  }

  .recommended {
    top: 5px;
    right: 30px;
    font-size: 9px;
    padding: 1px 4px;
  }

  .button-grid,
  .percent-grid,
  .ready-badges {
    gap: 5px;
  }

  .trade-button,
  .percent-card {
    height: 31px;
  }

  .badge {
    height: 30px;
    font-size: 8.4px;
  }

  .start {
    height: 41px;
  }

  .start-infos {
    margin-top: 8px;
    gap: 6px;
  }

  .info-box {
    min-height: 38px;
    padding: 7px;
    font-size: 11px;
  }

  .steps {
    gap: 5px;
  }

  .step {
    grid-template-columns: 20px minmax(0, 1fr);
    gap: 6px;
    font-size: 10.5px;
  }

  .step span {
    width: 18px;
    height: 18px;
    font-size: 10px;
  }

  table {
    font-size: 9.4px;
  }

  th,
  td {
    padding: 3px 4px;
  }
}

@media (max-width: 720px) {
  :root {
    --gap: 10px;
  }

  .shell {
    display: flex;
    flex-direction: column;
    padding: 10px;
  }

  .main {
    order: 2;
  }

  .sidebar {
    order: 1;
    margin-bottom: 10px;
    padding: 10px;
  }

  .brand {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    text-align: left;
    padding: 0 0 10px;
  }

  .brand img {
    width: 58px;
    height: 58px;
    margin: 0;
  }

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

  .brand p {
    font-size: 12px;
  }

  .side-block {
    margin-bottom: 8px;
  }

  .sidebar .link-button {
    height: 40px;
  }

  .top {
    gap: 8px;
  }

  .top-title,
  .stat {
    min-height: auto;
    padding: 11px 12px;
  }

  .top-title h2 {
    font-size: 21px;
  }

  .content {
    display: flex;
    flex-direction: column;
  }

  .dashboard-content .left-stack {
    display: contents;
  }

  .dashboard-content .dashboard-panel {
    order: 1;
  }

  .dashboard-content .right-start-column {
    order: 2;
  }

  .dashboard-content .bottom-layout {
    order: 3;
  }

  .left-stack,
  .right-stack,
  .bottom-layout,
  .right-start-column {
    display: grid;
    gap: 10px;
  }

  .right-stack {
    grid-template-columns: 1fr;
  }

  .language-spacer {
    height: 3px;
  }

  .button-grid,
  .percent-grid,
  .ready-badges,
  .api-grid {
    grid-template-columns: 1fr 1fr;
  }

  .channel-grid,
  .strategy-grid {
    grid-template-columns: 1fr;
  }

  .channel,
  .strategy-card {
    min-height: auto;
  }

  .strategy-card {
    height: auto;
  }

  .strategy-card h4 {
    padding-right: 72px;
  }

  .ready-badges {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .badge {
    height: 38px;
    font-size: 10px;
  }

  .start {
    height: 48px;
  }

  .panel {
    padding: 11px;
  }

  .strategy-table-panel {
    max-width: 100%;
  }

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

  table {
    min-width: 760px;
  }
}

@media (max-width: 430px) {
  .shell {
    padding: 8px;
  }

  .panel h3 {
    font-size: 17px;
  }

  .button-grid,
  .percent-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

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

  .strategy-card h4 {
    padding-right: 58px;
  }

  .recommended {
    right: 30px;
    max-width: 92px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .toast {
    left: 8px;
    right: 8px;
    bottom: 8px;
  }
}

/* =========================================================
   RESPONSIVE FIX — AutoTrade Terminal
   ========================================================= */

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden !important;
}

* {
  box-sizing: border-box;
}

img,
svg,
canvas,
table {
  max-width: 100%;
}

/* Prevent hidden horizontal overflow from cards/buttons */
.card,
.panel,
.info-box,
.strategy-card,
.discord-card,
.start-column,
.start-panel,
.main,
.dashboard,
.container,
.terminal,
.content,
.app {
  max-width: 100%;
}

/* Main desktop layout protection */
.dashboard,
.terminal-layout,
.main-layout,
.app-layout,
.content-layout {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

/* Scroll only inside large tables, not the full page */
.strategy-table,
.table-wrap,
.table-container {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: auto;
}

/* Buttons/cards must shrink correctly */
button,
.card,
.strategy-card,
.discord-card,
.info-box,
input,
select {
  min-width: 0;
}

/* Remove ugly horizontal scrollbar */
body::-webkit-scrollbar:horizontal,
html::-webkit-scrollbar:horizontal {
  display: none;
}

/* Large desktop */
@media (min-width: 1201px) {
  .dashboard,
  .terminal-layout,
  .main-layout,
  .app-layout,
  .content-layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr) 330px;
    gap: 10px;
    align-items: stretch;
  }

  .start-column,
  .right-column,
  .right-panel {
    width: 330px;
    max-width: 330px;
    min-width: 300px;
  }
}

/* Tablet */
@media (max-width: 1200px) {
  body {
    overflow-y: auto !important;
  }

  .dashboard,
  .terminal-layout,
  .main-layout,
  .app-layout,
  .content-layout {
    display: grid !important;
    grid-template-columns: 220px minmax(0, 1fr) !important;
    gap: 10px !important;
  }

  .start-column,
  .right-column,
  .right-panel {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    max-width: 100% !important;
    position: relative !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  .strategy-grid,
  .strategies-grid,
  .discord-grid,
  .channels-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

/* Mobile */
@media (max-width: 768px) {
  html,
  body {
    height: auto !important;
    min-height: 100%;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  .dashboard,
  .terminal-layout,
  .main-layout,
  .app-layout,
  .content-layout {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    gap: 10px !important;
    padding: 8px !important;
  }

  .sidebar,
  .left-sidebar,
  .main,
  .main-panel,
  .center-panel,
  .start-column,
  .right-column,
  .right-panel,
  .bottom-panel,
  .strategy-table,
  .how-it-works {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    position: relative !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  .card,
  .panel,
  .info-box,
  .strategy-card,
  .discord-card {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: auto !important;
    margin: 0 0 10px 0 !important;
  }

  .strategy-grid,
  .strategies-grid,
  .discord-grid,
  .channels-grid,
  .cards-grid,
  .top-grid,
  .bottom-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    width: 100% !important;
  }

  .strategy-table,
  .table-wrap,
  .table-container {
    overflow-x: auto !important;
    overflow-y: auto !important;
    max-height: 420px !important;
  }

  table {
    min-width: 720px;
  }

  .start-column,
  .right-column,
  .right-panel {
    order: 99 !important;
  }

  .language-spacer {
    height: 4px !important;
    min-height: 4px !important;
    pointer-events: none !important;
  }

  h1 {
    font-size: 20px !important;
    line-height: 1.15 !important;
  }

  h2,
  h3 {
    font-size: 16px !important;
  }

  button,
  input,
  select {
    width: 100%;
    max-width: 100%;
  }
}

/* Very small phones */
@media (max-width: 420px) {
  .dashboard,
  .terminal-layout,
  .main-layout,
  .app-layout,
  .content-layout {
    padding: 6px !important;
    gap: 8px !important;
  }

  .card,
  .panel,
  .info-box,
  .strategy-card,
  .discord-card {
    padding: 10px !important;
    border-radius: 12px !important;
  }

  table {
    min-width: 680px;
  }
}

/* =========================================================
   HARD RESPONSIVE FIX — REAL AUTOTRADE LAYOUT
   Fix overlap / mobile stacking / horizontal scroll
   ========================================================= */

html,
body,
#app {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden !important;
}

.shell,
.main,
.top,
.content,
.left-stack,
.right-stack,
.bottom-layout,
.right-start-column,
.sidebar,
.panel,
.side-block,
.channel,
.strategy-card,
.strategy-table-panel,
.how-card {
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

/* Desktop safety */
@media (min-width: 1181px) {
  .shell {
    grid-template-columns: minmax(200px, var(--sidebar-w)) minmax(0, 1fr) !important;
  }

  .main {
    overflow: hidden !important;
  }

  .top {
    grid-template-columns:
      minmax(260px, 1fr)
      minmax(130px, 170px)
      minmax(130px, 170px)
      minmax(300px, var(--right-col)) !important;
  }

  .content {
    grid-template-columns: minmax(0, 1fr) minmax(300px, var(--right-col)) !important;
  }

  .right-stack,
  .right-start-column {
    overflow-x: hidden !important;
  }

  .percent-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  .button-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

/* Tablet: everything becomes usable, no overlap */
@media (max-width: 1180px) {
  html,
  body,
  #app {
    height: auto !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  .shell {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 10px !important;
  }

  .sidebar {
    position: relative !important;
    top: auto !important;
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  .brand {
    grid-column: 1 / -1 !important;
    padding-bottom: 10px !important;
  }

  .main {
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .top {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    width: 100% !important;
    gap: 10px !important;
  }

  .top-title {
    grid-column: 1 / -1 !important;
  }

  .content,
  .left-stack,
  .bottom-layout,
  .right-start-column,
  .right-stack {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    gap: 10px !important;
  }

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

  .channel,
  .strategy-card {
    height: auto !important;
    min-height: 96px !important;
    overflow: visible !important;
  }

  .strategy-card h4 {
    padding-right: 0 !important;
  }

  .recommended {
    position: relative !important;
    top: auto !important;
    right: auto !important;
    display: inline-block !important;
    margin: 4px 0 !important;
  }

  .button-grid,
  .percent-grid,
  .ready-badges,
  .api-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .table-wrap {
    width: 100% !important;
    overflow-x: auto !important;
    overflow-y: auto !important;
    max-height: 420px !important;
  }

  table {
    min-width: 780px !important;
    height: auto !important;
  }
}

/* Mobile: one clean column */
@media (max-width: 760px) {
  .shell {
    padding: 8px !important;
    gap: 10px !important;
  }

  .sidebar {
    display: flex !important;
    flex-direction: column !important;
    padding: 10px !important;
  }

  .brand img {
    width: 72px !important;
    height: 72px !important;
  }

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

  .top {
    display: flex !important;
    flex-direction: column !important;
  }

  .top-title,
  .stat,
  .panel,
  .side-block,
  .dashboard-panel,
  .strategy-table-panel,
  .how-card,
  .right-start-column {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: auto !important;
    overflow: visible !important;
  }

  .channel-grid,
  .strategy-grid,
  .button-grid,
  .percent-grid,
  .ready-badges,
  .api-grid {
    grid-template-columns: 1fr !important;
  }

  .channel {
    grid-template-columns: 36px minmax(0, 1fr) !important;
  }

  .strategy-card {
    min-height: auto !important;
    padding: 12px !important;
  }

  .kv {
    font-size: 12px !important;
  }

  .percent-card,
  .trade-button,
  .badge {
    height: auto !important;
    min-height: 42px !important;
    font-size: 13px !important;
  }

  .start {
    height: 48px !important;
    font-size: 17px !important;
  }

  .start-infos {
    display: grid !important;
    grid-template-columns: 1fr !important;
  }

  .bottom-grid {
    display: flex !important;
    flex-direction: column !important;
  }

  .bottom-layout {
    display: flex !important;
    flex-direction: column !important;
  }

  .table-wrap {
    max-height: 360px !important;
    overflow-x: auto !important;
  }

  table {
    min-width: 720px !important;
    font-size: 12px !important;
  }

  th,
  td {
    padding: 7px 6px !important;
  }
}

/* Small mobile */
@media (max-width: 430px) {
  .shell {
    padding: 6px !important;
  }

  .panel,
  .side-block {
    padding: 10px !important;
  }

  .top-title h2 {
    font-size: 20px !important;
  }

  .channel h4,
  .strategy-card h4 {
    font-size: 14px !important;
  }

  .channel p,
  .strategy-card p,
  .status-small {
    font-size: 12px !important;
  }
}

/* =========================================================
   DESKTOP COMPACT FIX — strategy table + right info boxes
   Mobile untouched
   ========================================================= */

@media (min-width: 1181px) {

  /* Strategy table: smaller font, smaller rows, less vertical scroll */
  .strategy-table-panel {
    overflow: hidden !important;
  }

  .strategy-table-panel h3,
  .strategy-table-panel h2 {
    font-size: 15px !important;
    margin-bottom: 6px !important;
  }

  .table-wrap {
    max-height: 300px !important;
    overflow-y: hidden !important;
    overflow-x: hidden !important;
  }

  .strategy-table-panel table {
    width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed !important;
    font-size: 10px !important;
  }

  .strategy-table-panel th,
  .strategy-table-panel td {
    padding: 4px 5px !important;
    line-height: 1.05 !important;
    font-size: 10px !important;
    white-space: normal !important;
  }

  .strategy-table-panel th {
    font-size: 9.5px !important;
  }

  /* Slightly narrower columns where possible */
  .strategy-table-panel th:first-child,
  .strategy-table-panel td:first-child {
    width: 34px !important;
  }

  .strategy-table-panel th:nth-child(2),
  .strategy-table-panel td:nth-child(2) {
    width: 92px !important;
  }

  .strategy-table-panel th:nth-child(3),
  .strategy-table-panel td:nth-child(3) {
    width: 62px !important;
  }

  .strategy-table-panel th:nth-child(4),
  .strategy-table-panel td:nth-child(4) {
    width: 78px !important;
  }

  .strategy-table-panel th:nth-child(5),
  .strategy-table-panel td:nth-child(5) {
    width: 92px !important;
  }

  /* Bottom-right How it works: smaller boxes */
  .how-card,
  .how-panel,
  .how-it-works {
    overflow: hidden !important;
  }

  .how-card h3,
  .how-card h2,
  .how-panel h3,
  .how-panel h2,
  .how-it-works h3,
  .how-it-works h2 {
    font-size: 15px !important;
    margin-bottom: 7px !important;
  }

  .how-card p,
  .how-panel p,
  .how-it-works p,
  .step,
  .step-row,
  .how-step {
    font-size: 11px !important;
    line-height: 1.15 !important;
  }

  .step,
  .step-row,
  .how-step,
  .info-box,
  .mini-info,
  .start-infos .info-box {
    min-height: 0 !important;
    height: auto !important;
    padding: 6px 8px !important;
    margin-bottom: 5px !important;
    font-size: 11px !important;
    line-height: 1.15 !important;
  }

  .step-number,
  .step-badge,
  .number-badge {
    width: 22px !important;
    height: 22px !important;
    min-width: 22px !important;
    font-size: 11px !important;
  }

  /* Right column: reduce inner spacing */
  .right-start-column,
  .right-stack,
  .right-panel {
    gap: 6px !important;
  }

  .right-start-column .panel,
  .right-stack .panel,
  .right-panel .panel,
  .right-start-column .side-block,
  .right-stack .side-block,
  .right-panel .side-block {
    padding: 9px !important;
  }

  .right-start-column h3,
  .right-start-column h2,
  .right-stack h3,
  .right-stack h2,
  .right-panel h3,
  .right-panel h2 {
    font-size: 15px !important;
    margin-bottom: 7px !important;
  }

  .right-start-column p,
  .right-stack p,
  .right-panel p {
    font-size: 11px !important;
    line-height: 1.15 !important;
  }
}

/* Slightly taller Ready to Start badges */
.ready-badges .badge,
.ready-badges button,
.ready-badge,
.badge {
  min-height: 34px !important;
  padding-top: 7px !important;
  padding-bottom: 7px !important;
  line-height: 1.15 !important;
}

.warning-panel {
  border-color: rgba(245, 158, 11, .35) !important;
}

.strategy-single {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid rgba(148, 163, 184, .18);
  border-radius: 8px;
  background: rgba(15, 23, 42, .42);
}

.strategy-single p,
.evolution-rules p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.strategy-sketch {
  display: grid;
  grid-template-columns: repeat(8, minmax(92px, 1fr));
  gap: 8px;
  margin-top: 16px;
  overflow: hidden;
}

.sketch-node {
  min-height: 76px;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, .22);
  background: rgba(2, 6, 23, .48);
}

.sketch-node strong {
  display: block;
  color: var(--accent);
  font-size: 13px;
}

.sketch-node span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.sketch-node.sl {
  border-color: rgba(239, 68, 68, .45);
}

.sketch-node.tp1,
.sketch-node.tp2,
.sketch-node.tp3,
.sketch-node.tp4,
.sketch-node.tp5,
.sketch-node.tp6 {
  border-color: rgba(34, 197, 94, .32);
}

.financial-kv {
  margin-top: 14px;
}

.invalid-list {
  margin-top: 10px;
  display: grid;
  gap: 6px;
}

.invalid-list p {
  margin: 0;
  color: #fca5a5;
  font-size: 12px;
  line-height: 1.35;
}

.account-confirm-row {
  margin-top: 12px;
  align-items: flex-start;
}

.evolution-rules {
  display: grid;
  gap: 8px;
}

@media (max-width: 1100px) {
  .strategy-sketch {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 640px) {
  .strategy-sketch {
    grid-template-columns: 1fr !important;
  }

  .sketch-node {
    min-height: auto;
  }
}
