:root {
  --bg-primary: #0A0E1A;
  --bg-secondary: #0F1422;
  --bg-card: #131A2C;
  --bg-hover: #1A2340;
  --bg-input: #0D1220;
  --border-color: #1E2A45;
  --border-light: #2A3A5C;
  --text-primary: #E8ECF1;
  --text-secondary: #8894AA;
  --text-muted: #5A6680;
  --green: #00D4AA;
  --green-bg: rgba(0,212,170,0.12);
  --red: #F84960;
  --red-bg: rgba(248,73,96,0.12);
  --blue: #3B82F6;
  --blue-bg: rgba(59,130,246,0.15);
  --gold: #F0B90B;
  --orange: #F7931A;
  --purple: #E040FB;
  --radius: 10px;
  --radius-lg: 14px;
  --transition: 0.2s ease;
  --font-mono: 'Consolas', 'Monaco', 'Courier New', monospace;
}
* { margin:0; padding:0; box-sizing:border-box; }
body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 14px; line-height: 1.5;
  min-height: 100vh;
}
::-webkit-scrollbar { width:4px; height:4px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:var(--border-light); border-radius:2px; }
::-webkit-scrollbar-thumb:hover { background:var(--text-muted); }

/* ═══ UNIVERSAL WATER-RIPPLE DEFENSE ═══ */
body::before{background:none!important;opacity:0!important}
body[data-mode]::before{display:none!important;content:none!important;background:none!important;opacity:0!important}

/* ═══ DROPDOWN GAP BRIDGE ═══ */
/* Prevents hover-dropdowns from closing when cursor crosses the gap between trigger and menu */
.nav-item.has-dd, .lang-wrap, .asset-dd-wrap, .user-dd-wrap {
  position: relative;
}
.nav-item.has-dd::before, .lang-wrap::before, .asset-dd-wrap::before, .user-dd-wrap::before {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  height: 14px;
  z-index: 1;
}

/* ===== NAVBAR ===== */
.navbar {
  position: fixed; top:0; left:0; right:0; z-index:9999;
  height:48px; background:var(--bg-secondary);
  border-bottom:1px solid var(--border-color);
  display:flex; align-items:center; padding:0 16px;
  justify-content:space-between;
  overflow:visible;
}
.navbar-left { display:flex; align-items:center; gap:20px; flex-shrink:0; }
.logo { display:flex; align-items:center; gap:8px; font-weight:700; font-size:16px; color:var(--text-primary); white-space:nowrap; }
.logo-icon { width:28px; height:28px; background:linear-gradient(135deg,#3B82F6,#00D4AA); border-radius:var(--radius); display:flex; align-items:center; justify-content:center; font-size:14px; color:#fff; }
.nav-menu { display:flex; align-items:center; gap:4px; list-style:none; }
.nav-item { position:relative; padding:6px 12px; cursor:pointer; border-radius:var(--radius); font-size:14px; font-weight:600; color:var(--text-secondary); white-space:nowrap; transition:var(--transition); }
.nav-item.active { color:var(--blue); }
.navbar-right { display:flex; align-items:center; gap:8px; flex-shrink:0; }
.navbar-btn { padding:6px 10px; border-radius:var(--radius); cursor:pointer; color:var(--text-secondary); font-size:14px; font-weight:600; transition:var(--transition); display:flex; align-items:center; gap:4px; white-space:nowrap; position:relative; }
.avatar { width:28px; height:28px; border-radius:50%; background:var(--blue); display:flex; align-items:center; justify-content:center; font-size:12px; color:#fff; }
.notify-badge { position:absolute; top:-2px; right:-2px; background:var(--red); color:#fff; font-size:10px; width:16px; height:16px; border-radius:50%; display:flex; align-items:center; justify-content:center; line-height:1; }
.switch-track { width:38px; height:20px; border-radius:10px; background:var(--border-light); cursor:pointer; position:relative; transition:var(--transition); flex-shrink:0; }
.switch-track.on { background:var(--green); }
.switch-thumb { width:16px; height:16px; border-radius:50%; background:#fff; position:absolute; top:2px; left:2px; transition:var(--transition); }
.switch-track.on .switch-thumb { left:20px; }
.dropdown { position:absolute; top:100%; left:0; margin-top:4px; background:var(--bg-card); border:1px solid var(--border-color); border-radius:var(--radius-lg); min-width:160px; padding:6px; z-index:10001; display:none; box-shadow:0 8px 32px rgba(0,0,0,0.5); }
.dropdown.show { display:block; }
.dropdown-item { padding:8px 14px; border-radius:var(--radius); cursor:pointer; color:var(--text-secondary); font-size:14px; transition:var(--transition); white-space:nowrap; display:flex; align-items:center; gap:8px; }

.dropdown-right { left:auto; right:0; }

.hamburger { display:none; cursor:pointer; padding:4px; color:var(--text-secondary); font-size:18px; transition:var(--transition); }

.mobile-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.6); z-index:19998; }
.mobile-nav { display:none; position:fixed; top:48px; left:0; bottom:0; width:260px; background:var(--bg-card); z-index:19999; flex-direction:column; padding:12px; gap:4px; overflow-y:auto; border-right:1px solid var(--border-color); transform:translateX(-100%); transition:transform 0.3s ease; }
.mobile-nav.open { transform:translateX(0); }
.mobile-nav-item { padding:10px 14px; border-radius:var(--radius); cursor:pointer; color:var(--text-secondary); font-size:14px; transition:var(--transition); }
.mobile-nav-item:hover, .mobile-nav-item.active { color:var(--text-primary); background:var(--bg-hover); }
.mobile-nav-divider { height:1px; background:var(--border-color); margin:6px 0; }

/* ===== APP WRAPPER ===== */
.app { padding-top:48px; min-height:100vh; }

/* ===== MAIN GRID ===== */
.main-grid {
  display: grid;
  grid-template-columns: 280px minmax(500px, 780px) 340px;
  gap: 20px;
  max-width: 1400px;
  margin: 20px auto;
  padding: 0 20px;
}

.left-panel, .center-panel, .right-panel {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 16px;
}

/* ===== LEFT PANEL ===== */
.left-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.coin-search-wrap { padding: 12px; position: relative; }
.coin-search { width: 100%; padding: 8px 12px 8px 32px; background: var(--bg-input); border: 1px solid var(--border-color); border-radius: var(--radius); color: var(--text-primary); font-size: 14px; outline: none; transition: var(--transition); }
.coin-search:focus { border-color: var(--blue); }
.coin-search-wrap .fa-search { position: absolute; left: 22px; top: 21px; color: var(--text-muted); font-size: 12px; pointer-events: none; }

.coin-tabs { display: flex; gap: 2px; padding: 0 12px 10px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.coin-tab { padding: 5px 12px; border-radius: 6px; cursor: pointer; font-size: 12px; color: var(--text-secondary); white-space: nowrap; flex-shrink: 0; transition: var(--transition); }

.coin-tab.active { background: var(--blue-bg); color: var(--blue); }

.coin-table-header { display: grid; grid-template-columns: 20px 1fr 80px 70px; padding: 6px 12px; font-size: 12px; color: var(--text-muted); border-bottom: 1px solid var(--border-color); gap: 4px; }
.coin-list { flex: 1; overflow-y: auto; max-height: calc(100vh - 260px); }
.coin-row { display: grid; grid-template-columns: 20px 1fr 80px 70px; padding: 7px 12px; cursor: pointer; transition: var(--transition); border-bottom: 1px solid rgba(30,42,69,0.4); align-items: center; gap: 4px; }

.coin-row { border-left: 2px solid transparent; }
.coin-row.selected { background: var(--blue-bg); border-left-color: var(--blue); }
.coin-star { color: var(--text-muted); font-size: 12px; cursor: pointer; transition: var(--transition); }
.coin-star.favorited { color: var(--gold); }

.coin-name { display: flex; align-items: center; gap: 7px; min-width: 0; }
.coin-icon { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: #fff; flex-shrink: 0; }
.coin-pair { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.coin-unit { color: var(--text-muted); font-size: 11px; margin-left: 1px; }
.coin-price { text-align: right; font-family: var(--font-mono); font-size: 16px; font-weight: 700; }
.coin-change { text-align: right; font-family: var(--font-mono); font-size: 13px; font-weight: 500; }
.coin-change.up { color: var(--green); }
.coin-change.down { color: var(--red); }

/* ===== CENTER PANEL ===== */
.center-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;
  gap: 16px;
}

.kline-chart {
  width: 100%;
  height: 350px;
  flex-shrink: 0;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

/* Trade buttons */
.trade-buttons { display: flex; gap: 12px; }
.btn-direction { flex: 1; padding: 16px; border-radius: var(--radius); cursor: pointer; font-size: 16px; font-weight: 700; border: none; color: #fff; transition: var(--transition); display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-buy-up { background: var(--green); }

.btn-buy-down { background: var(--red); }

/* Order Book */
.order-book {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
}
.ob-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-shrink: 0;
}
.ob-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.ob-col-heads {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  padding: 2px 0 6px;
  font-size: 10px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.ob-col-heads span:nth-child(2) { text-align: center; }
.ob-col-heads span:nth-child(3) { text-align: right; }

.ob-rows {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
.ob-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  padding: 2px 0;
  font-family: var(--font-mono);
  font-size: 12px;
  position: relative;
  line-height: 1.6;
}
.ob-row.ask .ob-price { color: var(--red); }
.ob-row.ask .ob-qty { color: var(--text-secondary); text-align: right; }
.ob-row.bid .ob-price { color: var(--green); }
.ob-row.bid .ob-qty { color: var(--text-secondary); text-align: right; }

.ob-bar {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  opacity: 0.12;
  border-radius: 2px;
  z-index: 0;
}
.ob-row.ask .ob-bar { background: var(--red); }
.ob-row.bid .ob-bar { background: var(--green); }
.ob-row.ask .ob-bar { left: auto; }
.ob-row.bid .ob-bar { left: 0; }
.ob-row .ob-price, .ob-row .ob-qty { position: relative; z-index: 1; }

.ob-spread-row {
  text-align: center;
  padding: 6px 0;
  font-family: var(--font-mono);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  margin: 3px 0;
}
.ob-spread-price {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}
.ob-spread-price.up { color: var(--green); }
.ob-spread-price.down { color: var(--red); }
.ob-spread-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 8px;
}
.ob-ratio {
  display: flex;
  height: 4px;
  border-radius: 2px;
  overflow: hidden;
  margin: 4px 0 0;
}
.ob-ratio-bid { background: var(--green); }
.ob-ratio-ask { background: var(--red); }

.ob-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: 0 0 var(--radius) var(--radius);
}
.ob-tool-icons {
  display: flex;
  gap: 12px;
}
.ob-tool-icon {
  font-size: 14px;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.ob-tool-icon.active { color: var(--blue); }
.ob-tool-icon[data-filter="sell"]:hover, .ob-tool-icon[data-filter="sell"].active { color: var(--red); }
.ob-tool-icon[data-filter="buy"]:hover, .ob-tool-icon[data-filter="buy"].active { color: var(--green); }

.ob-qty-select {
  background: var(--bg-hover);
  border: none;
  border-radius: 6px;
  color: #fff;
  padding: 4px 8px;
  font-size: 12px;
  font-family: var(--font-mono);
  cursor: pointer;
  outline: none;
}
.ob-qty-select option { background: #1E222D; color: #fff; }

.trade-section {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.trade-sec-header {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}
.trade-sec-dot { font-size: 8px; color: var(--green); flex-shrink: 0; }
.trade-sec-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}

.product-selector { display: flex; gap: 8px; }
.product-card {
  flex: 1;
  padding: 8px;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  background: #0F1422;
  border: 2px solid var(--border-color);
  transition: var(--transition);
}

.product-card.selected { border-color: var(--green); background: var(--green-bg); }
.product-card-dur { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.product-card-pct { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.product-card.selected .product-card-dur { color: var(--green); }

.trade-balance-input {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-mono);
  outline: none;
  transition: var(--transition);
}
.trade-balance-input:focus { border-color: var(--blue); }

.trade-amount-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}
.trade-amount-left { display: flex; align-items: center; gap: 12px; }
.trade-amount-label { font-size: 13px; color: var(--text-primary); font-weight: 500; }
.trade-amount-hint { color: var(--text-muted); font-size: 12px; }
.trade-all-btn {
  padding: 3px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  color: var(--blue);
  border: 1px solid var(--blue);
  background: transparent;
  transition: var(--transition);
  user-select: none;
}

.trade-input {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-mono);
  outline: none;
}
.trade-input:focus { border-color: var(--blue); }

.trade-quick-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.quick-chip {
  padding: 8px 2px;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  transition: var(--transition);
  font-family: var(--font-mono);
}

.trade-fee-section {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
}
.trade-fee-section .trade-sec-header {
  padding: 10px 12px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}
.trade-fee-toggle {
  font-size: 12px;
  color: var(--blue);
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
  margin-left: auto;
}

.trade-fee-body { padding: 0 12px 8px; display: block; }
.trade-fee-body.collapsed { display: none; }
.fee-detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 0;
}
.fee-detail-row b { color: var(--text-primary); }

/* ===== RIGHT PANEL ===== */
.order-table-wrap { overflow-x: auto; }
.order-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.order-table thead th { background: #131A2C; padding: 8px 5px; text-align: left; font-weight: 500; color: var(--text-muted); white-space: nowrap; border-bottom: 1px solid var(--border-color); }
.order-table tbody td { padding: 7px 5px; border-bottom: 1px solid rgba(30,42,69,0.4); white-space: nowrap; }

.order-direction { font-weight: 600; }
.order-direction.up { color: var(--green); }
.order-direction.down { color: var(--red); }
.order-countdown { color: var(--orange); font-weight: 600; font-family: var(--font-mono); }

.empty-state { display: flex; align-items: center; justify-content: center; padding: 24px; color: var(--text-muted); font-size: 12px; flex-direction: column; gap: 6px; }
.empty-state i { font-size: 22px; }

/* ===== BOTTOM BAR ===== */
.bottom-bar {
  margin-top: 20px;
  border-top: 1px solid var(--border-color);
}

.bottom-bar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

.bottom-panel {
  background: #131A2C;
  border-radius: var(--radius-lg);
  padding: 16px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.order-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.order-tabs { display: flex; gap: 24px; }

.order-tab {
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  padding-bottom: 4px;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
  user-select: none;
}
.order-tab.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

.refresh-icon {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
  transition: var(--transition);
}

.bottom-panel .order-table-wrap {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

/* Toast */
.toast { position: fixed; top: 60px; left: 50%; transform: translateX(-50%); z-index: 9999; padding: 12px 24px; border-radius: var(--radius); font-size: 14px; font-weight: 500; animation: toastIn 0.3s ease, toastOut 0.3s ease 2.5s forwards; pointer-events: none; }
.toast.success { background: var(--green); color: #000; }
.toast.error { background: var(--red); color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(-10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; } }

/* ═══ TOUCH-FRIENDLY TAP TARGETS ═══ */
.nav-item, .navbar-btn, .dropdown-item, .mobile-nav-item,
.coin-tab, .tab-pill, .quick-chip, .btn, .btn-outline, .btn-blue,
.hamburger, button, .nav-icon {
  min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  padding-top: 10px; padding-bottom: 10px;
}
/* Keep hover effects only on devices that support hover */
@media (hover: hover) {
  .nav-item:hover, .nav-item.active { color: var(--text-primary); background: var(--bg-hover); }
  .navbar-btn:hover { color: var(--text-primary); background: var(--bg-hover); }
  .dropdown-item:hover { background: var(--bg-hover); color: var(--text-primary); }
  .hamburger:hover { color: var(--text-primary); }
  .mobile-nav-item:hover, .mobile-nav-item.active { color: var(--text-primary); background: var(--bg-hover); }
  .coin-tab:hover { color: var(--text-primary); }
  .coin-row:hover { background: var(--bg-hover); }
  .coin-star:hover { color: var(--gold); }
  .order-table tbody tr:hover td { background: rgba(255,255,255,0.03); }
  .btn-buy-up:hover { background: #00E6B8; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0,212,170,0.3); }
  .btn-buy-down:hover { background: #FF5C72; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(248,73,96,0.3); }
  .ob-tool-icon:hover { color: var(--text-primary); }
  .quick-chip:hover { border-color: var(--blue); color: var(--blue); }
  .refresh-icon:hover { color: var(--text-primary); }
  .product-card:hover { border-color: var(--border-light); }
  .trade-all-btn:hover { background: var(--blue-bg); }
  .trade-fee-toggle:hover { color: #60A5FA; }
}
/* Visual feedback on tap (mobile) */
@media (hover: none) {
  .nav-item:active, .navbar-btn:active, .dropdown-item:active, .coin-tab:active,
  .tab-pill:active, .quick-chip:active, .hamburger:active, .btn:active {
    background: var(--bg-hover);
  }
}

/* ===== MARKET STATS BAR ===== */
.market-stats {
  display: flex;
  gap: 48px;
  background: var(--bg-card);
  padding: 16px 32px;
  margin: 16px 20px 0 20px;
  border-radius: var(--radius-lg);
  align-items: center;
  flex-wrap: wrap;
}
.stat-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.icon-group {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.stat-label {
  font-size: 12px;
  color: var(--text-muted);
}
.stat-value {
  font-size: 18px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-primary);
}
.stat-value.positive { color: var(--green); }
.stat-value.negative { color: var(--red); }
/* ===== RESPONSIVE ===== */
@media (max-width: 1300px) {
  .main-grid { grid-template-columns: 260px minmax(400px, 1fr) 320px; gap: 16px; padding: 16px; }
  .kline-chart { height: 280px; }
}
/* ===== RESPONSIVE / TABLET ===== */
@media (max-width: 1080px) {
  .main-grid {
    grid-template-columns: 200px minmax(360px, 1fr) 300px;
    gap: 10px;
    -webkit-overflow-scrolling: touch;
  }
  .left-panel, .center-panel, .right-panel { min-width: 0; flex-shrink: 0; }
  .center-panel { min-width: 0; }
  .kline-chart { height: 230px; }
  .nav-menu { display: none; }
  .hamburger { display: flex; align-items: center; }
  .mobile-nav { display: flex; }
  .mobile-overlay.open { display: block; }
}
@media (max-width: 768px) {
  /* ═══ Prevent horizontal scroll ═══ */
  html, body { overflow-x: hidden; width: 100%; max-width: 100vw; }
  .app { overflow-x: hidden; }
  .nav, .navbar, .main-grid, .left-panel, .center-panel, .right-panel, section, main, footer { max-width: 100vw; }

  .navbar { padding: 0 10px; }
  .navbar-left { gap: 10px; }
  .navbar-right { gap: 4px; }
  .navbar-btn { padding: 5px 7px; font-size: 12px; }
  .navbar-right .hide-sm { display: none; }

  /* ═══ Single-column layout ═══ */
  .main-grid { display: flex; flex-direction: column; gap: 10px; padding: 10px; width: 100%; }
  .left-panel, .center-panel, .right-panel, .sidebar { width: 100% !important; min-width: 0 !important; padding: 10px; flex-shrink: 0; max-width: 100%; }
  .center-panel { min-width: 0; }
  .page-container, .page-layout, .trade-layout { flex-direction: column !important; width: 100% !important; }

  /* ═══ Table wrappers — allow scroll if needed but prefer wrapping ═══ */
  .order-table-wrap, .table-wrap, .data-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
  .order-table, table { font-size: 12px; width: 100%; }
  .order-table thead th, .order-table tbody td, thead th, td { padding: 6px 4px; }
  /* Allow table cells to wrap instead of forcing scroll */
  .order-table thead th, .order-table tbody td, td, th { white-space: normal; word-break: break-word; }

  /* ═══ Full-width controls ═══ */
  button, .btn, .fund-card-btn { padding: 10px 16px; font-size: 14px; width: 100%; max-width: 100%; }
  input[type="text"], input[type="number"], input[type="email"], input[type="password"], select { width: 100%; max-width: 100%; padding: 10px 12px; font-size: 14px; }

  /* ═══ Kline ═══ */
  .kline-chart { height: 200px; width: 100%; }

  /* ═══ Coin list — card layout on mobile ═══ */
  .coin-table-header { display: none; }
  .coin-row {
    display: flex; flex-direction: column;
    grid-template-columns: unset;
    padding: 10px 12px; gap: 4px;
    border-bottom: 1px solid var(--border-color);
    width: 100%;
  }
  .coin-row .coin-name { font-size: 14px; font-weight: 600; }
  .coin-row .coin-price { font-size: 16px; font-weight: 700; text-align: left; }
  .coin-row .coin-change { text-align: left; font-size: 13px; }
  .coin-row .coin-star { position: absolute; right: 12px; top: 10px; }
  .coin-row > * { max-width: 100%; }
  .coin-list { max-height: 180px; }
  .coin-tabs { padding: 0 4px 6px; gap: 0; overflow-x: auto; }
  .coin-tab { padding: 6px 10px; font-size: 11px; white-space: nowrap; }

  /* ═══ All grids → single column ═══ */
  .right-panel, .left-panel, .sidebar, .grid-2col, .grid-3col,
  [style*="grid-template-columns"] {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* ═══ Trade section ═══ */
  .trade-section { flex-direction: column; gap: 10px; padding: 10px; width: 100%; }
  .trade-panel { width: 100%; max-width: 100%; }
  .trade-quick-row { grid-template-columns: repeat(4, 1fr); }
  .quick-chip { font-size: 11px; padding: 6px 4px; }

  /* ═══ Bottom bar ═══ */
  .bottom-bar-inner { flex-direction: column; gap: 6px; padding: 8px; }
  .position-filter { flex-wrap: wrap; gap: 4px; }

  /* ═══ Product cards ═══ */
  .product-card { padding: 8px 6px; flex: 1 1 45%; }
  .product-card-pct { font-size: 14px; }
  .product-grid { display: flex; flex-wrap: wrap; gap: 6px; }

  /* ═══ Full-width cards ═══ */
  .card, .market-card, .sidebar-card, .learn-card, .action-card, .feature-card {
    width: 100%; max-width: 100%; margin-left: 0; margin-right: 0;
  }

  /* ═══ Footer ═══ */
  .footer-inner { flex-direction: column; gap: 24px; }
  .footer-links { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .footer-right { text-align: left; }

  /* ═══ Hero / banner ═══ */
  .hero { padding: 40px 16px 32px; }
  .hero h1 { font-size: 26px; }
  .hero-stats { gap: 32px; }
  .hero-stat .num { font-size: 22px; }
  .banner { height: 180px; }
  .banner-content h1 { font-size: 24px; }

  /* ═══ Nav ═══ */
  .nav-menu { display: none; }
  .hamburger { display: flex; align-items: center; }
  .mobile-nav { display: flex; flex-direction: column; z-index: 20000; }
  .mobile-overlay.open { display: block; }
  .navbar { padding: 0 8px; }
  .navbar-left { gap: 6px; }
  .navbar-right { gap: 2px; }
  .navbar-btn { padding: 5px 6px; font-size: 12px; }
}

@media (max-width: 480px) {
  .navbar { height: 44px; }
  .app { padding-top: 44px; }
  .mobile-nav { top: 44px; }
  .left-panel, .center-panel, .right-panel { padding: 8px; }
  .kline-chart { height: 165px; }
  .trade-section { gap: 8px; padding: 8px; }
  .product-card { padding: 7px 4px; flex: 1 1 100%; }
  .product-card-pct { font-size: 13px; }
  .trade-quick-row { grid-template-columns: repeat(4, 1fr); gap: 4px; }
  .quick-chip { font-size: 10px; }
  .order-table { font-size: 10px; }
  .order-table thead th, .order-table tbody td { padding: 5px 3px; }
  .bottom-bar-inner { gap: 8px; padding: 8px; }

  /* ===== MOBILE: Coin list more compact ===== */
  .coin-table-header, .coin-row { grid-template-columns: 14px 1fr 54px 44px; font-size: 10px; }
  .coin-list { max-height: 120px; }
}
