/* ============================================================
   OnePercentBotTrade — Luxury Crypto Trading Theme
   Onyx & Gold · Inter / JetBrains Mono · Glass + Glow
   ============================================================ */

:root {
  /* ── Brand palette ───────────────────────────────────── */
  --bg-0: #070b14;
  --bg-1: #0c1220;
  --bg-2: #111827;
  --bg-3: #1a2332;
  --bg-4: #243049;
  --bg-glass: rgba(17, 24, 39, 0.72);

  --border-soft: rgba(255, 255, 255, 0.06);
  --border-mid: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);

  --text-1: #f1f5f9;
  --text-2: #cbd5e1;
  --text-3: #94a3b8;
  --text-4: #64748b;

  --gold-1: #f5b800;
  --gold-2: #ffd76a;
  --gold-glow: rgba(245, 184, 0, 0.35);

  --bull-1: #00e5b8;
  --bull-2: #00b894;
  --bull-glow: rgba(0, 229, 184, 0.35);

  --bear-1: #ff4d6d;
  --bear-2: #ff6b85;
  --bear-glow: rgba(255, 77, 109, 0.35);

  --warn-1: #ffb547;
  --info-1: #5dc4ff;
  --violet-1: #a78bfa;

  --shadow-1: 0 1px 2px rgba(0,0,0,0.45);
  --shadow-2: 0 4px 16px rgba(0,0,0,0.45);
  --shadow-3: 0 16px 48px rgba(0,0,0,0.55);
  --shadow-gold: 0 0 0 1px rgba(245,184,0,0.20), 0 6px 24px rgba(245,184,0,0.18);
  --shadow-bull: 0 0 0 1px rgba(0,229,184,0.20), 0 6px 24px rgba(0,229,184,0.18);
  --shadow-bear: 0 0 0 1px rgba(255,77,109,0.20), 0 6px 24px rgba(255,77,109,0.18);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Cascadia Code', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { background: var(--bg-1); color: var(--text-1); }
body {
  font-family: var(--font-sans);
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  letter-spacing: 0.005em;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(245,184,0,0.06), transparent 60%),
    radial-gradient(900px 500px at 110% 0%, rgba(0,229,184,0.05), transparent 60%),
    radial-gradient(800px 600px at 50% 110%, rgba(167,139,250,0.04), transparent 60%),
    var(--bg-1);
  background-attachment: fixed;
  min-height: 100vh;
  margin: 0;
}
a { color: var(--gold-1); text-decoration: none; }
a:hover { color: var(--gold-2); text-decoration: none; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-1); }
::-webkit-scrollbar-thumb { background: linear-gradient(180deg, var(--bg-4), var(--bg-3)); border-radius: 999px; border: 2px solid var(--bg-1); }
::-webkit-scrollbar-thumb:hover { background: var(--gold-1); }

/* ============================================================
   NAVBAR
   ============================================================ */
.app-nav {
  position: sticky; top: 0; z-index: 1030;
  background: linear-gradient(180deg, rgba(7,11,20,0.92), rgba(7,11,20,0.78));
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border-soft);
  padding: 0.65rem 1rem;
}
.app-nav .brand {
  display: inline-flex; align-items: center; gap: 0.65rem;
  font-weight: 800; font-size: 1.05rem;
  color: var(--text-1) !important;
  letter-spacing: -0.01em;
}
.app-nav .brand-logo {
  width: 32px; height: 32px;
  border-radius: 8px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 6px 20px rgba(245,184,0,0.25);
  flex-shrink: 0;
}
.app-nav .nav-pill {
  display: inline-flex; align-items: center;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  font-size: 0.88rem; font-weight: 500;
  color: var(--text-2) !important;
  border: 1px solid transparent;
  transition: all 0.15s;
}
.app-nav .nav-pill:hover {
  color: var(--text-1) !important;
  background: rgba(255,255,255,0.04);
  border-color: var(--border-soft);
}
.app-nav .nav-pill.active {
  color: var(--gold-1) !important;
  background: rgba(245,184,0,0.08);
  border-color: rgba(245,184,0,0.25);
  box-shadow: inset 0 0 12px rgba(245,184,0,0.08);
}
.app-nav .ws-status {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.35rem 0.7rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  font-size: 0.78rem; color: var(--text-3);
  font-family: var(--font-mono);
  cursor: default;
}
.app-nav .balance-pill {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.35rem 0.85rem 0.35rem 0.7rem;
  background: linear-gradient(135deg, rgba(245,184,0,0.10), rgba(245,184,0,0.04));
  border: 1px solid rgba(245,184,0,0.28);
  border-radius: 999px;
  font-family: var(--font-mono);
  color: var(--gold-1);
  font-size: 0.82rem; font-weight: 600;
  cursor: default;
  user-select: none;
  transition: border-color 0.2s, background 0.2s;
}
.app-nav .balance-pill:hover {
  border-color: rgba(245,184,0,0.45);
  background: linear-gradient(135deg, rgba(245,184,0,0.16), rgba(245,184,0,0.06));
}
/* FIX-2026-07-14: graceful error state เวลา Binance API fail (เช่น -1021 timestamp drift)
   — เปลี่ยนเป็นแดงอ่อน ๆ + cursor เป็น help เพื่อให้รู้ว่าไม่ใช่ "ยอดเงินจริง" */
.app-nav .balance-pill.is-error {
  background: linear-gradient(135deg, rgba(255,77,109,0.10), rgba(255,77,109,0.03));
  border-color: rgba(255,77,109,0.35);
  cursor: help;
}
.app-nav .balance-pill.is-error .balance-usdt {
  color: var(--bear-1);
}
/* FIX-2026-08-20: "reserved" state — gold border slightly brighter to hint
   that part of the balance is locked away from the bots. */
.app-nav .balance-pill.is-reserved {
  background: linear-gradient(135deg, rgba(245,184,0,0.18), rgba(245,184,0,0.08));
  border-color: rgba(245,184,0,0.55);
}
.app-nav .balance-pill.is-reserved .balance-usdt {
  color: var(--gold-1);
}
/* FIX-2026-08-20: "over-reserved" state — reserve exceeds total balance so
   bots cannot spend any USDT. Red border + red text to call attention. */
.app-nav .balance-pill.is-over-reserved {
  background: linear-gradient(135deg, rgba(255,77,109,0.18), rgba(255,77,109,0.06));
  border-color: rgba(255,77,109,0.55);
}
.app-nav .balance-pill.is-over-reserved .balance-usdt {
  color: var(--bear-1);
}

/* FIX-2026-08-20: secondary "🛡 N USDT" pill — sits next to the main balance
   pill only when reserve > 0. Hidden otherwise. */
.app-nav .balance-reserve-pill {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  background: rgba(245,184,0,0.08);
  border: 1px solid rgba(245,184,0,0.35);
  border-radius: 999px;
  font-family: var(--font-mono);
  color: var(--gold-1);
  font-size: 0.78rem; font-weight: 600;
  cursor: default;
  user-select: none;
}
.app-nav .balance-reserve-pill:hover {
  background: rgba(245,184,0,0.14);
  border-color: rgba(245,184,0,0.50);
}
.app-nav .balance-reserve-pill .reserve-glyph { font-size: 0.9rem; }
.app-nav .balance-reserve-pill.is-over {
  background: rgba(255,77,109,0.10);
  border-color: rgba(255,77,109,0.45);
  color: var(--bear-1);
}
@media (max-width: 575.98px) {
  .app-nav .balance-reserve-pill { display: none !important; }
}
.app-nav .balance-pill .balance-icon { font-size: 0.95rem; }
.app-nav .balance-pill .balance-text {
  display: inline-flex; flex-direction: column; align-items: flex-start;
  line-height: 1.1;
}
.app-nav .balance-pill .balance-usdt {
  font-size: 0.85rem; color: var(--gold-1); font-weight: 700;
}
.app-nav .balance-pill .balance-thb {
  font-size: 0.72rem; color: var(--text-3); font-weight: 500;
}
@media (max-width: 575.98px) {
  .app-nav .balance-pill .balance-thb { display: none !important; }
  .app-nav .balance-pill { padding-right: 0.55rem; }
}
.app-nav .ws-status .ws-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-4);
  transition: all 0.2s;
}
.app-nav .ws-status.live .ws-dot {
  background: var(--bull-1);
  box-shadow: 0 0 0 0 var(--bull-1);
  animation: pulse-bull 1.6s infinite;
}
.app-nav .ws-status.live { color: var(--bull-1); border-color: rgba(0,229,184,0.25); }
.app-nav .ws-status.dead .ws-dot { background: var(--bear-1); animation: pulse-bear 1s infinite; }
.app-nav .ws-status.dead { color: var(--bear-1); border-color: rgba(255,77,109,0.25); }

@keyframes pulse-bull {
  0%   { box-shadow: 0 0 0 0 rgba(0,229,184,0.7); }
  70%  { box-shadow: 0 0 0 7px rgba(0,229,184,0); }
  100% { box-shadow: 0 0 0 0 rgba(0,229,184,0); }
}
@keyframes pulse-bear {
  0%   { box-shadow: 0 0 0 0 rgba(255,77,109,0.7); }
  70%  { box-shadow: 0 0 0 7px rgba(255,77,109,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,77,109,0); }
}

.app-nav .nav-toggle {
  background: transparent; border: 1px solid var(--border-mid);
  color: var(--text-2); border-radius: 8px; padding: 0.4rem 0.55rem;
}
.app-nav .nav-toggle:focus { outline: none; box-shadow: 0 0 0 3px rgba(245,184,0,0.25); }
.app-nav .nav-toggle:hover { color: var(--gold-1); border-color: rgba(245,184,0,0.4); }
.app-nav .mobile-menu {
  background: linear-gradient(180deg, rgba(12,18,32,0.96), rgba(7,11,20,0.96));
  border-top: 1px solid var(--border-soft);
  padding: 0.65rem 1rem 1rem;
}
.app-nav .mobile-menu .nav-pill { width: 100%; justify-content: flex-start; }

/* ============================================================
   CARDS
   ============================================================ */
.lux-card {
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-3) 100%);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  color: var(--text-1);
  overflow: hidden;
  position: relative;
}
.lux-card::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), transparent 30%);
  pointer-events: none; border-radius: inherit;
}
.lux-card .card-header,
.lux-card .lux-header {
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(255,255,255,0.02);
  font-weight: 600; font-size: 0.78rem;
  color: var(--text-2);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.5rem;
}
.lux-card .lux-header .title { display: flex; align-items: center; gap: 0.5rem; }
.lux-card .lux-header .accent-gold { color: var(--gold-1); }
.lux-card .card-body,
.lux-card .lux-body { padding: 1.1rem; position: relative; }
.lux-card .lux-body.no-pad { padding: 0; }

.lux-card.is-gold { border-color: rgba(245,184,0,0.30); box-shadow: var(--shadow-gold); }
.lux-card.is-bull { border-color: rgba(0,229,184,0.30); box-shadow: var(--shadow-bull); }
.lux-card.is-bear { border-color: rgba(255,77,109,0.30); box-shadow: var(--shadow-bear); }

.lux-glass {
  background: var(--bg-glass);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
}

/* ============================================================
   STAT TILES
   ============================================================ */
.stat-tile {
  position: relative;
  padding: 1rem 1.15rem;
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-3) 100%);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  text-align: left;
  overflow: hidden;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.stat-tile:hover {
  transform: translateY(-1px);
  border-color: var(--border-mid);
  box-shadow: var(--shadow-2);
}
.stat-tile .label {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.7rem; font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}
.stat-tile .value {
  font-family: var(--font-mono);
  font-size: 1.55rem; font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.stat-tile .value.mono-sm { font-size: 1.25rem; }
.stat-tile .sub {
  margin-top: 0.3rem;
  font-size: 0.72rem;
  color: var(--text-3);
  font-family: var(--font-mono);
}
.stat-tile .glyph { position: absolute; right: 0.85rem; top: 0.85rem; font-size: 1.05rem; opacity: 0.55; }
/* FIX-2026-08-01: alias classes tile-label/tile-sub/tile-value (ใช้ใน pnl.js + bots.js fallback)
   — global rules (นอกเหนือจาก .bot-card-v2 scope ที่มีอยู่แล้ว)
   ทำให้ PnL stat tile แสดงผลถูกต้องแม้ใช้ className ตรง ไม่ใช่ .label/.sub */
.stat-tile .tile-label {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.7rem; font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}
.stat-tile .tile-value {
  font-family: var(--font-mono);
  font-size: 1.55rem; font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.stat-tile .tile-sub {
  margin-top: 0.3rem;
  font-size: 0.72rem;
  color: var(--text-3);
  font-family: var(--font-mono);
}
.stat-tile.is-bull {
  /* FIX-2026-08-01: เพิ่ม gradient bg + accent border (อ่านง่ายขึ้นว่าเป็นกำไร) */
  background: linear-gradient(135deg, rgba(0,229,184,0.16) 0%, rgba(0,229,184,0.04) 60%, var(--bg-3) 100%);
  border-color: rgba(0,229,184,0.45);
}
.stat-tile.is-bull .value { color: var(--bull-1); text-shadow: 0 0 20px rgba(0,229,184,0.4); }
.stat-tile.is-bear {
  /* FIX-2026-08-01: gradient bg + accent border (ขาดทุน — แดงชัดเจน) */
  background: linear-gradient(135deg, rgba(255,77,109,0.16) 0%, rgba(255,77,109,0.04) 60%, var(--bg-3) 100%);
  border-color: rgba(255,77,109,0.45);
}
.stat-tile.is-bear .value { color: var(--bear-1); text-shadow: 0 0 20px rgba(255,77,109,0.4); }
.stat-tile.is-gold {
  /* FIX-2026-08-01: gradient bg + accent border (กลางๆ — Win Rate / Total PnL เมื่อเป็น 0) */
  background: linear-gradient(135deg, rgba(245,184,0,0.14) 0%, rgba(245,184,0,0.03) 60%, var(--bg-3) 100%);
  border-color: rgba(245,184,0,0.4);
}
.stat-tile.is-gold .value { color: var(--gold-1); text-shadow: 0 0 20px rgba(245,184,0,0.35); }
.stat-tile.is-info .value { color: var(--info-1); }
.stat-tile.is-violet .value { color: var(--violet-1); }
/* FIX-2026-08-01: เพิ่ม .is-flat สำหรับ PnL รวมที่เป็น 0 (อยู่กลางๆ ไม่ใช่ทอง) */
.stat-tile.is-flat {
  background: linear-gradient(135deg, rgba(125,158,196,0.12) 0%, rgba(125,158,196,0.03) 60%, var(--bg-3) 100%);
  border-color: rgba(125,158,196,0.35);
}
.stat-tile.is-bull:hover { box-shadow: 0 6px 22px -8px rgba(0,229,184,0.4), var(--shadow-2); }
.stat-tile.is-bear:hover { box-shadow: 0 6px 22px -8px rgba(255,77,109,0.4), var(--shadow-2); }
.stat-tile.is-gold:hover { box-shadow: 0 6px 22px -8px rgba(245,184,0,0.4), var(--shadow-2); }
.stat-tile.is-flat .value { color: var(--text-2); }
/* FIX-2026-08-01: top-edge accent bar (ดูเร็วขึ้นว่า tile ไหน bull/bear) */
.stat-tile.is-bull::before,
.stat-tile.is-bear::before,
.stat-tile.is-gold::before {
  content: '';
  position: absolute; left: 0; right: 0; top: 0; height: 3px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.stat-tile.is-bull::before { background: linear-gradient(90deg, transparent, var(--bull-1), transparent); }
.stat-tile.is-bear::before { background: linear-gradient(90deg, transparent, var(--bear-1), transparent); }
.stat-tile.is-gold::before { background: linear-gradient(90deg, transparent, var(--gold-1), transparent); }
/* FIX-2026-08-01: THB sub-line (ไอคอน + สีจาง แยกจาก sub line เดิม) */
.stat-tile .sub-thb {
  margin-top: 0.18rem; font-size: 0.68rem;
  color: var(--text-3); font-family: var(--font-mono);
  letter-spacing: 0.02em;
  display: flex; align-items: center; gap: 0.25rem;
}
.stat-tile.is-bull .sub-thb { color: rgba(0,229,184,0.75); }
.stat-tile.is-bear .sub-thb { color: rgba(255,77,109,0.75); }
.stat-tile.is-gold .sub-thb { color: rgba(245,184,0,0.75); }
.stat-tile .spark { margin-top: 0.45rem; }

/* 2026-07-30: clickable stat tile (เปิด modal) — distinct hover เด่นขึ้นกว่า tile ปกติ */
.stat-tile.is-clickable { cursor: pointer; user-select: none; }
.stat-tile.is-clickable:hover {
  transform: translateY(-2px);
  border-color: var(--gold-1);
  box-shadow: 0 6px 22px -6px rgba(245,184,0,0.30), var(--shadow-2);
}
.stat-tile.is-clickable:active { transform: translateY(0); }


/* sparkline */
.spark svg { width: 100%; height: 36px; display: block; }
.spark path.line { fill: none; stroke-width: 1.6; }
.spark path.area { stroke: none; opacity: 0.18; }

/* ============================================================
   PnL
   ============================================================ */
.pnl-positive, .pnl-bull { color: var(--bull-1) !important; font-weight: 600; }
.pnl-negative, .pnl-bear { color: var(--bear-1) !important; font-weight: 600; }

/* THB equivalent (smaller text under USDT value) */
.thb-eq {
  display: inline-block;
  margin-left: 0.45rem;
  font-size: 0.78em;
  font-weight: 500;
  color: var(--text-3);
  opacity: 0.85;
  letter-spacing: 0.02em;
}
.pnl-warn { color: var(--warn-1) !important; font-weight: 600; }

/* ============================================================
   STATUS PILLS
   ============================================================ */
.status-pill {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-size: 0.7rem; font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid transparent;
  white-space: nowrap;
  background: rgba(148,163,184,0.10);
  color: var(--text-3);
  border-color: rgba(148,163,184,0.25);
}
.status-pill::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}
.status-pill.is-idle       { background: rgba(148,163,184,0.10); color: var(--text-3); border-color: rgba(148,163,184,0.25); }
.status-pill.is-disabled   { background: rgba(148,163,184,0.10); color: var(--text-3); border-color: rgba(148,163,184,0.25); }
.status-pill.is-waiting_fill,
.status-pill.is-retrying,
.status-pill.is-placed     { background: rgba(255,181,71,0.12); color: var(--warn-1); border-color: rgba(255,181,71,0.30); }
.status-pill.is-holding,
.status-pill.is-selling,
.status-pill.is-filled     { background: rgba(93,196,255,0.12); color: var(--info-1); border-color: rgba(93,196,255,0.30); }
.status-pill.is-sold,
.status-pill.is-success,
.status-pill.is-detected   { background: rgba(0,229,184,0.12); color: var(--bull-1); border-color: rgba(0,229,184,0.30); }
.status-pill.is-failed,
.status-pill.is-error      { background: rgba(255,77,109,0.12); color: var(--bear-1); border-color: rgba(255,77,109,0.30); }
.status-pill.is-cancelled,
.status-pill.is-expired,
.status-pill.is-skipped,
.status-pill.is-order_placed { background: rgba(167,139,250,0.12); color: var(--violet-1); border-color: rgba(167,139,250,0.30); }

/* ============================================================
   HEARTBEAT
   ============================================================ */
.heartbeat-bar {
  display: flex; flex-wrap: wrap; gap: 0.45rem;
  padding: 0.65rem 0.85rem;
  background: linear-gradient(180deg, var(--bg-2), var(--bg-3));
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  align-items: center;
}
.heartbeat-pill {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.32rem 0.7rem;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  font-size: 0.78rem;
  color: var(--text-2);
  transition: all 0.2s;
  white-space: nowrap;
}
.heartbeat-pill:hover { background: rgba(255,255,255,0.04); }
.heartbeat-pill .hb-dot {
  display: inline-block; width: 9px; height: 9px;
  border-radius: 50%; background: var(--text-4);
}
.heartbeat-pill .hb-icon { font-size: 0.85rem; opacity: 0.8; }
.heartbeat-pill .hb-label { font-family: var(--font-mono); font-size: 0.75rem; }
.heartbeat-pill.is-ok { border-color: rgba(0,229,184,0.30); color: var(--bull-1); }
.heartbeat-pill.is-ok .hb-dot { background: var(--bull-1); animation: pulse-bull 2s infinite; }
.heartbeat-pill.is-warning { border-color: rgba(255,181,71,0.30); color: var(--warn-1); }
.heartbeat-pill.is-warning .hb-dot { background: var(--warn-1); }
.heartbeat-pill.is-error { border-color: rgba(255,77,109,0.30); color: var(--bear-1); }
.heartbeat-pill.is-error .hb-dot { background: var(--bear-1); animation: pulse-bear 1s infinite; }

.heartbeat-meta {
  margin-left: auto;
  display: flex; flex-direction: column;
  align-items: flex-end; gap: 0.1rem;
  font-size: 0.7rem;
  color: var(--text-3);
  font-family: var(--font-mono);
}
.heartbeat-meta .uptime strong { color: var(--text-1); }

/* ============================================================
   BOT CARDS (list)
   ============================================================ */
.bot-card {
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-3) 100%);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem;
  margin-bottom: 0.75rem;
  position: relative;
  overflow: hidden;
  transition: all 0.18s;
}
.bot-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--text-4);
  transition: background 0.2s;
}
.bot-card.enabled::before { background: var(--bull-1); box-shadow: 0 0 12px var(--bull-glow); }
.bot-card.error::before { background: var(--bear-1); box-shadow: 0 0 12px var(--bear-glow); }
.bot-card.holding::before,
.bot-card.selling::before,
.bot-card.waiting_fill::before { background: var(--warn-1); box-shadow: 0 0 12px rgba(255,181,71,0.35); }

.bot-card:hover {
  border-color: var(--border-mid);
  transform: translateY(-1px);
  box-shadow: var(--shadow-2);
}

.bot-card .row1 {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  align-items: center; justify-content: space-between;
  margin-bottom: 0.5rem;
}
.bot-card .row1 .left { display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap; min-width: 0; }
.bot-card .name { font-weight: 700; font-size: 1.05rem; color: var(--text-1); letter-spacing: -0.005em; }
.bot-card .sym-tag {
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 600;
  padding: 0.2rem 0.5rem; background: rgba(93,196,255,0.10);
  color: var(--info-1); border: 1px solid rgba(93,196,255,0.25); border-radius: 6px;
}
.bot-card .tf-tag {
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 600;
  padding: 0.2rem 0.5rem; background: rgba(167,139,250,0.10);
  color: var(--violet-1); border: 1px solid rgba(167,139,250,0.25); border-radius: 6px;
}
.bot-card .row1 .right { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.bot-card .row2 {
  display: flex; flex-wrap: wrap; gap: 0.45rem 1rem;
  font-size: 0.8rem; color: var(--text-2);
  font-family: var(--font-mono);
}
.bot-card .row2 .pair span:first-child { color: var(--text-3); margin-right: 0.3rem; }
.bot-card .row2 .pair strong { color: var(--text-1); font-weight: 600; }
.bot-card .last-err {
  margin-top: 0.5rem; font-size: 0.78rem; color: var(--bear-1);
  font-family: var(--font-mono); padding: 0.4rem 0.55rem;
  background: rgba(255,77,109,0.06); border-radius: 6px;
  border-left: 2px solid var(--bear-1);
}

/* ============================================================
   BOT CARDS v2 — clearer layout, EMA20 indicator, active highlight
   (FIX-2026-07-23: redesign ของบอร์ดการ์ด)
   ============================================================ */
.bot-card-v2 {
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-3) 100%);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem 0.75rem;
  margin-bottom: 0.85rem;
  position: relative;
  overflow: hidden;
  transition: all 0.18s ease;
}
/* prominent left accent bar — เด่นขึ้นกว่า v1 */
.bot-card-v2::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--text-4);
  transition: background 0.2s, box-shadow 0.2s;
}
/* running: green accent + glow */
.bot-card-v2.is-running::before {
  background: var(--bull-1);
  box-shadow: 0 0 14px var(--bull-glow);
}
/* disabled: dimmed — เห็นชัดว่าปิดอยู่ */
.bot-card-v2.is-disabled {
  opacity: 0.62;
  filter: saturate(0.55);
}
.bot-card-v2.is-disabled::before {
  background: var(--text-4);
  box-shadow: none;
}
/* has-position: orange/gold accent — บอทกำลังถือ position */
.bot-card-v2.has-position::before {
  background: var(--warn-1);
  box-shadow: 0 0 16px rgba(255,181,71,0.55);
}
.bot-card-v2.has-position {
  border-color: rgba(255,181,71,0.35);
  box-shadow: 0 0 0 1px rgba(255,181,71,0.12), 0 2px 12px rgba(255,181,71,0.10);
}
/* has-error: red accent */
.bot-card-v2.has-error::before {
  background: var(--bear-1);
  box-shadow: 0 0 14px var(--bear-glow);
}
.bot-card-v2.has-error {
  border-color: rgba(255,77,109,0.30);
}

.bot-card-v2:hover {
  border-color: var(--border-mid);
  transform: translateY(-1px);
  box-shadow: var(--shadow-2);
}

/* ── Header: name + meta + run/stop badge ─────────── */
.bot-card-v2 .bc-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 0.6rem; margin-bottom: 0.7rem;
}
.bot-card-v2 .bc-head-left { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; flex: 1; }
.bot-card-v2 .bc-title {
  font-weight: 700; font-size: 1.08rem; color: var(--text-1);
  letter-spacing: -0.005em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bot-card-v2 .bc-meta { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
.bot-card-v2 .sym-tag {
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 600;
  padding: 0.2rem 0.5rem; background: rgba(93,196,255,0.10);
  color: var(--info-1); border: 1px solid rgba(93,196,255,0.25); border-radius: 6px;
}
.bot-card-v2 .tf-tag {
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 600;
  padding: 0.2rem 0.5rem; background: rgba(167,139,250,0.10);
  color: var(--violet-1); border: 1px solid rgba(167,139,250,0.25); border-radius: 6px;
}
.bot-card-v2 .bc-head-right { flex-shrink: 0; }

/* ── RUNNING / STOPPED badge — เด่นมาก ──────────── */
.bot-card-v2 .run-badge {
  display: inline-flex; align-items: center;
  font-family: var(--font-mono); font-size: 0.74rem; font-weight: 700;
  padding: 0.32rem 0.7rem; border-radius: 999px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.bot-card-v2 .run-badge.on {
  background: rgba(0,229,184,0.14);
  color: var(--bull-1);
  border: 1px solid rgba(0,229,184,0.40);
  box-shadow: 0 0 12px rgba(0,229,184,0.30);
}
.bot-card-v2 .run-badge.off {
  background: rgba(148,163,184,0.10);
  color: var(--text-3);
  border: 1px solid rgba(148,163,184,0.25);
}

/* ── 6 Tiles (3×2): Price/EMA | Active | Today PnL | Min-%KC | TP แนะนำ | 24h vol ─────── */
.bot-card-v2 .bc-tiles {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1.1fr;
  grid-template-rows: auto auto;
  gap: 0.55rem;
  margin-bottom: 0.7rem;
}
.bot-card-v2 .bc-tile {
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 0.6rem 0.7rem;
  display: flex; flex-direction: column; gap: 0.2rem;
  min-height: 76px;
  position: relative;
  transition: border-color 0.2s, background 0.2s;
}
/* Tile EMA — color flips based on emaState */
.bot-card-v2 .bc-tile-ema.ema-above {
  border-color: rgba(0,229,184,0.32);
  background: rgba(0,229,184,0.04);
}
.bot-card-v2 .bc-tile-ema.ema-below {
  border-color: rgba(255,77,109,0.32);
  background: rgba(255,77,109,0.04);
}
.bot-card-v2 .bc-tile-ema.ema-warmup {
  border-color: rgba(148,163,184,0.25);
  background: rgba(148,163,184,0.04);
}
/* Active tile — highlight เมื่อมี position */
.bot-card-v2 .bc-tile-active.has-active {
  border-color: rgba(255,181,71,0.45);
  background: rgba(255,181,71,0.07);
  box-shadow: inset 0 0 0 1px rgba(255,181,71,0.10);
}
/* 2026-07-31: Min-%KC tile — highlight เมื่อ < 1.2% (warn: TP แนะนำจะน้อย / bot อาจ trade ถี่เกินไป) */
.bot-card-v2 .bc-tile-kcmin.is-low {
  border-color: rgba(245,184,0,0.55);
  background: rgba(245,184,0,0.08);
  box-shadow: inset 0 0 0 1px rgba(245,184,0,0.12);
}
.bot-card-v2 .bc-tile-kcmin.is-low .tile-value { color: #f5b800; }
/* 2026-07-31: TP แนะนำ tile — ใช้ border ปกติ, is-floor ใช้สี warn (เหมือน badge ใน stats) */
.bot-card-v2 .bc-tile-tpsugg.is-floor {
  border-color: rgba(245,184,0,0.55);
  background: rgba(245,184,0,0.08);
}
/* 2026-07-31: 24h vol tile — highlight เมื่อ < 1,000,000 USDT (warn: liquidity ต่ำ / slippage เสี่ยง) */
.bot-card-v2 .bc-tile-vol24h.is-low {
  border-color: rgba(245,184,0,0.55);
  background: rgba(245,184,0,0.08);
  box-shadow: inset 0 0 0 1px rgba(245,184,0,0.12);
}
.bot-card-v2 .bc-tile-vol24h.is-low .tile-value { color: #f5b800; }

.bot-card-v2 .tile-label {
  font-size: 0.68rem; color: var(--text-3); text-transform: uppercase;
  letter-spacing: 0.04em; font-weight: 600;
}
.bot-card-v2 .tile-value {
  font-family: var(--font-mono); font-size: 1.18rem; font-weight: 700;
  color: var(--text-1); line-height: 1.15;
}
.bot-card-v2 .tile-value.pos-active {
  color: var(--warn-1);
}
.bot-card-v2 .tile-value.muted { color: var(--text-3); font-weight: 500; }
.bot-card-v2 .tile-sub {
  font-size: 0.72rem; color: var(--text-3);
  font-family: var(--font-mono);
}
.bot-card-v2 .tile-sub strong { font-weight: 700; }

/* ── Stats row (secondary) ─────────────────────── */
.bot-card-v2 .bc-stats {
  display: flex; flex-wrap: wrap; gap: 0.35rem 1rem;
  font-size: 0.78rem; color: var(--text-2);
  font-family: var(--font-mono);
  padding: 0.55rem 0;
  border-top: 1px dashed var(--border-soft);
  border-bottom: 1px dashed var(--border-soft);
  margin-bottom: 0.6rem;
}
.bot-card-v2 .bc-stats .stat { display: inline-flex; gap: 0.3rem; align-items: baseline; }
.bot-card-v2 .bc-stats .stat .lbl { color: var(--text-3); }
.bot-card-v2 .bc-stats .stat strong { color: var(--text-1); font-weight: 600; }

/* ── Error banner ──────────────────────────────── */
.bot-card-v2 .bc-err {
  margin-top: 0.5rem; margin-bottom: 0.55rem;
  font-size: 0.78rem; color: var(--bear-1);
  font-family: var(--font-mono); padding: 0.4rem 0.55rem;
  background: rgba(255,77,109,0.06); border-radius: 6px;
  border-left: 2px solid var(--bear-1);
  display: flex; align-items: center; gap: 0.5rem;
}
.bot-card-v2 .bc-err-msg {
  flex: 1; word-break: break-word; line-height: 1.45;
}
.bot-card-v2 .bc-err-dismiss {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid rgba(255,77,109,0.30);
  color: var(--bear-1);
  font-size: 1.05rem; line-height: 1; font-weight: 600;
  width: 22px; height: 22px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  transition: background 0.15s, transform 0.15s, border-color 0.15s;
}
.bot-card-v2 .bc-err-dismiss:hover {
  background: rgba(255,77,109,0.18);
  border-color: var(--bear-1);
  transform: scale(1.08);
}
.bot-card-v2 .bc-err-dismiss:active {
  transform: scale(0.92);
}
.bot-card-v2 .bc-err-dismiss:focus-visible {
  outline: 2px solid var(--bear-1);
  outline-offset: 2px;
}

/* ── Coin info chip (FIX-2026-08-01) ──────────── */
.bot-card-v2 .coin-chip {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-family: var(--font-mono); font-size: 0.72rem;
  padding: 0.16rem 0.5rem;
  border-radius: 999px;
  background: rgba(125, 158, 196, 0.08);
  border: 1px solid rgba(125, 158, 196, 0.25);
  color: var(--text-2);
  white-space: nowrap;
  cursor: default;
}
.bot-card-v2 .coin-chip:hover { border-color: rgba(125, 158, 196, 0.5); }
.bot-card-v2 .coin-chip-loading { color: var(--text-3); opacity: 0.7; }
.bot-card-v2 .coin-chip-sep { color: var(--text-3); opacity: 0.5; }
.bot-card-v2 .coin-chip .pct-up { color: var(--bull-1); font-weight: 600; }
.bot-card-v2 .coin-chip .pct-down { color: var(--bear-1); font-weight: 600; }
.bot-card-v2 .coin-chip strong { color: var(--text-1); font-weight: 600; }
/* FIX-2026-08-01: logo + full name (จาก BAPI marketing list) */
.bot-card-v2 .coin-chip-logo {
  width: 14px; height: 14px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  object-fit: cover; flex-shrink: 0;
}
.bot-card-v2 .coin-chip-fullname {
  color: var(--text-2); font-weight: 500;
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 0.7rem;
  max-width: 180px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap;
}

/* Coin info cell on scan-volatility table */
/* FIX-2026-08-01: ใช้ :is() รองรับทั้ง .scan-table และ .lux-table (กัน selector miss) */
.scan-table .coin-info-cell,
.lux-table .coin-info-cell {
  display: flex; flex-direction: column; gap: 0.15rem;
  font-size: 0.75rem;
}
.scan-table .coin-info-cell .coin-status,
.lux-table .coin-info-cell .coin-status { font-weight: 600; }
.scan-table .coin-info-cell .coin-status.is-trading,
.lux-table .coin-info-cell .coin-status.is-trading { color: var(--bull-1); }
.scan-table .coin-info-cell .coin-status.is-break,
.lux-table .coin-info-cell .coin-status.is-break { color: var(--bull-3, #ffb547); }
.scan-table .coin-info-cell .coin-status.is-halt,
.lux-table .coin-info-cell .coin-status.is-halt { color: var(--bear-1); }
.scan-table .coin-info-cell .coin-meta,
.lux-table .coin-info-cell .coin-meta { color: var(--text-3); font-size: 0.7rem; font-family: var(--font-mono); }
.scan-table .coin-info-cell .coin-pct,
.lux-table .coin-info-cell .coin-pct { font-family: var(--font-mono); font-weight: 600; }
.scan-table .coin-info-cell .coin-pct.pct-up,
.lux-table .coin-info-cell .coin-pct.pct-up { color: var(--bull-1); }
.scan-table .coin-info-cell .coin-pct.pct-down,
.lux-table .coin-info-cell .coin-pct.pct-down { color: var(--bear-1); }
/* FIX-2026-08-01: logo + fullName (จาก BAPI marketing list) */
.scan-table .coin-info-cell .coin-cell-logo,
.lux-table .coin-info-cell .coin-cell-logo {
  /* FIX-2026-08-01: ลดขนาดให้เล็กลง + max-width กันโหลดช้าแล้วขยายเป็นรูปใหญ่
     + display:inline-block กัน baseline alignment กระตุก + min-width:0 กัน flex expand */
  display: inline-block;
  width: 14px !important; height: 14px !important;
  max-width: 14px !important; max-height: 14px !important;
  min-width: 0 !important; min-height: 0 !important;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  object-fit: cover; flex-shrink: 0; flex-grow: 0;
  vertical-align: middle;
}
.scan-table .coin-info-cell .coin-cell-row1,
.lux-table .coin-info-cell .coin-cell-row1 {
  display: inline-flex; align-items: center; gap: 0.35rem;
}
.scan-table .coin-info-cell .coin-cell-row2 strong,
.lux-table .coin-info-cell .coin-cell-row2 strong {
  color: var(--text-1); font-family: var(--font-mono); font-size: 0.78rem;
}
.scan-table .coin-info-cell .coin-cell-fullname,
.lux-table .coin-info-cell .coin-cell-fullname {
  color: var(--text-2); font-size: 0.68rem;
  font-family: var(--font-sans, system-ui, sans-serif);
  max-width: 220px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; display: inline-block; vertical-align: bottom;
}
.scan-table .coin-info-cell .coin-cell-row3,
.lux-table .coin-info-cell .coin-cell-row3 { color: var(--text-3); font-size: 0.68rem; font-family: var(--font-mono); }
.scan-table .coin-info-cell .coin-cell-row4,
.lux-table .coin-info-cell .coin-cell-row4 { font-family: var(--font-mono); }

/* FIX-2026-08-01: mobile — ลด font + ตัด cell ให้แคบลง กันโลโก้+ข้อความล้น row
   - บน mobile row เตี้ย logo 12px + fullName max-width 120px + ลด font */
@media (max-width: 640px) {
  .scan-table .coin-info-cell,
  .lux-table .coin-info-cell {
    gap: 0.08rem;
  }
  .scan-table .coin-info-cell .coin-cell-logo,
  .lux-table .coin-info-cell .coin-cell-logo {
    width: 12px !important; height: 12px !important;
    max-width: 12px; max-height: 12px;
  }
  .scan-table .coin-info-cell .coin-cell-row2 strong,
  .lux-table .coin-info-cell .coin-cell-row2 strong { font-size: 0.7rem; }
  .scan-table .coin-info-cell .coin-cell-fullname,
  .lux-table .coin-info-cell .coin-cell-fullname {
    max-width: 120px; font-size: 0.62rem;
  }
  .scan-table .coin-info-cell .coin-cell-row3,
  .scan-table .coin-info-cell .coin-cell-row4,
  .lux-table .coin-info-cell .coin-cell-row3,
  .lux-table .coin-info-cell .coin-cell-row4 { font-size: 0.62rem; }
  .scan-table .coin-info-cell .coin-status,
  .lux-table .coin-info-cell .coin-status { font-size: 0.65rem; }
}
/* FIX-2026-08-01: tablet — ขนาดกลาง */
@media (max-width: 900px) and (min-width: 641px) {
  .scan-table .coin-info-cell .coin-cell-fullname,
  .lux-table .coin-info-cell .coin-cell-fullname { max-width: 160px; }
}
/* FIX-2026-08-01: 1h latched alerts (e.g. SELL partial-fill no-progress >1h)
   orange/amber accent — softer than error, still actionable */
.bot-card-v2.has-warning::before {
  background: var(--bull-3, #ffb547);
  box-shadow: 0 0 14px rgba(255,181,71,0.45);
}
.bot-card-v2.has-warning {
  border-color: rgba(255,181,71,0.35);
}
.bot-card-v2 .bc-warn {
  margin-top: 0.5rem; margin-bottom: 0.55rem;
  font-size: 0.78rem; color: var(--bull-3, #ffb547);
  font-family: var(--font-mono); padding: 0.4rem 0.55rem;
  background: rgba(255,181,71,0.06); border-radius: 6px;
  border-left: 2px solid var(--bull-3, #ffb547);
  display: flex; align-items: center; gap: 0.5rem;
}
.bot-card-v2 .bc-warn-msg {
  flex: 1; word-break: break-word; line-height: 1.45;
}
.bot-card-v2 .bc-warn-dismiss {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid rgba(255,181,71,0.30);
  color: var(--bull-3, #ffb547);
  font-size: 1.05rem; line-height: 1; font-weight: 600;
  width: 22px; height: 22px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  transition: background 0.15s, transform 0.15s, border-color 0.15s;
}
.bot-card-v2 .bc-warn-dismiss:hover {
  background: rgba(255,181,71,0.18);
  border-color: var(--bull-3, #ffb547);
  transform: scale(1.08);
}
.bot-card-v2 .bc-warn-dismiss:active {
  transform: scale(0.92);
}
.bot-card-v2 .bc-warn-dismiss:focus-visible {
  outline: 2px solid var(--bull-3, #ffb547);
  outline-offset: 2px;
}

/* ── Action bar ───────────────────────────────── */
.bot-card-v2 .bc-actions {
  display: flex; gap: 0.4rem; flex-wrap: wrap;
  padding-top: 0.45rem;
}

/* responsive: เปลี่ยน tile layout เป็น 1 col บนจอเล็ก */
@media (max-width: 768px) {
  .bot-card-v2 .bc-tiles {
    grid-template-columns: 1fr;
  }
  .bot-card-v2 .bc-tile { min-height: 0; padding: 0.5rem 0.6rem; }
  .bot-card-v2 .tile-value { font-size: 1.05rem; }
}

/* ── FIX-2026-07-31: Compact view mode (ซ่อน mini-chart + tiles) ───────── */
.bot-card-v2.is-compact .bc-minichart-wrap { display: none !important; }
.bot-card-v2.is-compact .bc-tiles { display: none !important; }
.bot-card-v2.is-compact { padding: 0.7rem 0.85rem; }
.bot-card-v2.is-compact .bc-head { margin-bottom: 0.45rem; }
.bot-card-v2.is-compact .bc-stats { margin-top: 0.4rem; padding-top: 0.4rem; border-top: 1px solid rgba(255,255,255,0.04); }

/* ── FIX-2026-07-31: View mode segmented control (Compact / Expand) ───────── */
.view-mode-toggle { display: inline-flex; }
.view-mode-toggle .btn {
  border-color: rgba(241,194,82,0.45);
  color: var(--text-2);
  background: rgba(255,255,255,0.02);
  font-size: 0.78rem;
  padding: 0.32rem 0.7rem;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.view-mode-toggle .btn:first-child { border-radius: 7px 0 0 7px; }
.view-mode-toggle .btn:last-child { border-radius: 0 7px 7px 0; }
.view-mode-toggle .btn + .btn { margin-left: -1px; }
.view-mode-toggle .btn:hover {
  background: rgba(241,194,82,0.08);
  color: var(--gold);
  border-color: rgba(241,194,82,0.6);
}
.view-mode-toggle .btn.is-active {
  background: linear-gradient(180deg, rgba(241,194,82,0.22), rgba(241,194,82,0.12));
  color: var(--gold);
  border-color: rgba(241,194,82,0.85);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(241,194,82,0.3);
}
.view-mode-toggle .btn.is-active:hover { background: linear-gradient(180deg, rgba(241,194,82,0.28), rgba(241,194,82,0.16)); }

/* ── FIX-2026-07-31: Multi-bot backtest per-bot toggles ───────── */
.mb-toggles {
  display: inline-flex;
  gap: 0.3rem;
  align-items: center;
  flex-wrap: wrap;
  font-size: 0.72rem;
}
.mb-toggle {
  display: inline-flex; align-items: center; gap: 0.2rem;
  padding: 0.18rem 0.45rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(148,163,184,0.22);
  border-radius: 5px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.mb-toggle:hover { background: rgba(255,255,255,0.06); }
.mb-toggle input[type="checkbox"] {
  width: 12px; height: 12px;
  margin: 0;
  accent-color: var(--gold);
  cursor: pointer;
}
.mb-toggle:has(input:checked) {
  background: rgba(241,194,82,0.12);
  border-color: rgba(241,194,82,0.5);
  color: var(--gold);
  font-weight: 600;
}
.mb-toggles-head {
  font-size: 0.72rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── FIX-2026-07-31: Per-bot toggle badges (XS1 / CB / SL-UKC) ในผลลัพธ์ ───────── */
.mb-toggle-badge {
  display: inline-block;
  font-size: 0.62rem;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  margin-left: 0.25rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  vertical-align: middle;
}
.mb-toggle-badge.is-on {
  background: rgba(241,194,82,0.16);
  color: var(--gold);
  border: 1px solid rgba(241,194,82,0.45);
}
.mb-toggle-badge.is-off {
  background: rgba(148,163,184,0.08);
  color: var(--text-3);
  border: 1px solid rgba(148,163,184,0.18);
  opacity: 0.7;
}
.mb-badges { margin-top: 0.25rem; }

/* compact action button */
.btn-lux {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.32rem 0.7rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-mid);
  border-radius: 7px;
  color: var(--text-2); font-size: 0.78rem; font-weight: 500;
  cursor: pointer; transition: all 0.15s; text-decoration: none;
}
.btn-lux:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text-1); border-color: var(--border-strong); text-decoration: none;
}
.btn-lux.btn-gold { border-color: rgba(245,184,0,0.35); color: var(--gold-2); background: rgba(245,184,0,0.08); }
.btn-lux.btn-gold:hover { background: rgba(245,184,0,0.18); border-color: rgba(245,184,0,0.55); color: var(--gold-2); box-shadow: 0 0 0 3px rgba(245,184,0,0.10); }
.btn-lux.btn-bull { border-color: rgba(0,229,184,0.35); color: var(--bull-1); background: rgba(0,229,184,0.08); }
.btn-lux.btn-bull:hover { background: rgba(0,229,184,0.18); border-color: rgba(0,229,184,0.55); }
.btn-lux.btn-bear { border-color: rgba(255,77,109,0.35); color: var(--bear-1); background: rgba(255,77,109,0.08); }
.btn-lux.btn-bear:hover { background: rgba(255,77,109,0.18); border-color: rgba(255,77,109,0.55); }
.btn-lux.btn-info { border-color: rgba(93,196,255,0.35); color: var(--info-1); background: rgba(93,196,255,0.08); }
.btn-lux.btn-info:hover { background: rgba(93,196,255,0.18); border-color: rgba(93,196,255,0.55); color: var(--info-1); }
.btn-lux.btn-ghost { border-color: transparent; background: transparent; }
.btn-lux.btn-sm { padding: 0.22rem 0.55rem; font-size: 0.74rem; }
.btn-lux:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============================================================
   PASSWORD & SESSIONS MANAGER (2026-08-09)
   ============================================================ */
.session-row {
  padding: 0.85rem 1rem;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: rgba(255,255,255,0.02);
  margin-bottom: 0.6rem;
  transition: border-color 0.15s, background 0.15s;
}
.session-row:hover { border-color: var(--border-mid); background: rgba(255,255,255,0.03); }
.session-row.is-current {
  border-color: rgba(0,229,184,0.30);
  background: linear-gradient(135deg, rgba(0,229,184,0.05), rgba(0,229,184,0.01));
}
.session-row .badge { font-weight: 500; font-size: 0.72rem; }

/* FIX-2026-08-09: attempt-row (Failed Logins tab) — mirror session-row but with subtle warning tint */
.attempt-row {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  margin-bottom: 0.5rem;
  background: rgba(255, 80, 80, 0.03);
  transition: border-color 0.15s, background 0.15s;
}
.attempt-row:hover { border-color: rgba(255, 80, 80, 0.30); background: rgba(255, 80, 80, 0.06); }
.attempt-row .badge { font-weight: 500; font-size: 0.72rem; }
/* FIX-2026-08-10: attempted password display (click-to-reveal) */
.attempt-row .attempt-pw {
  background: rgba(0, 0, 0, 0.18);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85rem;
  color: var(--text-1);
}
.attempt-row .toggle-pw-btn {
  font-size: 0.75rem;
  padding: 0.1rem 0.35rem;
  line-height: 1;
}

/* ============================================================
   TABLES
   ============================================================ */
.lux-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.85rem; color: var(--text-1); }
.lux-table thead th {
  position: sticky; top: 0; z-index: 1;
  background: rgba(7,11,20,0.92);
  backdrop-filter: blur(8px);
  font-size: 0.68rem; font-weight: 700;
  color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em;
  padding: 0.65rem 0.85rem; text-align: left;
  border-bottom: 1px solid var(--border-soft); white-space: nowrap;
}
.lux-table tbody td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border-soft);
  font-family: var(--font-mono); font-size: 0.82rem;
  color: var(--text-2); white-space: nowrap;
}
.lux-table tbody tr:hover td { background: rgba(255,255,255,0.02); color: var(--text-1); }
.lux-table tbody tr:last-child td { border-bottom: none; }
.lux-table td .ts { color: var(--text-3); font-size: 0.74rem; }
.lux-table td.code { font-size: 0.74rem; color: var(--text-3); }
.lux-table td.num { text-align: right; }
.lux-table td.center { text-align: center; }
.lux-table td.empty { text-align: center; color: var(--text-4); padding: 2.5rem 1rem; font-family: var(--font-sans); }

/* Sortable column headers — click to toggle direction */
.lux-table thead th.sortable {
  cursor: pointer;
  user-select: none;
  transition: background-color 80ms ease, color 80ms ease;
}
.lux-table thead th.sortable:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-1);
}
.lux-table thead th.sortable.is-active {
  color: var(--gold-1);
}
.lux-table thead th.sortable .sort-arrow {
  display: inline-block;
  margin-left: 0.3rem;
  font-size: 0.7rem;
  color: var(--text-3);
  vertical-align: middle;
}
.lux-table thead th.sortable.is-active .sort-arrow {
  color: var(--gold-1);
}
.lux-table thead th.sortable .col-help {
  vertical-align: middle;
}
.lux-table-wrap { max-height: 70vh; overflow: auto; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

/* ============================================================
   BUTTONS / INPUTS (Bootstrap overrides)
   ============================================================ */
.btn { font-weight: 500; border-radius: 8px; padding: 0.45rem 0.95rem; font-size: 0.88rem; border: 1px solid transparent; transition: all 0.15s; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(245,184,0,0.30); }
.btn-primary { background: linear-gradient(180deg, var(--gold-1), #d49d00); border-color: rgba(0,0,0,0.25); color: #1a1208; font-weight: 600; box-shadow: 0 4px 14px rgba(245,184,0,0.25); }
.btn-primary:hover { background: linear-gradient(180deg, var(--gold-2), var(--gold-1)); color: #1a1208; box-shadow: 0 6px 18px rgba(245,184,0,0.35); }
.btn-secondary { background: rgba(255,255,255,0.04); border-color: var(--border-mid); color: var(--text-2); }
.btn-secondary:hover { background: rgba(255,255,255,0.08); color: var(--text-1); border-color: var(--border-strong); }
.btn-success { background: linear-gradient(180deg, var(--bull-1), var(--bull-2)); border-color: rgba(0,0,0,0.25); color: #002a1f; font-weight: 600; }
.btn-success:hover { background: linear-gradient(180deg, #34f0c5, var(--bull-1)); color: #002a1f; }
.btn-warning { background: linear-gradient(180deg, var(--warn-1), #d68f25); color: #2b1900; font-weight: 600; border-color: rgba(0,0,0,0.25); }
.btn-warning:hover { background: linear-gradient(180deg, #ffc46e, var(--warn-1)); color: #2b1900; }
.btn-danger { background: linear-gradient(180deg, var(--bear-1), var(--bear-2)); border-color: rgba(0,0,0,0.25); color: #2b0008; font-weight: 600; }
.btn-danger:hover { background: linear-gradient(180deg, #ff7592, var(--bear-1)); color: #2b0008; }
.btn-outline-secondary { color: var(--text-2); border-color: var(--border-mid); }
.btn-outline-secondary:hover { background: rgba(255,255,255,0.06); color: var(--text-1); border-color: var(--border-strong); }
.btn-outline-primary { color: var(--gold-2); border-color: rgba(245,184,0,0.40); }
.btn-outline-primary:hover { background: rgba(245,184,0,0.10); color: var(--gold-2); border-color: rgba(245,184,0,0.65); }

.form-control, .form-select {
  background: rgba(7,11,20,0.55);
  border: 1px solid var(--border-mid);
  border-radius: 8px; color: var(--text-1);
  font-size: 0.9rem; padding: 0.5rem 0.75rem; transition: all 0.15s;
}
.form-control:focus, .form-select:focus {
  background: rgba(7,11,20,0.80);
  border-color: rgba(245,184,0,0.50); color: var(--text-1);
  box-shadow: 0 0 0 3px rgba(245,184,0,0.18);
}
.form-control::placeholder { color: var(--text-4); }
.form-select option { background: var(--bg-2); color: var(--text-1); }
.form-label { font-size: 0.8rem; font-weight: 600; color: var(--text-2); margin-bottom: 0.3rem; }
.form-text { color: var(--text-3); }
.form-check-input { background-color: var(--bg-3); border-color: var(--border-strong); }
.form-check-input:checked { background-color: var(--gold-1); border-color: var(--gold-1); }

.modal-content {
  background: linear-gradient(180deg, var(--bg-2), var(--bg-3));
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-lg); color: var(--text-1); box-shadow: var(--shadow-3);
}
.modal-header { border-bottom: 1px solid var(--border-soft); }
.modal-footer { border-top: 1px solid var(--border-soft); }
.modal-title { color: var(--text-1); font-weight: 700; }
.btn-close { filter: invert(0.85) brightness(1.4); opacity: 0.7; }
.btn-close:hover { opacity: 1; }

.alert { border-radius: 10px; border-width: 1px; font-size: 0.88rem; }
.alert-info { background: rgba(93,196,255,0.08); border-color: rgba(93,196,255,0.25); color: var(--info-1); }
.alert-warning { background: rgba(255,181,71,0.08); border-color: rgba(255,181,71,0.25); color: var(--warn-1); }
.alert-danger { background: rgba(255,77,109,0.08); border-color: rgba(255,77,109,0.25); color: var(--bear-1); }
.alert-success { background: rgba(0,229,184,0.08); border-color: rgba(0,229,184,0.25); color: var(--bull-1); }
.alert-secondary { background: rgba(148,163,184,0.08); border-color: rgba(148,163,184,0.20); color: var(--text-2); }

/* ============================================================
   LOGIN
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
  background:
    radial-gradient(800px 400px at 30% 20%, rgba(245,184,0,0.10), transparent 60%),
    radial-gradient(600px 400px at 70% 80%, rgba(0,229,184,0.08), transparent 60%),
    var(--bg-1);
}
.login-card {
  width: 100%; max-width: 420px;
  padding: 2rem;
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-3) 100%);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-3);
  position: relative; overflow: hidden;
}
.login-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-1), transparent);
}
.login-brand { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 1.5rem; }
.login-brand .login-logo {
  width: 44px; height: 44px;
  border-radius: 11px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.10), 0 8px 28px rgba(245,184,0,0.30);
  flex-shrink: 0;
}
.login-brand .name { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.01em; color: var(--text-1); }
.login-brand .name small { display: block; font-size: 0.72rem; font-weight: 500; color: var(--text-3); letter-spacing: 0.08em; text-transform: uppercase; }
.login-card h5 { color: var(--text-1); font-weight: 700; margin-bottom: 1rem; }
.login-foot { text-align: center; margin-top: 1.5rem; color: var(--text-3); font-size: 0.78rem; line-height: 1.6; }

/* ============================================================
   BOT DETAIL
   ============================================================ */
.bot-hero {
  position: relative; overflow: hidden;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(245,184,0,0.10) 0%, transparent 50%),
    linear-gradient(225deg, rgba(0,229,184,0.07) 0%, transparent 50%),
    linear-gradient(180deg, var(--bg-2) 0%, var(--bg-3) 100%);
  border: 1px solid var(--border-soft);
  padding: 1.5rem 1.75rem; margin-bottom: 1rem; box-shadow: var(--shadow-2);
}
.bot-hero::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent 10%, var(--gold-1) 50%, transparent 90%);
}
.bot-hero .bot-title {
  font-size: 1.85rem; font-weight: 800;
  letter-spacing: -0.02em; line-height: 1.1;
  color: var(--text-1); margin-bottom: 0.55rem; word-break: break-word;
}
.bot-hero .meta { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.85rem; }
.bot-hero .meta .chip {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.22rem 0.6rem; font-family: var(--font-mono);
  font-size: 0.74rem; font-weight: 600;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border-soft);
  border-radius: 999px; color: var(--text-2);
}
.bot-hero .meta .chip.gold { color: var(--gold-1); border-color: rgba(245,184,0,0.30); background: rgba(245,184,0,0.06); }
.bot-hero .meta .chip.bull { color: var(--bull-1); border-color: rgba(0,229,184,0.30); background: rgba(0,229,184,0.06); }
.bot-hero .meta .chip.violet { color: var(--violet-1); border-color: rgba(167,139,250,0.30); background: rgba(167,139,250,0.06); }
.bot-hero .actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

@media (min-width: 768px) {
  .bot-hero { display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: center; padding: 1.75rem 2rem; }
  .bot-hero .actions { justify-content: flex-end; }
}

/* hero status light */
.hero-light {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.4rem 0.85rem;
  background: rgba(0,229,184,0.10);
  border: 1px solid rgba(0,229,184,0.30);
  border-radius: 999px;
  font-size: 0.78rem; font-weight: 700;
  color: var(--bull-1); text-transform: uppercase; letter-spacing: 0.06em;
}
.hero-light .pulse {
  width: 10px; height: 10px; border-radius: 50%; background: var(--bull-1);
  animation: pulse-bull 1.6s infinite;
}
.hero-light.is-warning { background: rgba(255,181,71,0.10); border-color: rgba(255,181,71,0.30); color: var(--warn-1); }
.hero-light.is-warning .pulse { background: var(--warn-1); animation: none; }
.hero-light.is-error { background: rgba(255,77,109,0.10); border-color: rgba(255,77,109,0.30); color: var(--bear-1); }
.hero-light.is-error .pulse { background: var(--bear-1); animation: pulse-bear 1s infinite; }
.hero-light.is-idle { background: rgba(148,163,184,0.10); border-color: rgba(148,163,184,0.25); color: var(--text-3); }
.hero-light.is-idle .pulse { background: var(--text-4); animation: none; }

/* tabs */
.lux-tabs {
  display: flex; gap: 0.25rem; padding: 0.3rem;
  background: var(--bg-2);
  border: 1px solid var(--border-soft);
  border-radius: 10px; margin-bottom: 1rem;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.lux-tab {
  flex-shrink: 0;
  padding: 0.55rem 0.95rem;
  border-radius: 8px; font-size: 0.84rem; font-weight: 600;
  color: var(--text-3); cursor: pointer; transition: all 0.15s;
  border: none; background: transparent; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 0.4rem;
}
.lux-tab:hover { color: var(--text-1); background: rgba(255,255,255,0.04); }
.lux-tab.active {
  background: linear-gradient(180deg, rgba(245,184,0,0.18), rgba(245,184,0,0.08));
  color: var(--gold-2);
  box-shadow: inset 0 0 0 1px rgba(245,184,0,0.30), 0 4px 12px rgba(245,184,0,0.10);
}
.lux-tab .badge {
  font-size: 0.66rem; padding: 0.05rem 0.45rem;
  background: rgba(255,255,255,0.08); border-radius: 999px; color: var(--text-2);
}

/* detail grid */
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
@media (min-width: 992px) { .detail-grid { grid-template-columns: repeat(3, 1fr); } }
.detail-cell {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-soft);
  border-radius: 8px; padding: 0.65rem 0.85rem;
}
.detail-cell .k { font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); margin-bottom: 0.25rem; }
.detail-cell .v { font-family: var(--font-mono); font-size: 0.95rem; font-weight: 600; color: var(--text-1); word-break: break-word; }
.detail-cell .v.code { font-size: 0.78rem; color: var(--text-2); }
.detail-cell .v.small { font-size: 0.78rem; }
.detail-cell .v.error { color: var(--bear-1); }

/* active trade panel */
.trade-panel {
  background: linear-gradient(180deg, var(--bg-2), var(--bg-3));
  border: 1px solid rgba(245,184,0,0.25);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.25rem;
  position: relative; overflow: hidden;
}
.trade-panel.empty {
  border-color: var(--border-soft);
  text-align: center; color: var(--text-4);
  padding: 2.5rem 1rem;
}
.trade-panel .panel-title {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.85rem;
}
.trade-panel .panel-title .title { font-size: 0.74rem; font-weight: 700; color: var(--gold-1); text-transform: uppercase; letter-spacing: 0.08em; }
.trade-panel .row {
  display: flex; justify-content: space-between;
  font-family: var(--font-mono); font-size: 0.85rem;
  padding: 0.3rem 0; color: var(--text-2);
  border-bottom: 1px solid var(--border-soft);
}
.trade-panel .row:last-child { border-bottom: none; }
.trade-panel .row .k { color: var(--text-3); }
.trade-panel .row .v { color: var(--text-1); font-weight: 600; }

.retry-bar { display: flex; gap: 0.35rem; margin-top: 0.85rem; }
.retry-bar .seg {
  flex: 1; height: 8px; border-radius: 4px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border-soft);
}
.retry-bar .seg.used { background: var(--gold-1); border-color: rgba(245,184,0,0.50); box-shadow: 0 0 8px var(--gold-glow); }
.retry-bar .seg.active { background: rgba(245,184,0,0.35); border-color: var(--gold-1); animation: pulse-gold 1.2s infinite; }
@keyframes pulse-gold { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

/* signal timeline */
.signal-timeline { display: flex; flex-direction: column; gap: 0.4rem; }
.signal-row {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.65rem 0.85rem;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-soft);
  border-radius: 8px; font-family: var(--font-mono);
  font-size: 0.83rem; transition: background 0.15s;
  flex-wrap: wrap;
}
.signal-row:hover { background: rgba(255,255,255,0.04); }
.signal-row .type-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.signal-row .type-dot.bull { background: var(--bull-1); box-shadow: 0 0 8px var(--bull-glow); }
.signal-row .type-dot.bear { background: var(--bear-1); box-shadow: 0 0 8px var(--bear-glow); }
.signal-row .type-dot.neutral { background: var(--text-4); }
.signal-row .ts { color: var(--text-3); font-size: 0.72rem; min-width: 100px; }
.signal-row .price { color: var(--text-1); font-weight: 600; min-width: 90px; }
.signal-row .bg { color: var(--text-2); font-size: 0.75rem; }
.signal-row .note { color: var(--text-3); font-size: 0.72rem; flex: 1 1 100%; overflow: hidden; text-overflow: ellipsis; }
.signal-row .outcome { margin-left: auto; }

/* summary cards */
.summary-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; margin-bottom: 1rem; }
@media (min-width: 768px) { .summary-row { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 992px) { .summary-row { grid-template-columns: repeat(6, 1fr); } }

/* ============================================================
   MOBILE CARDS
   ============================================================ */
@media (max-width: 640px) {
  .mob-card-table { display: none; }
  .mob-card-list { display: block !important; }
}
@media (min-width: 641px) {
  .mob-card-list { display: none !important; }
}
.mob-card {
  padding: 0.85rem 1rem;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-soft);
  border-radius: 10px; margin-bottom: 0.55rem;
  font-family: var(--font-mono);
}
.mob-card .row { display: flex; justify-content: space-between; padding: 0.18rem 0; font-size: 0.8rem; }
.mob-card .row .k { color: var(--text-3); }
.mob-card .row .v { color: var(--text-1); font-weight: 600; }
.mob-card .top {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 0.45rem; padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--border-soft);
}

/* ============================================================
   UTILITIES
   ============================================================ */
.text-mono { font-family: var(--font-mono); }
.text-muted-2 { color: var(--text-3) !important; }
.text-muted-3 { color: var(--text-4) !important; }
/* FIX-2026-07-30: brighten description text — เดิมใช้ Bootstrap text-muted (#6c757d)
   บน dark mode ทำให้คำอธิบายฟังชั่น/ฟิลด์อ่านแทบไม่ออก
   - override .text-muted (Bootstrap default) + small/.text-muted under form-check
   - เปลี่ยนเฉพาะ description/hint เพื่อไม่ให้กระทบ badge สีเทาอื่น ๆ */
.text-muted,
form small.text-muted,
.lux-form-hint,
small.text-muted {
  color: #94a3b8 !important; /* --text-3 — สว่างขึ้นจาก #6c757d ปกติ */
}
.lux-form-hint {
  font-size: 0.78rem;
  margin-top: 0.4rem;
  line-height: 1.45;
}
.divider-soft { border-color: var(--border-soft); }
.section-title {
  font-size: 0.7rem; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 0.5rem; padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-soft);
}
.page-title { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1rem; }
.page-title h1, .page-title h2, .page-title h3 { margin: 0; font-weight: 800; letter-spacing: -0.01em; color: var(--text-1); }

.legend { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; font-size: 0.78rem; }
.legend .item { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.22rem 0.6rem; background: rgba(255,255,255,0.04); border: 1px solid var(--border-soft); border-radius: 999px; }
.legend .swatch { width: 10px; height: 10px; border-radius: 2px; }

/* responsive nav */
@media (max-width: 767px) {
  .app-nav .desktop-menu { display: none !important; }
  .app-nav .nav-toggle { display: inline-flex !important; }
  .app-nav .ws-status { padding: 0.3rem 0.55rem; font-size: 0.7rem; }
  .bot-hero { padding: 1.15rem 1.25rem; }
  .bot-hero .bot-title { font-size: 1.5rem; }
  .stat-tile .value { font-size: 1.35rem; }
  .lux-table tbody td, .lux-table thead th { padding: 0.55rem 0.55rem; font-size: 0.78rem; }
}
@media (min-width: 768px) {
  .app-nav .nav-toggle { display: none !important; }
  .app-nav .mobile-menu { display: none !important; }
}

/* Webfont: Inter + JetBrains Mono */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* ============================================================
   CHART CONTAINERS (lightweight-charts themed dark)
   ============================================================ */
.price-chart-container {
  position: relative;
  width: 100%;
  height: 340px;
  padding: 0.25rem;
}
.pnl-chart-container { height: 180px; padding: 0.25rem; }
@media (min-width: 992px) { .price-chart-container { height: 420px; } }

/* ─── Bar countdown (TradingView-style) ────────────────────────────────── */
.bar-countdown {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 20px;
  pointer-events: none;
  z-index: 5;
  overflow: hidden;
  border-radius: 4px 4px 0 0;
}
.bar-countdown-fill {
  position: absolute; top: 0; left: 0; bottom: 0;
  width: 0%;
  background: linear-gradient(90deg,
    rgba(245, 184, 0, 0.18) 0%,
    rgba(245, 184, 0, 0.55) 70%,
    rgba(245, 184, 0, 0.85) 100%);
  transition: width 1s linear;
}
.bar-countdown-text {
  position: absolute; top: 0; left: 50%;
  transform: translateX(-50%);
  color: #ffffff;
  font-size: 0.72rem;
  font-family: var(--font-mono, ui-monospace, monospace);
  line-height: 20px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7), 0 0 6px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* FIX-2026-08-05: BNB oil gauge (horizontal fuel-bar on /bots.html)
   - 3 zones: healthy (green) / low (gold) / critical (red + pulse)
   - chunkier than .bar-countdown-fill (14px) — gauge is wider + standalone
   - smooth width transition (600ms) for friendly glance feel
*/
.bnb-gauge-track {
  position: relative;
  height: 14px;
  background: rgba(255,255,255,0.06);
  border-radius: 7px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.4);
}
.bnb-gauge-fill {
  height: 100%;
  width: 0%;
  border-radius: 7px;
  transition: width 600ms ease-out, background 300ms ease;
}
.bnb-gauge-fill.is-healthy {
  background: linear-gradient(90deg, rgba(34,197,94,0.45) 0%, rgba(34,197,94,0.85) 100%);
  box-shadow: 0 0 8px rgba(34,197,94,0.4);
}
.bnb-gauge-fill.is-low {
  background: linear-gradient(90deg, rgba(245,184,0,0.45) 0%, rgba(245,184,0,0.85) 100%);
  box-shadow: 0 0 8px rgba(245,184,0,0.4);
}
.bnb-gauge-fill.is-critical {
  background: linear-gradient(90deg, rgba(239,68,68,0.5) 0%, rgba(239,68,68,0.9) 100%);
  box-shadow: 0 0 10px rgba(239,68,68,0.5);
  animation: bnb-gauge-pulse 2s ease-in-out infinite;
}
@keyframes bnb-gauge-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}
.price-chart-container .loading-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(7,11,20,0.55); color: var(--text-3);
  font-family: var(--font-mono); font-size: 0.85rem;
  backdrop-filter: blur(2px);
}

/* lightweight-charts tweaks (dark) */
.tv-lightweight-charts { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

/* ============================================================
   POSITIONS TAB — open positions cards (live % PnL / % to TP)
   ============================================================ */
.positions-list { display: flex; flex-direction: column; gap: 0.75rem; }

.position-card {
  padding: 0.9rem 1rem;
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-3) 100%);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--border-mid);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.position-card.pnl-bull { border-left-color: var(--bull-1); box-shadow: inset 3px 0 12px -6px rgba(0,229,184,0.18); }
.position-card.pnl-bear { border-left-color: var(--bear-1); box-shadow: inset 3px 0 12px -6px rgba(255,77,109,0.18); }
.position-card:hover { border-color: var(--border-mid); }

/* FIX-2026-08-01: SL-armed highlight (F1 — autoArmStopLossOnUKC)
   - armed   = trader._autoArmStopLossOnUKC set useStopLossOnUKC=true (loss>10% + age>4h)
     → red border + glowing box-shadow + small ⚠ pulse
   - pending = threshold ตรงแต่ flag ยังไม่มา (รอ candle close ถัดไป)
     → orange dashed border */
.position-card.is-sl-armed {
  border-color: rgba(255,77,109,0.55);
  border-left-color: var(--bear-1);
  box-shadow: 0 0 0 1px rgba(255,77,109,0.22), 0 0 18px rgba(255,77,109,0.20), inset 3px 0 12px -6px rgba(255,77,109,0.30);
  animation: slArmedPulse 2.4s ease-in-out infinite;
}
.position-card.is-stuck-likely {
  border-color: rgba(255,181,71,0.45);
  border-left-color: var(--bull-3, #ffb547);
  border-style: dashed;
  box-shadow: inset 3px 0 12px -6px rgba(255,181,71,0.30);
}
@keyframes slArmedPulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(255,77,109,0.22), 0 0 18px rgba(255,77,109,0.20), inset 3px 0 12px -6px rgba(255,77,109,0.30); }
  50%      { box-shadow: 0 0 0 1px rgba(255,77,109,0.40), 0 0 28px rgba(255,77,109,0.35), inset 3px 0 12px -6px rgba(255,77,109,0.40); }
}

/* SL-armed pill (🛡️ Au) — same accent as border */
.position-card .sl-armed-pill,
.mob-card .sl-armed-pill {
  display: inline-flex; align-items: center; gap: 0.25rem;
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 600;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: rgba(255,77,109,0.12);
  color: var(--bear-1);
  border: 1px solid rgba(255,77,109,0.40);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.position-card .sl-armed-pill.is-pending,
.mob-card .sl-armed-pill.is-pending {
  background: rgba(255,181,71,0.10);
  color: var(--bull-3, #ffb547);
  border-color: rgba(255,181,71,0.40);
}

/* FIX-2026-08-02: DCA stack pills + frozen indicator + per-layer table */
.position-card .dca-pill,
.mob-card .dca-pill {
  display: inline-flex; align-items: center; gap: 0.25rem;
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 700;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.14);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.45);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.position-card .frozen-pill,
.mob-card .frozen-pill {
  display: inline-flex; align-items: center; gap: 0.25rem;
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 700;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.45);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.position-card .stack-layers-wrap {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.position-card .stack-layers-wrap .k {
  display: block;
  font-size: 0.72rem;
  color: var(--muted, #94a3b8);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}
.position-card table.stack-layers {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}
.position-card table.stack-layers th,
.position-card table.stack-layers td {
  padding: 0.32rem 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  text-align: left;
}
.position-card table.stack-layers th {
  color: var(--muted, #94a3b8);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.66rem;
  letter-spacing: 0.04em;
}

/* FIX-2026-08-01: sellReason pill — บอก trigger ของ SELL fill
   ใช้กับ Trade history (bot-detail / history / pnl day-modal) */
.sell-reason-pill {
  display: inline-flex; align-items: center; gap: 0.25rem;
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 600;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: #555;
  color: #fff;
  margin-left: 0.3rem;
  white-space: nowrap;
  cursor: help;
  vertical-align: middle;
  letter-spacing: 0.02em;
}
.sell-reason-pill.is-bull    { background: #1e8e3e; }
.sell-reason-pill.is-bear    { background: #c0392b; }
.sell-reason-pill.is-warn    { background: #e67e22; }
.sell-reason-pill.is-manual  { background: #2980b9; }
.sell-reason-pill.is-neutral { background: #7f8c8d; }

/* FIX-2026-08-01: Bot Quality Indicator pill — 0-4 score, color tier per score */
.quality-pill {
  display: inline-flex; align-items: center; gap: 0.25rem;
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 600;
  padding: 0.18rem 0.55rem; border-radius: 999px;
  background: #555; color: #fff; margin-left: 0.3rem;
  white-space: nowrap; cursor: pointer; vertical-align: middle;
  letter-spacing: 0.02em; user-select: none;
  transition: filter 0.15s ease;
}
.quality-pill:hover { filter: brightness(1.15); }
.quality-pill.is-red    { background: #c0392b; }
.quality-pill.is-orange { background: #e67e22; }
.quality-pill.is-yellow { background: #f1c40f; color: #1a1a1a; }
.quality-pill.is-green  { background: #1e8e3e; }
.quality-pill.is-gray   { background: #7f8c8d; cursor: default; }

/* FIX-2026-08-03: Safe-trade filter #2 (trendline) live badge — bot card status
   - pass (✅ above) = green, blocked (❌ below) = red, warmup/data/api/no-tf = amber, pending = gray
   - pill เหมือน quality-pill แต่ cursor: default (ไม่คลิก — แค่แสดงสถานะ)
*/
.trendline-pill {
  display: inline-flex; align-items: center; gap: 0.25rem;
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 600;
  padding: 0.18rem 0.55rem; border-radius: 999px;
  background: #555; color: #fff; margin-left: 0.3rem;
  white-space: nowrap; cursor: default; vertical-align: middle;
  letter-spacing: 0.02em; user-select: none;
  transition: filter 0.15s ease;
}
.trendline-pill:hover { filter: brightness(1.15); }
.trendline-pill.is-pass     { background: #1e8e3e; }  /* green — price above TL */
.trendline-pill.is-blocked  { background: #c0392b; }  /* red — price below TL (BUY blocked) */
.trendline-pill.is-warmup   { background: #16a085; }  /* teal — pivot not yet detected */
.trendline-pill.is-warn     { background: #e67e22; }  /* amber — data/api/no-tf */
.trendline-pill.is-pending  { background: #7f8c8d; cursor: default; }  /* gray — not yet scanned */

/* FIX-2026-08-06: delist-pill — Binance delist risk indicator
   - is-delisted:    #c0392b (red,    ฺsymbol ถูก delist แล้ว — ไม่ควรแสดง bot นี้)
   - is-urgent:      #c0392b (red,    ≤ 3d ก่อน delist — force-close)
   - is-warning:     #e67e22 (amber,  ≤ 7d ก่อน delist — block BUY)
   - is-scheduled:   #f1c40f (yellow, > 7d ก่อน delist — มี schedule)
   - is-monitoring:  #7f8c8d (gray,   Binance Monitoring tag — early warning) */
.delist-pill {
  display: inline-flex; align-items: center; gap: 0.25rem;
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 700;
  padding: 0.18rem 0.55rem; border-radius: 999px;
  background: #555; color: #fff; margin-left: 0.3rem;
  white-space: nowrap; cursor: default; vertical-align: middle;
  letter-spacing: 0.02em; user-select: none;
  transition: filter 0.15s ease;
  animation: delistPulse 2s ease-in-out infinite;
}
.delist-pill:hover { filter: brightness(1.15); }
.delist-pill.is-delisted   { background: #c0392b; animation: none; }
.delist-pill.is-urgent     { background: #c0392b; }
.delist-pill.is-warning    { background: #e67e22; }
.delist-pill.is-scheduled  { background: #f1c40f; color: #1a1a1a; animation: none; }
.delist-pill.is-monitoring { background: #7f8c8d; animation: none; }
@keyframes delistPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* FIX-2026-08-22: soft-deleted-bot lifecycle styling
   - .deleted-pill: red pill with days-since-delete in bot meta row
   - .bot-card-v2.is-deleted: full-card dim + red border (visual hierarchy: clearly broken)
   - .bc-deleted-banner: prominent red banner with Restore button
   - .bot-status-pill: inline badge in Open Positions modal cards (deleted/auto-paused)
   - .run-badge.is-deleted: bright red badge replaces ▶ RUNNING/⏸ STOPPED */
.deleted-pill {
  display: inline-flex; align-items: center; gap: 0.25rem;
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 700;
  padding: 0.2rem 0.55rem; border-radius: 999px;
  background: rgba(192, 57, 43, 0.18);
  color: #ff6b6b;
  border: 1px solid rgba(192, 57, 43, 0.45);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.bot-card-v2.is-deleted {
  opacity: 0.78;
  border: 1px solid rgba(192, 57, 43, 0.35) !important;
  background: rgba(192, 57, 43, 0.04);
}
.bot-card-v2.is-deleted .bc-title {
  text-decoration: line-through;
  text-decoration-color: rgba(255, 107, 107, 0.45);
}
.bot-card-v2 .run-badge.is-deleted {
  background: rgba(192, 57, 43, 0.22);
  color: #ff6b6b;
  border: 1px solid rgba(192, 57, 43, 0.55);
  animation: deletedPulse 1.6s ease-in-out infinite;
}
@keyframes deletedPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(192, 57, 43, 0.30); }
  50% { box-shadow: 0 0 16px rgba(192, 57, 43, 0.65); }
}
.bot-card-v2 .bc-deleted-banner {
  margin: 0.6rem 0 0.4rem;
  padding: 0.55rem 0.85rem;
  border-radius: 6px;
  background: rgba(192, 57, 43, 0.10);
  border: 1px solid rgba(192, 57, 43, 0.30);
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  flex-wrap: wrap;
  font-family: var(--font-mono); font-size: 0.78rem;
  color: #ffd6d6;
}
.bot-card-v2 .bc-deleted-banner .bc-deleted-msg { flex: 1; min-width: 240px; }
.bot-card-v2 .bc-deleted-banner .bc-deleted-locked {
  color: #ff6b6b; font-weight: 700; opacity: 0.85;
}
.bot-card-v2 .bc-deleted-banner strong { color: #ff6b6b; font-weight: 700; }

/* Open Positions modal — inline bot-status badge (inside PositionCard) */
.bot-status-pill {
  display: inline-flex; align-items: center; gap: 0.25rem;
  font-family: var(--font-mono); font-size: 0.7rem; font-weight: 700;
  padding: 0.18rem 0.5rem; border-radius: 999px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: default;
  border: none;
  font-family: var(--font-mono);
}
.bot-status-pill.is-deleted {
  background: rgba(192, 57, 43, 0.20);
  color: #ff6b6b;
  border: 1px solid rgba(192, 57, 43, 0.45);
}
.bot-status-pill.is-deleted.is-clickable {
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.1s ease;
}
.bot-status-pill.is-deleted.is-clickable:hover {
  filter: brightness(1.18);
  transform: translateY(-1px);
}
.bot-status-pill.is-deleted.is-locked {
  background: rgba(127, 140, 141, 0.18);
  color: #95a5a6;
  border: 1px solid rgba(127, 140, 141, 0.35);
}
.bot-status-pill.is-autopaused {
  background: rgba(241, 196, 15, 0.18);
  color: #f1c40f;
  border: 1px solid rgba(241, 196, 15, 0.45);
}

/* FIX-2026-08-06: delist-banner — full-width warning banner at bot-detail header
   - is-urgent:    red,    ฺsymbol delist ใน ≤ 3 วัน
   - is-warning:   amber,  ฺsymbol delist ใน ≤ 7 วัน
   - is-scheduled: yellow, ฺsymbol delist ใน > 7 วัน */
.delist-banner {
  margin: 0.75rem 0 1rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border-left: 4px solid #f1c40f;
  background: rgba(241, 196, 15, 0.1);
  color: #f1c40f;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.5;
}
.delist-banner strong { color: inherit; font-weight: 700; }
.delist-banner.is-urgent {
  border-left-color: #c0392b;
  background: rgba(192, 57, 43, 0.15);
  color: #ff6b6b;
}
.delist-banner.is-warning {
  border-left-color: #e67e22;
  background: rgba(230, 126, 34, 0.12);
  color: #ffa94d;
}
.delist-banner.is-scheduled {
  border-left-color: #f1c40f;
  background: rgba(241, 196, 15, 0.08);
  color: #ffd43b;
}

/* FIX-2026-08-09: PnL modal column toggle (mobile-friendly) */
.pnl-modal-header { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pnl-modal-header h5 { flex: 1; }
.pnl-modal-actions { display: flex; align-items: center; gap: 6px; }
.pnl-col-toggle-btn {
  background: rgba(245,184,0,0.1); border: 1px solid rgba(245,184,0,0.3);
  color: var(--text-1); padding: 4px 10px; border-radius: 6px;
  font-size: 0.85em; cursor: pointer; transition: background 0.15s;
  display: inline-flex; align-items: center; gap: 4px;
}
.pnl-col-toggle-btn:hover { background: rgba(245,184,0,0.2); }
.pnl-col-toggle-btn .count {
  background: rgba(245,184,0,0.25); padding: 1px 6px; border-radius: 8px;
  font-size: 0.85em; font-weight: 700;
}
.pnl-col-menu {
  position: absolute; top: calc(100% + 4px); right: 0;
  background: #0d1320; border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px; padding: 8px 0; min-width: 200px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5); z-index: 100;
  max-height: 70vh; overflow-y: auto;
}
.pnl-col-menu-header {
  padding: 4px 12px 8px; font-size: 0.8em; color: var(--text-3);
  border-bottom: 1px solid rgba(255,255,255,0.06); margin-bottom: 4px;
}
.pnl-col-menu-item {
  padding: 6px 12px; cursor: pointer; display: flex;
  align-items: center; gap: 8px; font-size: 0.9em;
  color: var(--text-1); transition: background 0.1s;
}
.pnl-col-menu-item:hover { background: rgba(245,184,0,0.08); }
.pnl-col-menu-item input[type="checkbox"] {
  accent-color: #f5b800; cursor: pointer;
}
.pnl-col-menu-item .col-sample {
  margin-left: auto; font-size: 0.75em;
  color: var(--text-3); font-family: var(--font-mono);
}
.pnl-col-menu-actions {
  padding: 8px 12px 4px; border-top: 1px solid rgba(255,255,255,0.06);
  margin-top: 4px; display: flex; gap: 6px; flex-wrap: wrap;
}
.pnl-col-menu-actions button {
  flex: 1; min-width: 70px; background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08); color: var(--text-2);
  padding: 4px 8px; border-radius: 4px; font-size: 0.8em;
  cursor: pointer; transition: background 0.15s;
}
.pnl-col-menu-actions button:hover { background: rgba(245,184,0,0.12); color: var(--text-1); }
.pnl-col-menu-mobile-hint {
  padding: 4px 12px; font-size: 0.75em;
  color: var(--text-3); font-style: italic;
  border-top: 1px solid rgba(255,255,255,0.04); margin-top: 4px;
}
.partial-fill-warn {
  display: inline-block; margin-left: 4px;
  color: #f5b800; font-size: 0.9em;
  cursor: help;
}

/* FIX-2026-08-01: Quality breakdown modal — clone of .pnl-modal-* pattern */
.quality-modal-overlay { position: fixed; inset: 0; z-index: 1050; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px); display: none; align-items: flex-start; justify-content: center; padding: 5vh 1rem 1rem; overflow-y: auto; }
.quality-modal-overlay.is-open { display: flex; }
.quality-modal-card { width: 100%; max-width: 720px; background: linear-gradient(180deg,#131a2a,#0d1320); border: 1px solid rgba(245,184,0,0.3); border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,0.6); }
.quality-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid rgba(255,255,255,0.08); }
.quality-modal-header h5 { margin: 0; color: var(--text-1); font-weight: 700; }
.quality-modal-close { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); color: var(--text-2); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: 1.1em; line-height: 1; }
.quality-modal-close:hover { background: rgba(255,77,109,0.2); color: #ff4d6d; }
.quality-modal-body { padding: 1rem 1.25rem; }
.quality-summary { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; padding: 0.85rem 1rem; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); border-radius: 10px; }
.quality-summary .score-pill { font-size: 1.4rem; font-weight: 700; padding: 0.4rem 1rem; }
.quality-criterion-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr auto; gap: 0.5rem; padding: 0.6rem 0.4rem; border-bottom: 1px solid rgba(255,255,255,0.05); align-items: center; font-family: var(--font-mono); font-size: 0.85rem; }
.quality-criterion-row:last-child { border-bottom: none; }
.quality-criterion-row .k { color: var(--text-2); font-weight: 600; }
.quality-criterion-row .v { color: var(--text-1); text-align: right; }
.quality-criterion-row .t { color: var(--text-3); text-align: right; font-size: 0.78rem; }
.quality-criterion-row .p { font-weight: 700; padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.72rem; }
.quality-criterion-row .p.is-pass { background: rgba(30,142,62,0.18); color: #4ade80; }
.quality-criterion-row .p.is-fail { background: rgba(192,57,43,0.18); color: #ff6b6b; }

.position-card .pos-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.75rem; margin-bottom: 0.7rem; flex-wrap: wrap;
}
.position-card .pos-head .left {
  display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap;
}
.position-card .pos-head .right { display: flex; align-items: center; gap: 0.5rem; }
.position-card .pos-age {
  font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-2);
  display: inline-flex; gap: 0.3rem; align-items: center;
  padding: 0.18rem 0.55rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
}
.position-card .retry-pill {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.18rem 0.55rem;
  font-family: var(--font-mono); font-size: 0.72rem;
  background: rgba(245,184,0,0.08);
  border: 1px solid rgba(245,184,0,0.20);
  color: var(--gold-2); border-radius: 999px;
}

.position-card .pos-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.7rem 1.1rem; margin-bottom: 0.75rem;
}
.position-card .pos-grid .cell { display: flex; flex-direction: column; gap: 0.18rem; min-width: 0; }
.position-card .pos-grid .k {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-3); font-weight: 600;
}
.position-card .pos-grid .v {
  font-size: 0.96rem; color: var(--text-1);
  font-family: var(--font-mono); font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.position-card .pos-grid .v.pnl-bull { color: var(--bull-1); }
.position-card .pos-grid .v.pnl-bear { color: var(--bear-1); }
.position-card .pos-grid .sub {
  font-size: 0.72rem; color: var(--text-3); font-family: var(--font-mono);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.position-card .pos-grid .sub.thb-eq { color: var(--gold-2); opacity: 0.85; }

.position-card .pos-progress { margin-bottom: 0.65rem; }
.position-card .pos-progress-label {
  font-size: 0.75rem; color: var(--text-2); margin-bottom: 0.3rem;
  display: flex; justify-content: space-between; align-items: center;
}
.position-card .pos-progress-label.tp-reached {
  color: var(--bull-1); font-weight: 700;
}

.pct-bar {
  width: 100%; height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 999px; overflow: hidden;
  border: 1px solid var(--border-soft);
}
.pct-bar-fill {
  height: 100%; border-radius: 999px;
  transition: width 0.25s ease;
}
.pct-bar-fill.pnl-bull { background: linear-gradient(90deg, var(--bull-2), var(--bull-1)); box-shadow: 0 0 8px rgba(0,229,184,0.45); }
.pct-bar-fill.pnl-bear { background: linear-gradient(90deg, var(--bear-2), var(--bear-1)); box-shadow: 0 0 8px rgba(255,77,109,0.45); }

.position-card .pos-foot {
  display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap;
  font-size: 0.78rem; padding-top: 0.6rem;
  border-top: 1px dashed var(--border-soft);
}
.position-card .pos-foot .pair {
  display: inline-flex; gap: 0.3rem; align-items: center;
}
.position-card .pos-foot .pair > span:first-child { color: var(--text-3); }
.position-card .pos-foot .pair strong { color: var(--text-1); font-family: var(--font-mono); }
.position-card .pos-foot .pair .code { font-size: 0.72rem; }
.position-card .pos-foot .last-err {
  flex: 1 1 100%;
  margin-top: 0.35rem;
  padding: 0.35rem 0.55rem;
  background: rgba(255,77,109,0.08);
  border: 1px solid rgba(255,77,109,0.25);
  border-radius: var(--radius-sm);
  color: var(--bear-2);
  font-size: 0.78rem;
}

.empty-positions {
  text-align: center; padding: 2.5rem 1rem;
  color: var(--text-3); font-size: 0.95rem; line-height: 1.55;
}

/* 2026-07-30: Open Positions modal — summary tiles + per-position list */
.opm-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.6rem 0.85rem;
  padding: 0.5rem 0 1rem;
  margin-bottom: 0.85rem;
  border-bottom: 1px dashed var(--border-soft);
}
.opm-tile {
  padding: 0.7rem 0.9rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
}
.opm-tile .k {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  font-weight: 600;
}
.opm-tile .v {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-1);
  margin-top: 0.25rem;
  font-family: var(--font-mono);
}
.opm-tile .v.pnl-bull { color: var(--bull-1); }
.opm-tile .v.pnl-bear { color: var(--bear-1); }
.opm-tile .sub { font-size: 0.72rem; color: var(--text-3); margin-top: 0.2rem; }

.opm-list .pos-bot-name,
.opm-mob .pos-bot-name {
  font-size: 0.72rem;
  color: var(--gold-2);
  font-weight: 600;
  margin: -0.35rem 0 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Mobile variant of position card */
.position-mob {
  border-left: 3px solid var(--border-mid);
  margin-bottom: 0.5rem;
}
.position-mob.pnl-bull { border-left-color: var(--bull-1); }
.position-mob.pnl-bear { border-left-color: var(--bear-1); }

@media (max-width: 640px) {
  .position-card .pos-grid { grid-template-columns: 1fr 1fr; gap: 0.55rem 0.7rem; }
  .position-card .pos-grid .v { font-size: 0.88rem; }
  .position-card .pos-age { font-size: 0.72rem; }
}
@media (max-width: 380px) {
  .position-card .pos-grid { grid-template-columns: 1fr; }
}

/* Subtle pulse for live-updating numbers */
@keyframes pos-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}
.position-card .pos-grid .v.live-tick { animation: pos-pulse 0.4s ease; }

/* ============================================================
   FIX-2026-08-05: Friendly TP progress "tunnel" bar
   - forward-fills from entry → TP (progressPct)
   - zone shading: red below entry, gold near entry, green approaching TP
   - marker dot at current price position (pulses on live tick)
   - 🎯 marker at TP end
   - replaces old inverse .pct-bar / .pct-bar-fill semantic
   ============================================================ */
.position-card .pct-bar-tunnel {
  position: relative;
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg,
    rgba(255, 77, 109, 0.18) 0%,     /* loss zone (red, soft) */
    rgba(255, 181, 71, 0.16) 45%,    /* neutral zone (gold, soft) */
    rgba(0, 229, 184, 0.18) 100%);   /* gain zone (green, soft) */
  border: 1px solid var(--border-soft);
  overflow: visible; /* allow marker + TP-flag to protrude */
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.20);
}
.position-card .pct-bar-tunnel.zone-loss  { background: linear-gradient(90deg, rgba(255,77,109,0.22) 0%, rgba(255,77,109,0.10) 100%); }
.position-card .pct-bar-tunnel.zone-flat  { background: linear-gradient(90deg, rgba(255,181,71,0.20) 0%, rgba(255,181,71,0.10) 100%); }
.position-card .pct-bar-tunnel.zone-gain  { background: linear-gradient(90deg, rgba(0,229,184,0.18) 0%, rgba(0,229,184,0.08) 100%); }
.position-card .pct-bar-tunnel.zone-reached {
  background: linear-gradient(90deg, rgba(0,229,184,0.32) 0%, rgba(0,229,184,0.18) 100%);
  border-color: rgba(0,229,184,0.55);
  box-shadow: 0 0 12px rgba(0,229,184,0.25), inset 0 1px 2px rgba(0,0,0,0.20);
}
.position-card .pct-bar-tunnel-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  border-radius: 999px;
  transition: width 0.35s cubic-bezier(.34,1.4,.64,1);
  z-index: 1;
}
.position-card .pct-bar-tunnel-fill.pnl-bull { background: linear-gradient(90deg, rgba(0,229,184,0.65), rgba(0,229,184,0.95)); box-shadow: 0 0 10px rgba(0,229,184,0.55); }
.position-card .pct-bar-tunnel-fill.pnl-bear { background: linear-gradient(90deg, rgba(255,77,109,0.65), rgba(255,77,109,0.95)); box-shadow: 0 0 10px rgba(255,77,109,0.55); }
.position-card .pct-bar-marker {
  position: absolute;
  top: 50%; transform: translate(-50%, -50%);
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--gold-2);
  border: 2px solid rgba(15, 23, 42, 0.85);
  box-shadow: 0 0 0 2px rgba(245, 184, 0, 0.45), 0 0 10px rgba(245, 184, 0, 0.55);
  z-index: 3;
  cursor: help;
  transition: left 0.35s cubic-bezier(.34,1.4,.64,1);
}
.position-card .pct-bar-marker.live-tick { animation: pos-pulse 1.2s ease infinite; }
.position-card .pct-bar-tp-marker {
  position: absolute;
  right: -2px; top: 50%; transform: translate(0, -50%);
  font-size: 0.78rem; line-height: 1;
  filter: drop-shadow(0 0 4px rgba(0,229,184,0.55));
  z-index: 2;
  pointer-events: none;
}

/* ============================================================
   FIX-2026-08-05: AU Prediction panel (🛡️ / ⏳ Au)
   - inline expanded card below TP progress bar
   - shown only when isArmed || stuckLike
   - shows predicted exit (upper-KC) + predicted loss USDT/THB + %PnL
   - armed = red glow; pending = amber dashed
   ============================================================ */
.position-card .au-prediction {
  margin: 0.55rem 0 0.65rem;
  padding: 0.65rem 0.85rem 0.75rem;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(255, 77, 109, 0.08) 0%, rgba(255, 77, 109, 0.04) 100%);
  border: 1px solid rgba(255, 77, 109, 0.30);
  border-left: 3px solid var(--bear-1);
  font-size: 0.82rem;
  position: relative;
  overflow: hidden;
}
.position-card .au-prediction.is-armed { animation: slArmedPulse 2.4s ease-in-out infinite; }
.position-card .au-prediction.is-pending {
  background: linear-gradient(180deg, rgba(255, 181, 71, 0.08) 0%, rgba(255, 181, 71, 0.04) 100%);
  border-color: rgba(255, 181, 71, 0.30);
  border-left-color: var(--bull-3, #ffb547);
  border-style: solid;
}
.position-card .au-prediction .au-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.10);
  flex-wrap: wrap;
}
.position-card .au-prediction .au-title {
  font-weight: 700;
  font-size: 0.86rem;
  color: var(--bear-1);
  letter-spacing: 0.01em;
}
.position-card .au-prediction.is-pending .au-title { color: var(--bull-3, #ffb547); }
.position-card .au-prediction .au-when {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-3);
  opacity: 0.85;
}
.position-card .au-prediction .au-row {
  display: grid;
  grid-template-columns: minmax(110px, 1.2fr) 1fr;
  gap: 0.35rem 0.65rem;
  align-items: baseline;
  padding: 0.28rem 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
}
.position-card .au-prediction .au-row:last-of-type { border-bottom: none; }
.position-card .au-prediction .au-row-inline {
  grid-template-columns: minmax(110px, 1.2fr) auto;
}
.position-card .au-prediction .au-k {
  color: var(--text-2);
  font-weight: 500;
  font-size: 0.78rem;
}
.position-card .au-prediction .au-v {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-1);
  font-size: 0.92rem;
  text-align: right;
}
.position-card .au-prediction .au-v.pnl-bull { color: var(--bull-1); }
.position-card .au-prediction .au-v.pnl-bear { color: var(--bear-1); }
.position-card .au-prediction .au-sub {
  grid-column: 1 / -1;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--text-3);
  margin-top: 0.1rem;
  letter-spacing: 0.02em;
  padding-left: 0.1rem;
}
.position-card .au-prediction .au-sub.thb-eq {
  color: var(--gold-2);
  opacity: 0.85;
}
.position-card .au-prediction .au-warmup {
  padding: 0.55rem 0.65rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed rgba(255, 255, 255, 0.10);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 0.78rem;
  margin: 0.35rem 0;
  font-family: var(--font-mono);
}
.position-card .au-prediction .au-warmup-text {
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 0.3rem;
  font-size: 0.82rem;
}
.position-card .au-prediction .au-warmup-meta {
  font-size: 0.74rem;
  color: var(--text-2);
  margin-bottom: 0.3rem;
}
.position-card .au-prediction .au-warmup-meta strong {
  color: var(--gold-2);
  font-weight: 700;
}
.position-card .au-prediction .au-warmup-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.35rem;
}
.position-card .au-prediction .au-warmup-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-2), var(--gold-1, #ffd76a));
  box-shadow: 0 0 6px rgba(245, 184, 0, 0.45);
  border-radius: 999px;
  transition: width 0.4s cubic-bezier(.34,1.4,.64,1);
}
.position-card .au-prediction .au-warmup-hint {
  font-size: 0.68rem;
  color: var(--text-3);
  font-style: italic;
  letter-spacing: 0.01em;
}
.position-card .au-prediction .au-explainer {
  margin-top: 0.5rem;
  padding-top: 0.45rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
  color: var(--text-2);
  font-size: 0.74rem;
  line-height: 1.45;
  font-style: italic;
}
.position-card .au-prediction.is-pending .au-explainer { color: var(--bull-3, #ffb547); }

/* Mobile prediction panel — compact single column */
@media (max-width: 640px) {
  .position-card .au-prediction { padding: 0.55rem 0.65rem 0.6rem; font-size: 0.78rem; }
  .position-card .au-prediction .au-row { grid-template-columns: 1fr; gap: 0.15rem; }
  .position-card .au-prediction .au-v { text-align: left; font-size: 0.86rem; }
  .position-card .au-prediction .au-sub { padding-left: 0; }
}

/* ============================================================
   LUXURY MODAL — premium confirm/create/delete dialogs
   Replaces native confirm()/prompt()/alert() — adds password field,
   animated icon, variant-tinted headers, loading state.
   ============================================================ */
.modal-content.lux-modal {
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-3), 0 0 0 1px rgba(255,255,255,0.04) inset;
  overflow: hidden;
  color: var(--text-1);
}
.modal-content.lux-modal .modal-body { padding: 1.25rem 1.4rem 0.6rem; }
.modal-content.lux-modal .modal-footer.lux-modal-footer {
  padding: 0.85rem 1.4rem 1.15rem;
  border-top: 1px solid var(--border-soft);
  background: rgba(0,0,0,0.18);
  gap: 0.55rem;
}

/* Header */
.lux-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.85rem;
  padding: 1rem 1.4rem;
  border-bottom: 1px solid var(--border-soft);
  position: relative;
  overflow: hidden;
}
.lux-modal-header::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.05), transparent 50%);
  pointer-events: none;
}
.lux-modal-title-wrap {
  display: flex; align-items: center; gap: 0.85rem;
  min-width: 0; flex: 1;
}
.lux-modal-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  font-size: 1.45rem;
  flex-shrink: 0;
  box-shadow: 0 4px 18px rgba(0,0,0,0.30);
}
.lux-modal-header.is-gold    { background: linear-gradient(180deg, rgba(245,184,0,0.18), rgba(245,184,0,0.06)); }
.lux-modal-header.is-gold    .lux-modal-icon { background: var(--gold-glow); border-color: rgba(245,184,0,0.45); }
.lux-modal-header.is-success { background: linear-gradient(180deg, rgba(0,229,184,0.20), rgba(0,229,184,0.06)); }
.lux-modal-header.is-success .lux-modal-icon { background: var(--bull-glow); border-color: rgba(0,229,184,0.45); }
.lux-modal-header.is-warning { background: linear-gradient(180deg, rgba(255,181,71,0.20), rgba(255,181,71,0.06)); }
.lux-modal-header.is-warning .lux-modal-icon { background: rgba(255,181,71,0.30); border-color: rgba(255,181,71,0.45); }
.lux-modal-header.is-danger  { background: linear-gradient(180deg, rgba(255,77,109,0.22), rgba(255,77,109,0.08)); }
.lux-modal-header.is-danger  .lux-modal-icon { background: var(--bear-glow); border-color: rgba(255,77,109,0.50); animation: cam-danger-pulse 1.6s ease-in-out infinite; }

@keyframes cam-danger-pulse {
  0%, 100% { box-shadow: 0 4px 18px rgba(0,0,0,0.30), 0 0 0 0 rgba(255,77,109,0.40); }
  50%      { box-shadow: 0 4px 18px rgba(0,0,0,0.30), 0 0 0 10px rgba(255,77,109,0.00); }
}

.lux-modal-header .modal-title {
  font-size: 1.05rem; font-weight: 700; color: var(--text-1); letter-spacing: -0.005em;
}
.lux-modal-sub {
  font-size: 0.78rem; color: var(--text-3); margin-top: 0.15rem;
}
.btn-close-white { filter: invert(1) grayscale(1) brightness(2); opacity: 0.7; }
.btn-close-white:hover { opacity: 1; }

/* Form section spacing */
.lux-form-section { margin-top: 0.9rem; }
.lux-form-label {
  display: block;
  font-size: 0.75rem; font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase; letter-spacing: 0.04em;
  margin-bottom: 0.4rem;
}
.lux-form-hint {
  font-size: 0.74rem; color: var(--text-3); margin-top: 0.35rem;
}

/* Section divider (with centered text) */
.lux-divider {
  display: flex; align-items: center; gap: 0.6rem;
  margin: 1.1rem 0 0.4rem;
  font-size: 0.7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-3);
}
.lux-divider::before, .lux-divider::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-mid), transparent);
}

/* Password input w/ show/hide eye */
.lux-password-field {
  position: relative;
}
.lux-password-field .form-control {
  padding-right: 3rem;
  font-family: var(--font-mono);
  letter-spacing: 0.18em;
}
.lux-password-field .form-control::placeholder { letter-spacing: 0; font-family: var(--font-sans); }
.lux-pw-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: transparent; border: 0; padding: 4px 8px;
  color: var(--text-3); cursor: pointer; font-size: 0.95rem;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.lux-pw-toggle:hover { color: var(--gold-2); background: rgba(245,184,0,0.06); }

/* Summary tile (capital total etc.) */
.lux-summary-tile {
  display: flex !important; justify-content: space-between; align-items: center;
  padding: 0.85rem 1rem !important;
  background: linear-gradient(180deg, rgba(245,184,0,0.06), rgba(245,184,0,0.02)) !important;
  border: 1px solid rgba(245,184,0,0.20) !important;
  border-radius: var(--radius-md) !important;
}
.lux-summary-tile .lbl { font-size: 0.78rem; color: var(--text-2); }
.lux-summary-tile .val {
  font-family: var(--font-mono); font-weight: 700;
  font-size: 1.15rem; color: var(--gold-2);
}
.lux-summary-tile .val .cur {
  font-size: 0.7rem; font-weight: 500; color: var(--text-3); margin-left: 0.25rem;
  font-family: var(--font-sans);
}

/* Confirm-action modal extras */
.cam-target {
  display: flex; flex-direction: column; gap: 0.4rem;
  padding: 0.85rem 1rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  margin-bottom: 0.85rem;
}
.cam-target-row {
  display: flex; align-items: baseline; gap: 0.75rem;
}
.cam-target-row .k {
  font-size: 0.72rem; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.04em;
  min-width: 70px;
}
.cam-target-row .v { font-size: 0.92rem; color: var(--text-1); }
.cam-target-row .v.mono { font-family: var(--font-mono); }

.cam-message {
  font-size: 0.95rem; color: var(--text-2); line-height: 1.55;
  margin-bottom: 0.4rem;
}

.cam-danger-note {
  display: flex !important; align-items: center; gap: 0.6rem;
  margin-top: 0.5rem !important;
  padding: 0.65rem 0.85rem !important;
  border-radius: var(--radius-md) !important;
}
.cam-danger-note .alert-glyph {
  flex-shrink: 0; font-size: 1.1rem;
  animation: cam-warn-shake 1.6s ease-in-out infinite;
}
@keyframes cam-warn-shake {
  0%, 90%, 100% { transform: rotate(0); }
  92% { transform: rotate(-12deg); }
  94% { transform: rotate(10deg); }
  96% { transform: rotate(-6deg); }
  98% { transform: rotate(4deg); }
}

/* Confirm button variant tints (mirror header variants) */
.lux-modal-footer #cam-confirm.btn {
  position: relative;
  display: inline-flex; align-items: center; gap: 0.45rem;
  min-width: 140px; justify-content: center;
}
.lux-modal-footer #cam-confirm .btn-glyph { font-size: 1rem; line-height: 1; }
.btn .btn-spinner {
  display: none;
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: cam-spin 0.8s linear infinite;
}
@keyframes cam-spin { to { transform: rotate(360deg); } }
.btn.is-loading .btn-label { opacity: 0.5; }
.btn.is-loading .btn-spinner { display: inline-block; }
.btn:disabled { opacity: 0.7; cursor: not-allowed; }

.lux-modal-footer #cam-confirm.is-gold {
  background: linear-gradient(180deg, var(--gold-1), #d49d00);
  color: #1a1208; box-shadow: var(--shadow-gold);
}
.lux-modal-footer #cam-confirm.is-success {
  background: linear-gradient(180deg, var(--bull-1), var(--bull-2));
  color: #002a1f; box-shadow: var(--shadow-bull);
}
.lux-modal-footer #cam-confirm.is-warning {
  background: linear-gradient(180deg, var(--warn-1), #d68f25);
  color: #2b1900;
}
.lux-modal-footer #cam-confirm.is-danger {
  background: linear-gradient(180deg, var(--bear-1), var(--bear-2));
  color: #2b0008; box-shadow: var(--shadow-bear);
}

@media (max-width: 480px) {
  .modal-content.lux-modal .modal-body { padding: 1rem 1rem 0.5rem; }
  .modal-content.lux-modal .modal-footer.lux-modal-footer { padding: 0.75rem 1rem 1rem; }
  .lux-modal-header { padding: 0.85rem 1rem; }
  .lux-modal-icon { width: 38px; height: 38px; font-size: 1.2rem; }
}

/* ============================================================
   TREND CHIPS — multi-select filter for scan-volatility page
   - uptrend / downtrend / sideways with semantic colors
   - :has(input:checked) toggles "active" visual state
   ============================================================ */
.trend-chip {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  background: var(--bg-2);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
  font-size: 0.85rem;
  color: var(--text-2);
  transition: all 0.15s ease;
}
.trend-chip input[type="checkbox"] {
  margin: 0;
  accent-color: var(--gold-1);
}
.trend-chip .chip-glyph { font-size: 1rem; }
.trend-chip .chip-label { font-weight: 600; color: var(--text-1); }
.trend-chip .chip-hint { font-size: 0.72rem; color: var(--text-3); margin-left: 0.25rem; }
.trend-chip:has(input:checked) { box-shadow: var(--shadow-1); }
.trend-chip.uptrend:has(input:checked) {
  background: linear-gradient(180deg, rgba(0,229,184,0.18), rgba(0,229,184,0.06));
  border-color: var(--bull-1);
  color: var(--bull-1);
}
.trend-chip.downtrend:has(input:checked) {
  background: linear-gradient(180deg, rgba(255,77,109,0.18), rgba(255,77,109,0.06));
  border-color: var(--bear-1);
  color: var(--bear-1);
}
.trend-chip.sideways:has(input:checked) {
  background: linear-gradient(180deg, rgba(255,209,102,0.18), rgba(255,209,102,0.06));
  border-color: var(--gold-1);
  color: var(--gold-1);
}
.trend-chip:has(input:checked) .chip-label { color: inherit; }

/* Trend pills inside the results table */
.trend-pill {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.trend-pill.is-uptrend {
  background: rgba(0,229,184,0.15);
  color: var(--bull-1);
  border: 1px solid rgba(0,229,184,0.35);
}
.trend-pill.is-downtrend {
  background: rgba(255,77,109,0.15);
  color: var(--bear-1);
  border: 1px solid rgba(255,77,109,0.35);
}
.trend-pill.is-sideways {
  background: rgba(255,209,102,0.15);
  color: var(--gold-1);
  border: 1px solid rgba(255,209,102,0.35);
}

/* ── Hot symbol marker (scan-volatility) — FIX-2026-07-31 ───────────── */
.hot-symbol {
  display: inline-block;
  font-size: 0.95rem;
  line-height: 1;
  filter: drop-shadow(0 0 4px rgba(255, 107, 0, 0.55));
  cursor: help;
  transition: transform 0.15s ease;
}
.hot-symbol:hover {
  transform: scale(1.18);
}

/* ── Inline create-bot button on 🔥 rows — FIX-2026-07-31 ───────────── */
.btn-create-bot-mini {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.18rem 0.45rem;
  margin-right: 0.25rem;
  border-radius: 6px;
  background: linear-gradient(135deg, rgba(245,184,0,0.18), rgba(245,184,0,0.08));
  border: 1px solid rgba(245,184,0,0.42);
  color: var(--gold-1, #ffd166);
  text-decoration: none !important;
  transition: all 0.15s ease;
  letter-spacing: 0.01em;
}
.btn-create-bot-mini:hover {
  background: linear-gradient(135deg, rgba(245,184,0,0.32), rgba(245,184,0,0.18));
  border-color: rgba(245,184,0,0.7);
  color: var(--gold-1, #ffd166);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(245,184,0,0.25);
}

/* ── Trend state pill (EMA20 upper-TF) — FIX-2026-07-23 ───────────── */
.trend-state {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.trend-state.is-upper {
  color: var(--bull-1);
}
.trend-state.is-downtrend,
.trend-state.is-lower {
  color: var(--bear-1);
}
.trend-state.is-warmup {
  color: var(--text-3);
  opacity: 0.65;
}
.trend-state .trend-tf {
  display: inline-block;
  margin-left: 0.3rem;
  font-size: 0.7rem;
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  background: rgba(255,255,255,0.06);
  color: var(--text-2);
  font-weight: 500;
}

/* ── Suggested %TP cell ───────────────────────────────────── */
.suggested-tp {
  font-family: var(--font-mono);
  font-weight: 600;
  white-space: nowrap;
}
.suggested-tp .muted.small {
  font-weight: 400;
  font-size: 0.72rem;
}

/* ── Mini TF mapping table (legend) ───────────────────────── */
.mini-tf-map {
  display: inline-block;
  margin: 0.4rem 0 0.4rem 0.2rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  border-collapse: collapse;
  vertical-align: middle;
}
.mini-tf-map td {
  padding: 0.1rem 0.5rem;
  border: 0;
}
.mini-tf-map td:nth-child(1) {
  color: var(--text-2);
  text-align: right;
}
.mini-tf-map td:nth-child(2) {
  color: var(--text-3);
  text-align: center;
}
.mini-tf-map td:nth-child(3) {
  color: var(--gold-1);
  font-weight: 600;
  text-align: left;
}

/* ============================================================
   Signal Info accordion (chart page) — คำอธิบายเส้น + Pine Script
   ============================================================ */
.lux-details {
  border: 1px solid var(--border-mid);
  border-radius: 0.5rem;
  background: rgba(255,255,255,0.02);
}
.lux-details[open] > .lux-details-summary {
  border-bottom: 1px solid var(--border-mid);
}
.lux-details-summary {
  list-style: none;
  cursor: pointer;
  padding: 0.7rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 600;
  color: var(--text-1);
}
.lux-details-summary::-webkit-details-marker { display: none; }
.lux-details-summary::marker { content: ''; }
.lux-details-summary::after {
  content: '▾';
  margin-left: auto;
  color: var(--text-3);
  transition: transform 120ms ease;
}
.lux-details[open] > .lux-details-summary::after { transform: rotate(180deg); }
.lux-details-hint {
  font-size: 0.78rem;
  color: var(--text-3);
  font-weight: 400;
}
.lux-details-body { padding: 1rem 1.1rem 1.2rem; }

/* ── Bot settings layout: New Bot / Edit Bot / Master Config ── */
.bot-settings-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.bot-settings-form .lux-details {
  overflow: hidden;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.bot-settings-form .lux-details[open] {
  border-color: rgba(245,184,0,0.28);
  box-shadow: 0 0 0 1px rgba(245,184,0,0.04) inset;
}
.bot-settings-form .lux-details-summary {
  min-height: 48px;
  padding: 0.75rem 0.9rem;
}
.bot-settings-form .lux-details-summary:focus-visible {
  outline: 2px solid var(--gold-1);
  outline-offset: -2px;
}
.bot-settings-form .lux-details-body {
  padding: 0.9rem;
}
.bot-settings-form .lux-details-body > :first-child { margin-top: 0 !important; }
.bot-settings-form .lux-details-body > :last-child { margin-bottom: 0 !important; }
.bot-settings-group-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 8px;
  background: rgba(245,184,0,0.08);
  border: 1px solid rgba(245,184,0,0.16);
}
.bot-settings-group-title {
  min-width: 0;
  font-size: 0.92rem;
  line-height: 1.35;
}
.bot-settings-group-hint {
  color: var(--text-3);
  font-size: 0.72rem;
  font-weight: 400;
  line-height: 1.3;
}
.bot-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}
.bot-settings-grid.is-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.bot-settings-grid > .is-full { grid-column: 1 / -1; }
.bot-settings-field,
.bot-settings-option {
  min-width: 0;
}
.bot-settings-field {
  padding: 0.75rem;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.018);
}
.bot-settings-option {
  padding: 0.8rem;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.022);
}
.bot-settings-option > .form-check:first-child,
.bot-settings-option > label.form-check:first-child { margin-top: 0 !important; }
.bot-settings-option .form-check-label {
  line-height: 1.45;
}
.bot-settings-option .row:last-child,
.bot-settings-option small:last-child { margin-bottom: 0 !important; }
.bot-settings-dependent {
  margin-top: 0.7rem;
  padding-top: 0.7rem;
  border-top: 1px dashed var(--border-soft);
}
.bot-settings-note {
  padding: 0.7rem 0.8rem;
  border-radius: var(--radius-md);
  background: rgba(66,153,225,0.07);
  border: 1px solid rgba(66,153,225,0.16);
  color: var(--text-2);
  font-size: 0.78rem;
  line-height: 1.55;
}
.bot-settings-review,
.bot-settings-actions {
  padding: 0.85rem;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.025);
}
.bot-settings-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}
.bot-settings-actions .bot-settings-status {
  min-width: 0;
  flex: 1 1 220px;
}
.bot-settings-master-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
}
.bot-settings-tristate {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: nowrap;
}
.bot-settings-tristate label {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  margin: 0;
  padding: 0.25rem 0.35rem;
  border-radius: 6px;
  cursor: pointer;
}
.bot-settings-tristate label:hover { background: rgba(255,255,255,0.05); }

@media (max-width: 767.98px) {
  .bot-settings-grid,
  .bot-settings-grid.is-three { grid-template-columns: 1fr; }
  .bot-settings-grid > .is-full { grid-column: auto; }
  .bot-settings-form .lux-details-summary {
    align-items: flex-start;
    gap: 0.5rem;
  }
  .bot-settings-group-hint { display: none; }
  .bot-settings-master-row {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .bot-settings-tristate { justify-self: start; }
  .bot-settings-actions > .btn { flex: 1 1 auto; }
}

/* ── FIX-2026-08-08 (rev3): Settings page — group chips + section title ── */
.lux-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-mid);
  color: var(--text-2);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 120ms ease;
}
.lux-chip:hover {
  background: rgba(255,255,255,0.08);
  border-color: var(--accent);
  color: var(--text-1);
  transform: translateY(-1px);
}
.settings-group-title {
  margin-top: 1.8rem;
  margin-bottom: 0.4rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--border-mid);
  color: var(--text-1);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.settings-group-title:first-of-type { margin-top: 0.5rem; }
.text-muted-3 { color: var(--text-3) !important; }

.signal-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.8rem;
  margin-bottom: 1rem;
}
.signal-info-item {
  display: flex;
  gap: 0.7rem;
  padding: 0.6rem 0.7rem;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-soft);
  border-radius: 0.4rem;
}
.signal-info-item .swatch {
  flex: 0 0 10px;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-top: 0.4rem;
}
.signal-info-item .info-body { flex: 1; min-width: 0; }
.signal-info-item .info-title {
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 0.2rem;
  color: var(--text-1);
}
.signal-info-item .info-desc {
  font-size: 0.82rem;
  color: var(--text-2);
  line-height: 1.45;
  margin-bottom: 0.35rem;
}
.signal-info-item .info-formula {
  font-size: 0.76rem;
  color: var(--text-3);
  font-family: ui-monospace, 'JetBrains Mono', 'Consolas', monospace;
  background: rgba(0,0,0,0.28);
  padding: 0.4rem 0.55rem;
  border-radius: 0.3rem;
  line-height: 1.55;
  word-break: break-word;
}
.signal-info-item .info-formula code { color: var(--gold-1); }

.pine-script-block {
  border: 1px solid var(--border-mid);
  border-radius: 0.4rem;
  overflow: hidden;
}
.pine-script-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.7rem;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--border-mid);
  font-size: 0.82rem;
  color: var(--text-3);
  gap: 0.6rem;
  flex-wrap: wrap;
}
.pine-script-name { font-family: ui-monospace, monospace; }
.pine-script-pre {
  margin: 0;
  padding: 0.9rem 1rem;
  background: rgba(0,0,0,0.35);
  font-family: ui-monospace, 'JetBrains Mono', 'Consolas', monospace;
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--text-1);
  overflow-x: auto;
  max-height: 480px;
  white-space: pre;
}

/* ============================================================
   Column Legend grid (scan-volatility page)
   ============================================================ */
.col-legend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.7rem;
}
.col-legend-item {
  padding: 0.6rem 0.75rem;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 0.4rem;
}
.col-legend-item.is-new {
  border-color: rgba(255,209,102,0.35);
  background: rgba(255,209,102,0.04);
}
.col-legend-name {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-1);
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.col-legend-desc {
  font-size: 0.78rem;
  color: var(--text-2);
  line-height: 1.5;
}
.col-legend-desc code {
  font-size: 0.74rem;
  color: var(--gold-1);
  background: rgba(0,0,0,0.25);
  padding: 0.05rem 0.3rem;
  border-radius: 0.25rem;
}
.badge-new {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: rgba(255,209,102,0.18);
  color: var(--gold-1);
  border: 1px solid rgba(255,209,102,0.45);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.col-legend-desc .trend-pill { margin: 0.15rem 0.2rem 0.15rem 0; }


/* ============================================================
   FIX-2026-07-24: Mini chart inside enabled bot cards (bots.html)
   ============================================================ */
.bc-minichart-wrap {
  margin: 0.6rem 0 0.75rem;
  padding: 0.55rem 0.55rem 0.4rem;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 0.5rem;
  background: linear-gradient(180deg, rgba(0,0,0,0.18), rgba(0,0,0,0.05));
}
.bc-minichart {
  width: 100%;
  height: 140px;
  position: relative;
  /* FIX-2026-07-24 v2: กัน canvas กิน margin/overflow — chart ขยายเต็มการ์ด */
  overflow: hidden;
}
.bc-minichart-loading,
.bc-minichart-error {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 140px;
  font-size: 0.78rem;
  color: var(--text-3);
}
.bc-minichart-error { color: var(--bear-1, #ff4d6d); }

.bc-minichart-legend {
  display: flex;
  align-items: center;
  gap: 0.45rem 0.7rem;
  flex-wrap: wrap;
  margin-top: 0.4rem;
  padding-top: 0.35rem;
  border-top: 1px dashed rgba(255,255,255,0.06);
  font-size: 0.66rem;
  color: var(--text-3);
  font-family: 'JetBrains Mono', monospace;
}
.bc-minichart-legend .lg-dot {
  display: inline-block;
  width: 16px;
  height: 2px;
  margin-right: 0.2rem;
  vertical-align: middle;
}
.bc-minichart-legend .lg-up { background: #ff7849; border-top: 1px dashed #ff7849; height: 0; }
.bc-minichart-legend .lg-ema { background: #f5b800; }
.bc-minichart-legend .lg-lo { background: #a78bfa; border-top: 1px dashed #a78bfa; height: 0; }
.bc-minichart-legend .lg-mk {
  font-weight: 700;
  margin-left: 0.05rem;
  letter-spacing: 0.02em;
}
.bc-minichart-legend .lg-buy  { color: #22c55e; }
.bc-minichart-legend .lg-sell { color: #ef4444; }
.bc-minichart-legend .lg-sig  { color: #22c55e; }

/* FIX-2026-07-24: filter chips (history page state/outcome filter) */
.filter-chips-wrap { font-size: 0.78rem; }
.filter-chips-wrap .chip,
.filter-chips-wrap .chip-quick {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.2rem 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.72rem; font-weight: 600;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.12s ease;
  user-select: none;
}
.filter-chips-wrap .chip:hover,
.filter-chips-wrap .chip-quick:hover {
  background: rgba(255,255,255,0.07);
  color: var(--text-1);
  border-color: var(--border-1, rgba(255,255,255,0.18));
}
.filter-chips-wrap .chip.active {
  background: rgba(0,229,184,0.12);
  color: var(--bull-1, #00e5b8);
  border-color: rgba(0,229,184,0.45);
}
.filter-chips-wrap .chip.muted {
  color: var(--text-4, #6b7280);
  background: transparent;
  border-style: dashed;
  opacity: 0.7;
}
.filter-chips-wrap .chip-quick {
  background: rgba(245,184,0,0.05);
  border-color: rgba(245,184,0,0.25);
  color: var(--gold-1, #f5b800);
}
.filter-chips-wrap .chip-quick.active {
  background: rgba(245,184,0,0.18);
  color: var(--gold-1, #f5b800);
  border-color: rgba(245,184,0,0.6);
}
.filter-chips-wrap #filter-meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-3, #9ca3af);
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* === PnL Calendar (FIX-2026-07-29) === */
.pnl-filter-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: 10px;
  background: rgba(255,255,255,0.03); border: 1px solid var(--border-soft);
}
.pnl-month-nav { display: flex; align-items: center; gap: 8px; }
.pnl-month-nav button {
  background: rgba(255,255,255,0.05); border: 1px solid var(--border-soft);
  color: var(--text-2); padding: 4px 12px; border-radius: 6px; cursor: pointer;
  font-size: 1.1em; line-height: 1;
}
.pnl-month-nav button:hover { background: rgba(255,255,255,0.10); color: var(--text-1); }
#pnl-month-label {
  font-weight: 600; color: var(--text-1); min-width: 150px; text-align: center;
  font-family: var(--font-mono);
}
.pnl-currency-toggle { display: inline-flex; gap: 4px; margin-left: auto; }
.pnl-currency-toggle button {
  background: rgba(255,255,255,0.05); border: 1px solid var(--border-soft);
  color: var(--text-3); padding: 4px 14px; border-radius: 6px; cursor: pointer;
  font-size: 0.85em; font-weight: 600;
}
.pnl-currency-toggle button:hover { background: rgba(255,255,255,0.10); }
.pnl-currency-toggle button.active {
  background: var(--gold-1); color: #0c1220; border-color: var(--gold-1);
}

.pnl-cal {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
}
.pnl-cal-weekday {
  text-align: center; font-size: 0.75em; color: var(--text-4);
  padding: 6px 0; font-weight: 600; letter-spacing: 0.04em;
}
.pnl-cal-cell {
  min-height: 78px; padding: 6px 8px;
  background: rgba(255,255,255,0.02); border: 1px solid var(--border-soft);
  border-radius: 6px; display: flex; flex-direction: column; gap: 2px;
  font-size: 0.78em; transition: transform 0.1s ease;
}
.pnl-cal-cell:hover { transform: translateY(-1px); border-color: rgba(255,255,255,0.15); }
.pnl-cal-cell.is-empty {
  background: rgba(255,255,255,0.01); opacity: 0.35;
}
.pnl-cal-cell.is-bull {
  background: rgba(0,229,184, var(--intensity, 0.5));
  border-color: rgba(0,229,184, 0.5);
}
.pnl-cal-cell.is-bear {
  background: rgba(255,77,109, var(--intensity, 0.5));
  border-color: rgba(255,77,109, 0.5);
}
.pnl-cal-cell.is-flat {
  background: rgba(245,184,0, 0.25);
  border-color: rgba(245,184,0, 0.4);
}
.pnl-cal-day-num {
  color: var(--text-1); font-weight: 600; font-size: 0.95em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}
.pnl-cal-pnl {
  font-family: var(--font-mono); font-weight: 700; font-size: 0.95em;
  color: var(--text-1);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}
.pnl-cal-trades {
  color: var(--text-3); font-size: 0.78em; margin-top: auto;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

/* FIX-2026-07-29 (v2): สลับสีตัวอักษรเมื่อ bg อิ่มตัว โดยใช้ class ชัดเจน (ไม่พึ่ง calc+rgba alpha)
   - .is-on-bright ถูกตั้งโดย JS เมื่อ intensity >= 0.55
   - dark text + light shadow บน teal/red อิ่ม → readable
   - cell ที่ไม่ใช่ .is-on-bright ใช้สีเดิม (light text + dark shadow) */
.pnl-cal-cell.is-on-bright {
  background-color: rgba(255, 255, 255, 0.0); /* คงตามเดิม — ไม่ override จริงๆ แค่ marker */
}
.pnl-cal-cell.is-bull.is-on-bright .pnl-cal-day-num,
.pnl-cal-cell.is-bear.is-on-bright .pnl-cal-day-num {
  color: #0c1220;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.35);
}
.pnl-cal-cell.is-bull.is-on-bright .pnl-cal-pnl,
.pnl-cal-cell.is-bear.is-on-bright .pnl-cal-pnl {
  color: #0c1220;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.35);
}
.pnl-cal-cell.is-bull.is-on-bright .pnl-cal-trades,
.pnl-cal-cell.is-bear.is-on-bright .pnl-cal-trades {
  color: rgba(12, 18, 32, 0.75);
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.3);
}

/* fallback (low intensity) — light text + dark shadow อ่านง่ายบน faded bg */
.pnl-cal-cell.is-bull .pnl-cal-day-num,
.pnl-cal-cell.is-bear .pnl-cal-day-num {
  color: #f8fafc;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}
.pnl-cal-cell.is-bull .pnl-cal-pnl,
.pnl-cal-cell.is-bear .pnl-cal-pnl {
  color: #f8fafc;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}
.pnl-cal-cell.is-bull .pnl-cal-trades,
.pnl-cal-cell.is-bear .pnl-cal-trades {
  color: rgba(248, 250, 252, 0.75);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

.pnl-chart-wrap { width: 100%; min-height: 380px; min-width: 600px; }
#pnl-chart { display: block; width: 100% !important; min-width: 600px; height: 380px; }

/* FIX-2026-07-29: THB line in calendar cell */
.pnl-cal-thb {
  font-size: 0.72em;
  font-family: var(--font-mono);
  font-weight: 600;
  opacity: 0.85;
  line-height: 1.1;
}
.pnl-cal-thb.pnl-bull { color: #d1fae5; }
.pnl-cal-thb.pnl-bear { color: #fecdd3; }
.pnl-cal-cell.is-on-bright .pnl-cal-thb.pnl-bull { color: rgba(12, 18, 32, 0.7); }
.pnl-cal-cell.is-on-bright .pnl-cal-thb.pnl-bear { color: rgba(12, 18, 32, 0.7); }

/* FIX-2026-07-29: clickable cell */
.pnl-cal-cell.is-clickable { cursor: pointer; }
.pnl-cal-cell.is-clickable:hover {
  transform: translateY(-1px);
  border-color: rgba(245, 184, 0, 0.6);
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

/* FIX-2026-07-29: Day-detail modal */
.pnl-modal-overlay {
  position: fixed; inset: 0; z-index: 1050;
  background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(4px);
  display: none; align-items: flex-start; justify-content: center;
  padding: 5vh 1rem 1rem; overflow-y: auto;
}
.pnl-modal-overlay.is-open { display: flex; }
.pnl-modal-card {
  width: 100%; max-width: 880px;
  background: linear-gradient(180deg, #131a2a, #0d1320);
  border: 1px solid rgba(245, 184, 0, 0.3);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6);
}
.pnl-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem; border-bottom: 1px solid rgba(255,255,255,0.08);
}
.pnl-modal-header h5 { margin: 0; color: var(--text-1); font-weight: 700; }
.pnl-modal-close {
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-2); width: 32px; height: 32px; border-radius: 8px;
  cursor: pointer; font-size: 1.1em; line-height: 1;
}
.pnl-modal-close:hover { background: rgba(255,77,109,0.2); color: #ff4d6d; }
.pnl-modal-total {
  padding: 0.85rem 1.25rem; background: rgba(255,255,255,0.03);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex; flex-direction: column; gap: 0.4rem;
  font-family: var(--font-mono); font-size: 0.95em;
}
.pnl-modal-total .pnl-modal-summary-row {
  display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center;
}
.pnl-modal-total .pnl-modal-gl-row {
  display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center;
  font-size: 0.85em;
}
.pnl-modal-total .gl-pill {
  padding: 0.18rem 0.55rem; border-radius: 999px;
  font-weight: 600; font-family: var(--font-mono);
}
.pnl-modal-total .gl-pill.is-bull {
  background: rgba(0, 229, 184, 0.12); color: #00e5b8;
  border: 1px solid rgba(0, 229, 184, 0.35);
}
.pnl-modal-total .gl-pill.is-bear {
  background: rgba(255, 77, 109, 0.12); color: #ff4d6d;
  border: 1px solid rgba(255, 77, 109, 0.35);
}
.pnl-modal-total .is-bull { color: #00e5b8; font-weight: 700; }
.pnl-modal-total .is-bear { color: #ff4d6d; font-weight: 700; }
.pnl-modal-total .muted { color: var(--text-3); font-size: 0.9em; }
/* FIX-2026-08-01: hero PnL block (main number + THB sub) */
.pnl-modal-main-pnl {
  font-family: var(--font-mono); font-size: 1.85rem; font-weight: 800;
  letter-spacing: -0.02em;
}
.pnl-modal-main-pnl .unit {
  font-size: 0.6em; color: var(--text-3); font-weight: 500;
  margin-left: 0.3em; letter-spacing: 0.02em;
}
.pnl-modal-main-pnl.is-bull { color: #00e5b8; text-shadow: 0 0 24px rgba(0,229,184,0.5); }
.pnl-modal-main-pnl.is-bear { color: #ff4d6d; text-shadow: 0 0 24px rgba(255,77,109,0.5); }
.pnl-modal-thb {
  font-family: var(--font-mono); font-size: 1.1rem; font-weight: 700;
  padding: 0.25rem 0.65rem; border-radius: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
}
.pnl-modal-thb.is-bull { color: #00e5b8; border-color: rgba(0,229,184,0.4); background: rgba(0,229,184,0.08); }
.pnl-modal-thb.is-bear { color: #ff4d6d; border-color: rgba(255,77,109,0.4); background: rgba(255,77,109,0.08); }
/* FIX-2026-08-01: extended GL pill (label + USDT + THB + count) */
.pnl-modal-total .gl-pill .gl-label {
  font-size: 0.7rem; opacity: 0.7; margin-right: 0.4em;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.pnl-modal-total .gl-pill .gl-thb {
  display: inline-block; margin-left: 0.5em;
  font-size: 0.78em; opacity: 0.85;
  padding: 0.1em 0.45em;
  background: rgba(255,255,255,0.08);
  border-radius: 6px;
}
.pnl-modal-total .gl-pill .gl-count {
  margin-left: 0.4em; opacity: 0.7;
  font-weight: 500;
}
.pnl-modal-body { padding: 1rem 1.25rem 1.25rem; max-height: 65vh; overflow-y: auto; }
.pnl-modal-table { width: 100%; border-collapse: collapse; font-size: 0.85em; }
.pnl-modal-table th {
  text-align: left; padding: 0.5rem 0.6rem; color: var(--text-3);
  border-bottom: 1px solid rgba(255,255,255,0.08); font-weight: 600;
  font-size: 0.9em; position: sticky; top: 0; background: #0d1320;
}
.pnl-modal-table td {
  padding: 0.55rem 0.6rem; color: var(--text-1);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-family: var(--font-mono);
}
.pnl-modal-table td.muted { color: var(--text-3); font-family: var(--font-mono); font-size: 0.85em; }
.pnl-modal-table .thb-sub { font-size: 0.8em; opacity: 0.75; }
.pnl-modal-table .pnl-bull { color: #00e5b8; }
.pnl-modal-table .pnl-bear { color: #ff4d6d; }
.pnl-modal-table tbody tr:hover { background: rgba(245,184,0,0.06); }
.badge-bot {
  display: inline-block; padding: 2px 8px; border-radius: 6px;
  background: rgba(0,229,184,0.15); color: #00e5b8;
  font-size: 0.85em; font-weight: 600;
}

@media (max-width: 768px) {
  .pnl-cal-cell { min-height: 56px; padding: 4px 5px; font-size: 0.65em; }
  .pnl-cal-pnl { font-size: 0.85em; }
  .pnl-cal-thb { font-size: 0.65em; }
  .pnl-cal-trades { font-size: 0.7em; }
  #pnl-month-label { min-width: 110px; font-size: 0.9em; }
  .pnl-filter-row { padding: 10px 12px; gap: 8px; }
  .pnl-currency-toggle { margin-left: 0; }
  .pnl-modal-table { font-size: 0.75em; }
}

/* FIX-2026-07-30: Multi-bot backtest UI */
.mb-multi-rows { display: flex; flex-direction: column; gap: 8px; }
/* FIX-2026-07-31: เพิ่ม column toggles (XS1/CB/SL-UKC) + delete — 9 cols */
.mb-row-header {
  display: grid; grid-template-columns: 2fr 1fr 1fr 0.7fr 1.2fr 1fr 2.2fr 40px;
  gap: 8px; padding: 0 4px;
  font-size: 0.78em; color: var(--text-3); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.mb-row {
  display: grid; grid-template-columns: 2fr 1fr 1fr 0.7fr 1.2fr 1fr 2.2fr 40px;
  gap: 8px; align-items: center;
  background: rgba(255,255,255,0.02); border: 1px solid var(--border-soft);
  border-radius: 8px; padding: 6px 8px;
}
.mb-row select, .mb-row input { font-size: 0.85em; padding: 4px 8px; }
.mb-row .mb-del {
  background: rgba(255,77,109,0.15); color: #ff4d6d; border: 1px solid rgba(255,77,109,0.3);
  border-radius: 6px; padding: 4px 8px; cursor: pointer; font-size: 0.85em;
}
.mb-row .mb-del:hover { background: rgba(255,77,109,0.3); }
.mb-result-summary {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px; margin-bottom: 1rem;
}
.mb-result-summary .stat-tile { padding: 0.7rem; }
.mb-bot-row {
  display: grid; grid-template-columns: 1fr 80px 80px 100px 100px 80px;
  gap: 8px; padding: 8px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 0.88em; font-family: var(--font-mono);
  align-items: center;
}
.mb-bot-row:hover { background: rgba(245,184,0,0.06); }
.mb-bot-row .mb-bull { color: #00e5b8; font-weight: 700; }
.mb-bot-row .mb-bear { color: #ff4d6d; font-weight: 700; }
.mb-skip-note { color: var(--text-3); font-size: 0.75em; }

/* FIX 2026-07-30: Still-Holding Positions table (multi-bot backtest) */
/* FIX 2026-07-30: Still-Holding Positions table (multi-bot backtest) */
.mb-still-table { font-size: 0.82em; }
.mb-still-table th.mb-sortable { transition: color 0.15s ease, background-color 0.15s ease; }
.mb-still-table th.mb-sortable:hover { color: var(--gold-1); background: rgba(245,184,0,0.08); }
.mb-still-table th.mb-sortable.is-active { color: var(--gold-1); }
.mb-still-table th { color: var(--text-3); font-weight: 600; text-transform: uppercase; font-size: 0.72em; letter-spacing: 0.04em; border-bottom: 1px solid rgba(255,255,255,0.1); }
.mb-still-table td { vertical-align: middle; padding: 0.45rem 0.5rem; }
.mb-still-table tr:hover td { background: rgba(245,184,0,0.04); }
.mb-tp-bar { width: 100%; height: 6px; background: rgba(255,255,255,0.06); border-radius: 3px; overflow: hidden; }
.mb-tp-fill { height: 100%; transition: width 0.4s ease; }
.mb-tp-fill.pnl-positive { background: linear-gradient(90deg, #00b894, #00e5b8); }
.mb-tp-fill.pnl-negative { background: linear-gradient(90deg, #ff4d6d, #ff6b8a); }
@media (max-width: 768px) {
  .mb-still-table thead { display: none; }
  .mb-still-table, .mb-still-table tbody, .mb-still-table tr, .mb-still-table td { display: block; width: 100%; }
  .mb-still-table tr { margin-bottom: 0.75rem; padding: 0.5rem; border: 1px solid rgba(255,255,255,0.06); border-radius: 6px; }
  .mb-still-table td { padding: 0.2rem 0; border: none; }
  .mb-still-table td:before { content: attr(data-label); color: var(--text-3); font-size: 0.72em; text-transform: uppercase; margin-right: 6px; }
}

@media (max-width: 768px) {
  .mb-row-header { display: none; }
  .mb-row, .mb-bot-row { grid-template-columns: 1fr; gap: 4px; }
  .mb-bot-row { padding: 10px; }
}

/* FIX-2026-08-03: lux-badge — small inline pill used for status badges
   (e.g. "🟢 Binance" price-source badge, "⚙️ floor" TP-floor badge) */
.lux-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 8px;
  font-size: 0.78em;
  font-weight: 600;
  line-height: 1.4;
  vertical-align: baseline;
  border: 1px solid transparent;
}
.lux-badge-bull {
  background: rgba(0, 229, 184, 0.12);
  color: #00e5b8;
  border-color: rgba(0, 229, 184, 0.35);
}
.lux-badge-bear {
  background: rgba(255, 77, 109, 0.12);
  color: #ff4d6d;
  border-color: rgba(255, 77, 109, 0.35);
}
.lux-badge-warn {
  background: rgba(245, 184, 0, 0.12);
  color: #f5b800;
  border-color: rgba(245, 184, 0, 0.35);
}
.lux-badge-gold {
  background: rgba(245, 184, 0, 0.18);
  color: #f5b800;
  border-color: rgba(245, 184, 0, 0.5);
}
.lux-badge-gray {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  border-color: rgba(148, 163, 184, 0.35);
}

/* ============================================================
   FIX-2026-08-05: Bot search & filter bar (หน้า /bots.html)
   - search input (with icon + clear button)
   - filter chips (multi-select)
   - counter pill
   - empty-state card (no-results)
   ============================================================ */

/* FIX-2026-08-05: hide-by-filter — ใช้กับ bot card ที่ไม่ตรง search/filter
   - CSS-only hide (ไม่ลบ DOM) → preserve mini-chart state เมื่อ filter เปลี่ยน
   - เมื่อ user ล้าง filter → การ์ดกลับมาทันที (state + chart พร้อมใช้)
   - ใช้ !important เพื่อ override responsive rules อื่นๆ ที่อาจบังคับ display */
.bot-card-v2.is-hidden-by-filter { display: none !important; }

.bot-search-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem 0.75rem;
  margin-bottom: 0.85rem;
  padding: 0.65rem 0.85rem;
  background: linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0.012));
  border: 1px solid var(--border-soft);
  border-radius: 10px;
}

/* search input wrapper */
.bot-search-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  background: rgba(7, 11, 20, 0.65);
  border: 1px solid var(--border-mid);
  border-radius: 8px;
  padding: 0 0.55rem;
  min-width: 280px;
  flex: 1 1 280px;
  max-width: 480px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.bot-search-wrap:focus-within {
  border-color: rgba(245, 184, 0, 0.6);
  box-shadow: 0 0 0 3px rgba(245, 184, 0, 0.10);
  background: rgba(7, 11, 20, 0.85);
}
.bot-search-icon {
  color: var(--text-3);
  font-size: 0.95rem;
  margin-right: 0.45rem;
  flex-shrink: 0;
  line-height: 1;
}
.bot-search-input {
  background: transparent;
  border: 0;
  color: var(--text-1);
  font-size: 0.88rem;
  padding: 0.45rem 0;
  flex: 1 1 auto;
  min-width: 0;
  outline: none;
  font-family: inherit;
}
.bot-search-input::placeholder { color: var(--text-3); }
.bot-search-clear {
  background: transparent;
  border: 0;
  color: var(--text-3);
  font-size: 1.25rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0 0.2rem;
  margin-left: 0.2rem;
  line-height: 1;
  border-radius: 50%;
  width: 1.4rem;
  height: 1.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
}
.bot-search-clear:hover {
  color: var(--bear-1);
  background: rgba(255, 77, 109, 0.10);
}

/* filter chip group */
.bot-filter-chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.bot-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.7rem;
  font-size: 0.76rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-soft);
  color: var(--text-2);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.12s;
  font-family: inherit;
  white-space: nowrap;
  user-select: none;
}
.bot-chip:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--border-strong);
  color: var(--text-1);
}
.bot-chip.is-active {
  background: linear-gradient(180deg, rgba(241, 194, 82, 0.22), rgba(241, 194, 82, 0.12));
  border-color: rgba(241, 194, 82, 0.85);
  color: var(--gold);
  box-shadow: 0 0 0 2px rgba(245, 184, 0, 0.08);
}
.bot-chip.is-active:hover {
  background: linear-gradient(180deg, rgba(241, 194, 82, 0.30), rgba(241, 194, 82, 0.18));
  color: var(--gold);
}
.bot-chip.is-clear {
  background: rgba(255, 77, 109, 0.10);
  border-color: rgba(255, 77, 109, 0.30);
  color: var(--bear-1);
}
.bot-chip.is-clear:hover {
  background: rgba(255, 77, 109, 0.20);
  border-color: rgba(255, 77, 109, 0.55);
  color: var(--bear-1);
}

/* counter pill (inline with title) */
.bot-filter-counter {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-3);
  font-family: var(--font-mono);
  padding: 0.18rem 0.55rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  margin-left: 0.5rem;
  vertical-align: middle;
  letter-spacing: 0.02em;
  transition: all 0.15s;
}
.bot-filter-counter.is-filtered {
  color: var(--gold);
  border-color: rgba(241, 194, 82, 0.55);
  background: rgba(241, 194, 82, 0.10);
}

/* empty state (no-results after filter) */
.bot-search-empty {
  text-align: center;
  padding: 2.5rem 1.5rem;
  background: rgba(255, 255, 255, 0.018);
  border: 1px dashed var(--border-soft);
  border-radius: 12px;
  color: var(--text-2);
}
.bot-search-empty .glyph {
  font-size: 2.2rem;
  display: block;
  margin-bottom: 0.6rem;
  opacity: 0.55;
  line-height: 1;
}
.bot-search-empty .ttl {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 0.3rem;
}
.bot-search-empty .sub {
  font-size: 0.85rem;
  color: var(--text-3);
  margin-bottom: 1rem;
}
.bot-search-empty .btn-lux { margin-top: 0.3rem; }

/* responsive: stack on narrow screens */
@media (max-width: 640px) {
  .bot-search-wrap { min-width: 100%; max-width: 100%; }
  .bot-filter-chips { width: 100%; }
  .bot-chip { font-size: 0.72rem; padding: 0.25rem 0.55rem; }
}

/* ============================================================
   2026-08-06: Daily Profit Target gauge — HORIZONTAL BAR (BNB fuel style)
   - Sticky bar directly under .app-nav (full-width), visible on
     every page (skip on login)
   - 2 rows (cleaner — stats now live in popover only):
       Row 1: 🎯 ฿<PnL>  <USDT>  <pct>  <status>      |  <target pill ✎> ℹ
       Row 2: [============= horizontal bar =============]
   - 5 zones (cold/warming/hot/achieved/loss) — same color theme
     as the original radial version, just horizontal
   - 🎉 confetti burst when target is newly achieved
   ============================================================ */

.daily-target-bar {
  position: sticky; top: 0; z-index: 1029; /* under navbar (1030) */
  background: linear-gradient(180deg, rgba(7,11,20,0.86), rgba(7,11,20,0.72));
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border-soft);
  padding: 0.5rem 1rem 0.55rem;
  font-family: var(--font-sans);
}
.daily-target-bar.is-loading { opacity: 0.55; }
.daily-target-bar .dtb-inner {
  max-width: 1400px; margin: 0 auto;
}

/* ── Row 1: PnL number + target pill + ℹ ───────────────── */
.daily-target-bar .dtb-row {
  display: flex; align-items: center;
  width: 100%;
}
.daily-target-bar .dtb-row-main {
  gap: 0.6rem; margin-bottom: 0.4rem;
  flex-wrap: wrap;
}
.daily-target-bar .dtb-number {
  flex: 1 1 auto; min-width: 0;
  display: flex; align-items: baseline; gap: 0.55rem;
  flex-wrap: wrap;
}
.daily-target-bar .dtb-number-emoji {
  font-size: 1rem;
  flex: 0 0 auto;
}
.daily-target-bar .dtb-number-value {
  font-family: var(--font-mono);
  font-size: 1.35rem; font-weight: 800;
  color: var(--text-1);
  letter-spacing: -0.02em;
  line-height: 1.1;
  flex: 0 0 auto;
}
.daily-target-bar .dtb-number-usdt {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-3);
  font-weight: 500;
  flex: 0 0 auto;
}
.daily-target-bar .dtb-number-pct {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.10);
  color: var(--text-2);
  flex: 0 0 auto;
  min-width: 48px; text-align: center;
}
.daily-target-bar .dtb-number-status {
  font-size: 0.75rem;
  color: var(--text-3);
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* zone tints on the row 1 elements */
.daily-target-bar.zone-cold     .dtb-number-value { color: var(--text-1); }
.daily-target-bar.zone-warming  .dtb-number-value { color: var(--gold-2); text-shadow: 0 0 10px rgba(245,184,0,0.3); }
.daily-target-bar.zone-hot      .dtb-number-value { color: var(--bull-1); text-shadow: 0 0 14px rgba(0,229,184,0.4); }
.daily-target-bar.zone-loss     .dtb-number-value { color: var(--bear-2); text-shadow: 0 0 14px rgba(255,77,109,0.4); }
.daily-target-bar.zone-achieved .dtb-number-value {
  background: linear-gradient(90deg, var(--gold-1), var(--bull-1), var(--gold-2));
  background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: dtb-shimmer-text 2.4s linear infinite;
}
.daily-target-bar .dtb-number-value.is-flash {
  animation: dtb-flash 700ms ease;
}
@keyframes dtb-shimmer-text {
  0%   { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}
@keyframes dtb-flash {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* target pill (right side) */
.daily-target-bar .dtb-target {
  display: inline-flex; align-items: center; gap: 0.4rem;
  flex: 0 0 auto;
  padding: 0.32rem 0.7rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-2);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
  user-select: none;
}
.daily-target-bar .dtb-target:hover {
  border-color: rgba(245,184,0,0.4);
  background: rgba(245,184,0,0.06);
  color: var(--gold-1);
}
.daily-target-bar .dtb-target-label { color: var(--text-3); font-size: 0.7rem; }
.daily-target-bar .dtb-target-value { font-weight: 700; color: var(--gold-1); }
.daily-target-bar .dtb-target-edit  { margin-left: 0.15rem; font-size: 0.85rem; color: var(--text-3); }
.daily-target-bar .dtb-target:hover .dtb-target-edit { color: var(--gold-1); }

/* inline target editor */
.daily-target-bar .dtb-target-edit-wrap {
  display: none; align-items: center; gap: 0.35rem;
  flex: 0 0 auto;
}
.daily-target-bar .dtb-target-edit-wrap.is-open { display: inline-flex; }
.daily-target-bar .dtb-target-input {
  width: 90px;
  padding: 0.28rem 0.5rem;
  background: var(--bg-2);
  border: 1px solid rgba(245,184,0,0.35);
  border-radius: 8px;
  color: var(--gold-1);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  text-align: right;
  outline: none;
}
.daily-target-bar .dtb-target-input:focus { border-color: var(--gold-1); box-shadow: 0 0 0 3px rgba(245,184,0,0.18); }
.daily-target-bar .dtb-target-save {
  background: var(--gold-1); color: #1a1208; border: none;
  border-radius: 8px; padding: 0.28rem 0.55rem; font-weight: 700;
  font-size: 0.78rem; cursor: pointer;
}
.daily-target-bar .dtb-target-save:disabled { opacity: 0.5; cursor: wait; }
.daily-target-bar .dtb-target-cancel {
  background: transparent; color: var(--text-3); border: 1px solid var(--border-soft);
  border-radius: 8px; padding: 0.28rem 0.5rem; font-size: 0.78rem; cursor: pointer;
}

/* ℹ summary button (now in row 1, after target pill) */
.daily-target-bar .dtb-info {
  background: transparent;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 0.28rem 0.65rem;
  font-size: 0.72rem;
  color: var(--text-3);
  cursor: pointer;
  font-family: var(--font-sans);
  flex: 0 0 auto;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.daily-target-bar .dtb-info:hover {
  color: var(--gold-1);
  border-color: rgba(245,184,0,0.4);
  background: rgba(245,184,0,0.06);
}

/* ── Row 2: horizontal progress bar ──────────────────────── */
/* Increased visibility: bigger height + dark track + light border + inner shadow.
   Previous rgba(255,255,255,0.06) on the dark glass was nearly invisible. */
.daily-target-bar .dtb-row-bar {
  margin: 0.4rem 0 0.35rem;
  min-height: 22px;       /* safety: prevent flex from collapsing */
  display: block;          /* override .dtb-row flex — single child, no need */
}
.daily-target-bar .dtb-bar-track {
  position: relative;
  height: 22px;
  background: #0a0e1a;     /* solid near-black for max contrast against glass */
  border: 2px solid rgba(255,255,255,0.25);
  border-radius: 999px;
  overflow: hidden;
  box-shadow:
    inset 0 2px 6px rgba(0,0,0,0.8),
    inset 0 -1px 0 rgba(255,255,255,0.06),
    0 0 0 1px rgba(0,0,0,0.4);
}
/* subtle zone marker ticks at 30% / 70% / 100% */
.daily-target-bar .dtb-bar-track::before,
.daily-target-bar .dtb-bar-track::after {
  content: '';
  position: absolute;
  top: 3px; bottom: 3px;
  width: 1px;
  background: rgba(255,255,255,0.22);
  pointer-events: none;
  z-index: 1;
}
.daily-target-bar .dtb-bar-track::before { left: 30%; }
.daily-target-bar .dtb-bar-track::after  { left: 70%; }
.daily-target-bar .dtb-bar-track > .dtb-bar-fill { position: relative; z-index: 2; }

.daily-target-bar .dtb-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  transition: width 700ms cubic-bezier(.2,.8,.2,1), background 300ms ease, box-shadow 300ms ease;
}
/* zone fills (boosted contrast + thicker glow for visibility) */
.daily-target-bar.zone-cold .dtb-bar-fill {
  background: linear-gradient(90deg, #5b7290 0%, #90b0d8 100%);
  box-shadow: 0 0 12px rgba(120,160,210,0.7);
}
.daily-target-bar.zone-warming .dtb-bar-fill {
  background: linear-gradient(90deg, #f5b800 0%, #ffd76a 100%);
  box-shadow: 0 0 14px rgba(245,184,0,0.75);
}
.daily-target-bar.zone-hot .dtb-bar-fill {
  background: linear-gradient(90deg, #00e5b8 0%, #80ffd0 100%);
  box-shadow: 0 0 16px rgba(0,229,184,0.8);
}
.daily-target-bar.zone-achieved .dtb-bar-fill {
  background: linear-gradient(90deg, #f5b800 0%, #00e5b8 35%, #5dc4ff 65%, #ffd76a 100%);
  background-size: 200% 100%;
  box-shadow: 0 0 18px rgba(245,184,0,0.9);
  animation: dtb-shimmer-bar 2.4s linear infinite;
}
.daily-target-bar.zone-loss .dtb-bar-fill {
  background: linear-gradient(90deg, #ff4d6d 0%, #ff85a0 100%);
  box-shadow: 0 0 14px rgba(255,77,109,0.75);
}
@keyframes dtb-shimmer-bar {
  0%   { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* ── Popover (breakdown) ────────────────────────────────── */
.daily-target-bar .dtb-popover {
  position: absolute;
  top: calc(100% + 6px); right: 1rem;
  width: 280px;
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-3) 100%);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-3);
  padding: 0.85rem 1rem;
  z-index: 1031;
  display: none;
}
.daily-target-bar .dtb-popover.is-open { display: block; }
.daily-target-bar .dtb-popover h6 {
  margin: 0 0 0.5rem; font-size: 0.78rem; color: var(--text-2);
  letter-spacing: 0.06em; text-transform: uppercase;
}
.daily-target-bar .dtb-popover .dtb-popover-row {
  display: flex; justify-content: space-between;
  font-family: var(--font-mono); font-size: 0.78rem;
  color: var(--text-2);
  padding: 0.18rem 0;
}
.daily-target-bar .dtb-popover .dtb-popover-row .label { color: var(--text-3); }
.daily-target-bar .dtb-popover .dtb-popover-row .val-win  { color: var(--bull-1); font-weight: 700; }
.daily-target-bar .dtb-popover .dtb-popover-row .val-loss { color: var(--bear-2); font-weight: 700; }
.daily-target-bar .dtb-popover .dtb-popover-hint {
  margin-top: 0.6rem; font-size: 0.7rem; color: var(--text-4);
  border-top: 1px dashed var(--border-soft); padding-top: 0.5rem;
}

/* ── Confetti ───────────────────────────────────────────── */
.daily-target-bar .dtb-confetti {
  position: absolute; inset: 0;
  pointer-events: none; overflow: hidden;
  border-radius: inherit;
}
.daily-target-bar .dtb-confetti span {
  position: absolute; top: 30%; left: 50%;
  width: 6px; height: 12px; border-radius: 2px;
  background: var(--gold-1);
  opacity: 0;
  animation: dtb-confetti 1.2s ease-out forwards;
}
@keyframes dtb-confetti {
  0%   { transform: translate(-50%, -50%) rotate(0deg); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--cx, 80px)), calc(-50% + var(--cy, -60px))) rotate(var(--rot, 360deg)); opacity: 0; }
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 900px) {
  /* status label hidden on medium — emoji + pct + target pill convey zone */
  .daily-target-bar .dtb-number-status { display: none; }
}
@media (max-width: 640px) {
  .daily-target-bar { padding: 0.4rem 0.75rem 0.45rem; }
  .daily-target-bar .dtb-number-value { font-size: 1.1rem; }
  .daily-target-bar .dtb-number-usdt { font-size: 0.7rem; }
  .daily-target-bar .dtb-number-pct  { font-size: 0.68rem; padding: 0.08rem 0.4rem; }
  .daily-target-bar .dtb-target { padding: 0.25rem 0.55rem; font-size: 0.72rem; }
  .daily-target-bar .dtb-info { font-size: 0.65rem; padding: 0.2rem 0.5rem; }
  .daily-target-bar .dtb-row-bar { min-height: 18px; }
  .daily-target-bar .dtb-bar-track { height: 18px; }
  /* popover on mobile: right-aligned to bar edge */
  .daily-target-bar .dtb-popover { right: 0.75rem; width: 260px; }
}
@media (max-width: 420px) {
  /* ultra-narrow: shrink everything to fit one screen row */
  .daily-target-bar { padding: 0.35rem 0.65rem 0.4rem; }
  .daily-target-bar .dtb-number-value { font-size: 0.98rem; }
  .daily-target-bar .dtb-target { font-size: 0.68rem; padding: 0.22rem 0.45rem; }
  .daily-target-bar .dtb-target-edit { display: none; } /* tighten on tiny screens */
  .daily-target-bar .dtb-info { font-size: 0.62rem; padding: 0.18rem 0.4rem; }
  .daily-target-bar .dtb-row-bar { min-height: 14px; }
  .daily-target-bar .dtb-bar-track { height: 14px; }
}

/* ── FIX-2026-08-06: CBv2 cooldown banner (HYBRID — บอทยัง enabled) ─── */
.bot-card-v2 .bc-cbv2-cooldown {
  margin-top: 0.5rem; margin-bottom: 0.55rem;
  font-size: 0.78rem; color: #f0b90b;
  font-family: var(--font-mono); padding: 0.4rem 0.55rem;
  background: rgba(240,185,11,0.08); border-radius: 6px;
  border-left: 2px solid #f0b90b;
  display: flex; align-items: center; gap: 0.5rem;
}
.bot-card-v2 .bc-cbv2-cooldown-msg {
  flex: 1; word-break: break-word; line-height: 1.45;
}
.bot-card-v2 .bc-cbv2-cooldown-msg a {
  color: #f0b90b; text-decoration: underline; margin-left: 0.25rem;
}
.bot-card-v2.has-cbv2-cooldown::before {
  background: linear-gradient(180deg, rgba(240,185,11,0.6), rgba(240,185,11,0.15)) !important;
}

/* ── FIX-2026-08-08: Feature #2 — CBv3 cooldown banner (mirror CBv2) ─── */
.bot-card-v2 .bc-cbv3-cooldown {
  margin-top: 0.5rem; margin-bottom: 0.55rem;
  font-size: 0.78rem; color: #f0b90b;
  font-family: var(--font-mono); padding: 0.4rem 0.55rem;
  background: rgba(240,185,11,0.10); border-radius: 6px;
  border-left: 2px solid #f5b800;
  display: flex; align-items: center; gap: 0.5rem;
}
.bot-card-v2 .bc-cbv3-cooldown-msg {
  flex: 1; word-break: break-word; line-height: 1.45;
}
.bot-card-v2 .bc-cbv3-cooldown-msg a {
  color: #f5b800; text-decoration: underline; margin-left: 0.25rem;
}
.bot-card-v2.has-cbv3-cooldown::before {
  background: linear-gradient(180deg, rgba(245,184,0,0.7), rgba(245,184,0,0.20)) !important;
}

/* ── FIX-2026-08-08: Feature #1 — DPS indicator (Dynamic Position Sizing) ─── */
.bot-card-v2 .bc-dps-indicator {
  margin-top: 0.5rem; margin-bottom: 0.5rem;
  font-size: 0.75rem; color: #94a3b8;
  font-family: var(--font-mono); padding: 0.35rem 0.5rem;
  background: rgba(0,229,184,0.05); border-radius: 6px;
  border-left: 2px solid #00e5b8;
  display: flex; align-items: center; gap: 0.5rem;
}
.bot-card-v2 .bc-dps-label {
  color: #00e5b8; font-weight: 600;
}
.bot-card-v2 .bc-dps-value {
  flex: 1; word-break: break-word;
}
