/* ============================================================
   trade.css — Binance-style mobile trading UI
   All classes referenced in index.html tpl-trade/auth/settings
   ============================================================ */


/* ── Trade layout shell ───────────────────────────────────── */
.trade-layout {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}


/* ── Header ───────────────────────────────────────────────── */
.trade-header {
  position: sticky;
  top: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  height: 48px;
  padding: 0 6px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  gap: 2px;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
}

.header-symbol {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.header-symbol:hover { background: var(--bg-hover); }

.symbol-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

.symbol-base {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 14px;
}

.header-tag {
  font-size: 10px;
  padding: 1px 5px;
  background: var(--bg-hover);
  color: var(--text-muted);
  border-radius: 2px;
  white-space: nowrap;
  border: 1px solid var(--border);
}

.header-price {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 0 6px;
  min-width: 0;
}

#hdr-price {
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-mono);
  line-height: 1.2;
  color: var(--buy);
}

#hdr-change {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}
.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}


/* ── Price stats strip ────────────────────────────────────── */
.price-stats {
  display: flex;
  align-items: center;
  padding: 0 10px;
  gap: 0;
  height: 36px;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.price-stats::-webkit-scrollbar { display: none; }

.stat {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 10px;
  flex-shrink: 0;
  min-width: 60px;
}
.stat:first-child { padding-left: 0; }

.stat-lbl {
  font-size: 9px;
  color: var(--text-muted);
  white-space: nowrap;
  line-height: 1.3;
}

.stat-val {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  white-space: nowrap;
  line-height: 1.3;
}


/* ── Chart + order book row ───────────────────────────────── */
.chart-book-row {
  display: flex;
  height: 248px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

/* Chart side */
.chart-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-right: 1px solid var(--border);
  overflow: hidden;
}

.tf-bar {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 6px;
  height: 30px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}
.tf-bar::-webkit-scrollbar { display: none; }

.tf-btn {
  padding: 3px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.tf-btn:hover { color: var(--text-secondary); }
.tf-btn.active {
  background: var(--bg-hover);
  color: var(--text-primary);
  font-weight: 600;
}

.chart-container {
  flex: 1;
  min-height: 0;
  background: var(--bg-primary);
  position: relative;
  overflow: hidden;
}

/* Order book side */
.book-area {
  width: 134px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  overflow: hidden;
}

.book-tabs {
  display: flex;
  height: 30px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.book-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.book-tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
}

.order-book {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.ob-asks {
  flex: 1;
  display: flex;
  flex-direction: column-reverse;
  overflow: hidden;
}

.ob-bids {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Mid-price / spread row */
.ob-mid {
  text-align: right;
  padding: 3px 8px;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-mono);
  background: var(--bg-primary);
  border-block: 1px solid var(--border);
  flex-shrink: 0;
  line-height: 1.4;
  color: var(--buy);
  cursor: pointer;
}

/* OB rows rendered by JS */
.ob-row {
  display: flex;
  justify-content: space-between;
  padding: 1px 8px;
  font-size: 10px;
  font-family: var(--font-mono);
  cursor: pointer;
  position: relative;
  user-select: none;
}

.ob-row .ob-price { font-weight: 600; }
.ob-row .ob-size  { color: var(--text-muted); }

/* JS renders class="ob-row ask/bid" and class="ob-price ask/bid" */
.ob-row.ask .ob-price,
.ob-price.ask { color: var(--sell); }

.ob-row.bid .ob-price,
.ob-price.bid { color: var(--buy); }

/* Depth fill bar — JS injects <div class="ob-bar ask/bid" style="width:N%"> */
.ob-bar {
  position: absolute;
  top: 0; bottom: 0; right: 0;
  opacity: 0.12;
  pointer-events: none;
}
.ob-bar.ask { background: var(--sell); }
.ob-bar.bid { background: var(--buy); }

/* Mid price direction flash */
.ob-mid.green { color: var(--buy); }
.ob-mid.red   { color: var(--sell); }

/* Recent trades panel */
.recent-trades {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* JS renders class="trade-row" / "trade-price green|red" / "trade-size" / "trade-time" */
.trade-row {
  display: flex;
  justify-content: space-between;
  padding: 2px 8px;
  font-size: 10px;
  font-family: var(--font-mono);
}
.trade-price { font-weight: 600; }
.trade-price.green { color: var(--buy); }
.trade-price.red   { color: var(--sell); }
.trade-size,
.trade-time { color: var(--text-muted); }


/* ── Order form ───────────────────────────────────────────── */
.order-form-section {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

/* Buy / Sell tab row */
.order-side-tabs {
  display: flex;
  height: 42px;
  border-bottom: 1px solid var(--border);
}

.side-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  color: var(--text-muted);
}
.side-tab.buy.active  { color: var(--buy);  border-bottom-color: var(--buy);  background: var(--buy-bg); }
.side-tab.sell.active { color: var(--sell); border-bottom-color: var(--sell); background: var(--sell-bg); }

.order-form-body {
  padding: 8px 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Order type pills */
.order-type-select {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.order-type-select::-webkit-scrollbar { display: none; }

.ot-btn {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  border: 1px solid var(--border);
  transition: all var(--transition);
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.ot-btn:hover { color: var(--text-secondary); background: var(--bg-hover); }
.ot-btn.active {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-light);
}

/* Available balance */
.order-avail {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  font-size: 11px;
  align-items: center;
}

.avail-lbl { color: var(--text-muted); }
.avail-val { color: var(--text-secondary); font-family: var(--font-mono); }

/* Input field rows */
.order-field {
  display: flex;
  flex-direction: column;
}

.field-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  height: 40px;
  transition: border-color var(--transition);
  overflow: hidden;
}
.field-wrap:focus-within { border-color: var(--accent); }

.field-label {
  font-size: 11px;
  color: var(--text-muted);
  padding: 0 8px;
  white-space: nowrap;
  flex-shrink: 0;
  height: 100%;
  display: flex;
  align-items: center;
  border-right: 1px solid var(--border);
}

.field-wrap input[type="number"] {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 6px;
  background: transparent;
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-mono);
  border: none;
  outline: none;
}
.field-wrap input[type="number"]::placeholder { color: var(--text-muted); }
.field-wrap input[type="number"]::-webkit-outer-spin-button,
.field-wrap input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; }

.field-unit {
  font-size: 11px;
  color: var(--text-muted);
  padding: 0 8px;
  white-space: nowrap;
  flex-shrink: 0;
  height: 100%;
  display: flex;
  align-items: center;
  border-left: 1px solid var(--border);
}

.field-tag {
  font-size: 10px;
  color: var(--accent);
  padding: 2px 8px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.field-tag:hover { opacity: 0.8; }

/* CRCL / USDC toggle inside amount field */
.field-unit-toggle {
  display: flex;
  height: 100%;
  border-left: 1px solid var(--border);
  flex-shrink: 0;
}

.sz-mode {
  padding: 0 7px;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.sz-mode:first-child { border-right: 1px solid var(--border); }
.sz-mode.active {
  color: var(--text-primary);
  background: var(--bg-hover);
}


/* ── Percentage slider / dot track ────────────────────────── */
.pct-slider-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 2px 0;
}

.pct-track-row {
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 2px;
}

.pct-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 2px;
  border-radius: 99px;
  background: var(--border-light);
  cursor: pointer;
  outline: none;
}
.pct-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-card);
  box-shadow: 0 0 0 1px var(--accent);
  cursor: pointer;
}
.pct-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-card);
  cursor: pointer;
  border: none;
}

.pct-dot {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border-light);
  border: 1px solid var(--bg-card);
  pointer-events: none;
}
.pct-dot[data-pct="0"]   { left: 2px; }
.pct-dot[data-pct="100"] { right: 2px; }

.pct-marks {
  display: flex;
  justify-content: space-between;
}

.pct-mark {
  font-size: 10px;
  color: var(--text-muted);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.pct-mark:hover { color: var(--text-secondary); }


/* ── Order submit button ──────────────────────────────────── */
.btn-submit {
  width: 100%;
  height: 44px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition), opacity var(--transition);
  border: none;
  color: #fff;
  margin-top: 2px;
  -webkit-tap-highlight-color: transparent;
}
.btn-submit:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-submit.btn-buy  { background: var(--buy); }
.btn-submit.btn-buy:hover:not(:disabled)  { background: var(--buy-hover); }

.btn-submit.btn-sell { background: var(--sell); }
.btn-submit.btn-sell:hover:not(:disabled) { background: var(--sell-hover); }


/* ── Bottom panel: positions / orders / history ───────────── */
.bottom-panel {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  min-height: 200px;
}

.bottom-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  height: 40px;
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.bottom-tabs::-webkit-scrollbar { display: none; }

.bottom-tab {
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color var(--transition), border-color var(--transition);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.bottom-tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
}
.bottom-tab:hover:not(.active) { color: var(--text-secondary); }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 14px;
  padding: 0 4px;
  font-size: 9px;
  font-weight: 700;
  background: var(--accent);
  color: var(--text-inverse);
  border-radius: 99px;
  line-height: 1;
}
.badge:empty { display: none; }

.bottom-content {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
}

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 80px;
  font-size: 12px;
  color: var(--text-muted);
}


/* ── Position card ────────────────────────────────────────── */
.position-card {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.pos-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.pos-symbol {
  font-size: 13px;
  font-weight: 700;
}

.pos-side-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 2px;
}
.pos-side-badge.long,
.pos-side-badge.green { background: var(--buy-bg);  color: var(--buy); }
.pos-side-badge.short,
.pos-side-badge.red   { background: var(--sell-bg); color: var(--sell); }

/* Generic green/red color utilities used by JS */
.green { color: var(--buy); }
.red   { color: var(--sell); }

.pos-leverage {
  font-size: 10px;
  color: var(--text-muted);
  background: var(--bg-hover);
  padding: 1px 5px;
  border-radius: 2px;
  border: 1px solid var(--border);
}

.pos-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}

.pos-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pos-stat .label {
  font-size: 9px;
  color: var(--text-muted);
  white-space: nowrap;
}

.pos-stat .val {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.pos-actions {
  display: flex;
  gap: 6px;
}

/* Action buttons */
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.btn-outline:hover {
  border-color: var(--border-light);
  color: var(--text-primary);
  background: var(--bg-hover);
}

.btn-small {
  height: 28px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 500;
}

.btn-close-pos {
  background: transparent;
  border: 1px solid var(--sell);
  color: var(--sell);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.btn-close-pos:hover { background: var(--sell-bg); }


/* ── Open orders section ──────────────────────────────────── */
.orders-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

.btn-text-danger {
  font-size: 11px;
  color: var(--sell);
  cursor: pointer;
  background: transparent;
  border: none;
  padding: 2px 0;
  -webkit-tap-highlight-color: transparent;
}
.btn-text-danger:hover { opacity: 0.8; }

.orders-list,
.fills-list {
  display: flex;
  flex-direction: column;
}

/* Order row (rendered by JS) */
.order-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  gap: 8px;
}
.order-item:last-child { border-bottom: none; }

.order-item .oi-side { font-weight: 600; }
.order-item .oi-side.buy  { color: var(--buy); }
.order-item .oi-side.sell { color: var(--sell); }

.order-item .oi-cancel {
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  padding: 2px 4px;
  -webkit-tap-highlight-color: transparent;
}
.order-item .oi-cancel:hover { color: var(--sell); }

/* Fill row (rendered by JS) */
.fill-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-family: var(--font-mono);
}
.fill-item:last-child { border-bottom: none; }
.fill-item .fi-side.buy  { color: var(--buy); font-weight: 600; }
.fill-item .fi-side.sell { color: var(--sell); font-weight: 600; }
.fill-item .fi-time { color: var(--text-muted); font-family: var(--font-sans); font-size: 10px; }


/* ── Margin modal internals ───────────────────────────────── */
.margin-info {
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.mi-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}
.mi-row span:last-child {
  color: var(--text-secondary);
  font-family: var(--font-mono);
}


/* ── Auth page ────────────────────────────────────────────── */
.auth-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  gap: 28px;
}

.auth-logo {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.auth-logo-icon {
  width: 52px;
  height: 52px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: var(--text-inverse);
  font-weight: 900;
  box-shadow: 0 4px 16px rgba(240, 185, 11, 0.3);
}

.auth-logo h1 {
  font-size: 22px;
  font-weight: 700;
}

.auth-logo .text-muted {
  font-size: 13px;
  color: var(--text-muted);
}

.auth-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 22px;
  width: 100%;
  max-width: 380px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.auth-tab {
  flex: 1;
  height: 40px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  -webkit-tap-highlight-color: transparent;
}
.auth-tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.input-group input {
  height: 44px;
  padding: 0 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  transition: border-color var(--transition);
  width: 100%;
  font-family: var(--font-sans);
}
.input-group input:focus { border-color: var(--accent); }
.input-group input::placeholder { color: var(--text-muted); }

.btn-primary {
  height: 44px;
  padding: 0 20px;
  background: var(--accent);
  color: var(--text-inverse);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition);
  border: none;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-full { width: 100%; }

.btn-passkey {
  height: 40px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.btn-passkey:hover {
  border-color: var(--border-light);
  color: var(--text-primary);
  background: var(--bg-hover);
}

.auth-footer {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  padding-top: 4px;
}


/* ── Settings page ────────────────────────────────────────── */
.settings-page {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background: var(--bg-primary);
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  padding: 0 8px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.settings-header h2 {
  font-size: 15px;
  font-weight: 700;
}

.settings-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  -webkit-overflow-scrolling: touch;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-section h3 {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 4px;
}

.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  gap: 12px;
}

.settings-item:last-child { border-bottom: none; }

.settings-item .label { color: var(--text-muted); font-size: 12px; }
.settings-item .val  { color: var(--text-secondary); }

.settings-tip {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.badge-info {
  font-size: 10px;
  background: rgba(240, 185, 11, 0.1);
  color: var(--accent);
  padding: 1px 6px;
  border-radius: 99px;
  font-weight: 500;
  margin-left: 6px;
  border: 1px solid rgba(240, 185, 11, 0.2);
}

.key-info {
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid var(--border);
  margin-bottom: 10px;
}

.ki-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
  gap: 12px;
}

.ki-row span:last-child {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: right;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.key-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.key-actions {
  display: flex;
  gap: 8px;
}

.btn-text {
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
  border: none;
  -webkit-tap-highlight-color: transparent;
}
.btn-text:hover { color: var(--text-primary); }

.btn-danger {
  height: 44px;
  padding: 0 16px;
  background: transparent;
  border: 1px solid var(--sell);
  color: var(--sell);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.btn-danger:hover { background: var(--sell-bg); }

.mono { font-family: var(--font-mono); }


/* ── Desktop layout ≥960px ────────────────────────────────── */
@media (min-width: 960px) {
  .trade-layout {
    height: 100vh;
    overflow: hidden;
    display: grid;
    grid-template-rows: 48px 36px 1fr auto;
    grid-template-columns: 1fr 320px;
  }

  .trade-header {
    grid-column: 1 / -1;
    position: relative;
    top: auto;
  }

  .price-stats {
    grid-column: 1 / -1;
  }

  .chart-book-row {
    grid-column: 1;
    grid-row: 3;
    height: auto;
    border-right: 1px solid var(--border);
    border-bottom: none;
  }

  .order-form-section {
    grid-column: 2;
    grid-row: 3 / 5;
    overflow-y: auto;
    border-bottom: none;
    border-left: 1px solid var(--border);
  }

  .bottom-panel {
    grid-column: 1;
    grid-row: 4;
    min-height: 200px;
    max-height: 260px;
    border-top: 1px solid var(--border);
  }
}
