/* ============================================================
   Bot detail (Overview / Positions / History / Logs / Settings)
   ============================================================ */
.bd {
  --bd-card: #14171C;
  --bd-sheet: #16191F;
  --bd-line: #21262E;
  --bd-muted: #848E9C;
  --bd-white: #EAECEF;
  --bd-gold: #F0B90B;
  --bd-green: #0ECB81;
  --bd-red: #F6465D;
}

/* ---------- Summary ---------- */
.bd-summary {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 2px 0 14px;
}
.bd-summary .crypto-avatar {
  width: 44px;
  height: 44px;
  font-size: 19px;
  flex-shrink: 0;
}
.bd-id { min-width: 0; flex: 1; }
.bd-id-top {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}
.bd-pair {
  font-size: 14.5px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.bd-badge {
  flex-shrink: 0;
  font-size: 8.5px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 5px;
  line-height: 1.3;
  white-space: nowrap;
  border: 1px solid rgba(240, 185, 11, 0.45);
  color: var(--bd-gold);
}
.bd-badge.spot {
  border-color: rgba(14, 203, 129, 0.45);
  color: var(--bd-green);
}
.bd-strategy {
  margin-top: 5px;
  font-size: 10px;
  color: var(--bd-muted);
  white-space: nowrap;
}
.bd-state {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.bd-state i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.bd-state.on { color: var(--bd-green); }
.bd-state.pause { color: var(--bd-gold); }
.bd-state.off { color: var(--bd-muted); }

.bd-pnl {
  display: flex;
  align-items: stretch;
  flex-shrink: 0;
}
.bd-pnl-col { padding: 0 11px; }
.bd-pnl-col + .bd-pnl-col {
  border-left: 1px solid var(--bd-line);
  padding-right: 0;
}
.bd-pnl-col .k {
  font-size: 9px;
  color: var(--bd-muted);
  white-space: nowrap;
}
.bd-pnl-col .v {
  margin-top: 6px;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}
.bd-pnl-col .d {
  margin-top: 5px;
  font-size: 9px;
  font-weight: 500;
  white-space: nowrap;
}
.bd-pnl-col .spark { margin-top: 6px; }

/* ---------- Metrics strip ---------- */
.bd-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--bd-card);
  border: 1px solid var(--bd-line);
  border-radius: 12px;
  padding: 12px 0;
  margin-bottom: 4px;
}
.bd-metric { padding: 0 10px; }
.bd-metric + .bd-metric { border-left: 1px solid var(--bd-line); }
.bd-metric .k {
  display: block;
  font-size: 9.5px;
  color: var(--bd-muted);
  white-space: nowrap;
}
.bd-metric .v {
  display: block;
  margin-top: 7px;
  font-size: 12.5px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

/* ---------- Tabs ---------- */
.bd-tabs {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 2px;
  margin: 10px 0 12px;
}
.bd-tab {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex: 1;
  padding: 8px 2px 11px;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--bd-muted);
  white-space: nowrap;
}
.bd-tab svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}
.bd-tab.is-on { color: var(--bd-gold); font-weight: 600; }
.bd-tab.is-on::after {
  content: '';
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--bd-gold);
}

/* ---------- Actions sheet ---------- */
.bd-sheet {
  background: var(--bd-sheet);
  border: 1px solid var(--bd-line);
  border-radius: 16px 16px 12px 12px;
  padding: 8px 12px 4px;
  margin-bottom: 12px;
}
.bd-sheet[hidden] { display: none; }
.bd-sheet-grip {
  width: 38px;
  height: 4px;
  border-radius: 2px;
  background: #3A414C;
  margin: 0 auto 6px;
}
.bd-sheet-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0 10px;
}
.bd-sheet-h h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}
.bd-sheet-x {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  color: var(--bd-white);
}
.bd-sheet-x svg { width: 16px; height: 16px; }

.bd-act {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 0;
  border-top: 1px solid var(--bd-line);
}
.bd-act-ico {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  color: #fff;
}
.bd-act-ico svg { width: 16px; height: 16px; }
.bd-act-ico.green  { background: #0ECB81; }
.bd-act-ico.gold   { background: #F0B90B; color: #14171C; }
.bd-act-ico.blue   { background: #3B7FF6; }
.bd-act-ico.violet { background: #6E5AE6; }
.bd-act-ico.orange { background: #F5842B; }
.bd-act-ico.red    { background: #E8384F; }

.bd-act-body { flex: 1; min-width: 0; }
.bd-act-body .t,
.bd-act-body .d { display: block; }
.bd-act-body .t {
  font-size: 12.5px;
  font-weight: 600;
  color: #fff;
}
.bd-act-body .d {
  margin-top: 3px;
  font-size: 9.5px;
  color: var(--bd-muted);
}
.bd-act-go {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: var(--bd-muted);
}
.bd-act-go svg { width: 16px; height: 16px; }
.bd-act.danger .t { color: var(--bd-red); }
.bd-act.danger .bd-act-go { color: var(--bd-red); }

/* ---------- Overview details ---------- */
.bd-details {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  background: var(--bd-card);
  border: 1px solid var(--bd-line);
  border-radius: 12px;
  padding: 13px 12px;
}
.bd-kv-row {
  display: flex;
  gap: 6px;
  padding: 5px 0;
  font-size: 9.5px;
  line-height: 1.4;
  white-space: nowrap;
}
.bd-kv-row .k {
  width: 68px;
  flex-shrink: 0;
  color: var(--bd-muted);
}
.bd-kv-row .v { color: var(--bd-white); min-width: 0; }

.bd-alloc {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 12px;
  border-left: 1px solid var(--bd-line);
}
.bd-alloc-donut {
  width: 92px;
  height: 92px;
  flex-shrink: 0;
  position: relative;
}
.bd-alloc-legend {
  display: flex;
  flex-direction: column;
  gap: 11px;
  min-width: 0;
}
.bd-alloc-item {
  display: grid;
  grid-template-columns: 7px minmax(0, 1fr);
  column-gap: 6px;
  align-items: start;
}
.bd-alloc-item i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-top: 4px;
}
.bd-alloc-item .p {
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  line-height: 1.3;
}
.bd-alloc-item .n,
.bd-alloc-item .a {
  grid-column: 2;
  font-size: 9px;
  color: var(--bd-muted);
  line-height: 1.45;
}

/* ---------- Positions ---------- */
.bd-panel {
  background: var(--bd-card);
  border: 1px solid var(--bd-line);
  border-radius: 14px;
  padding: 13px 9px 11px;
}
.bd-panel-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.bd-panel-h .ttl {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.bd-panel-h h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
}
.bd-count {
  font-size: 8.5px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 5px;
  white-space: nowrap;
  background: rgba(240, 185, 11, 0.14);
  color: var(--bd-gold);
}
.bd-seg {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
.bd-seg button {
  padding: 5px 11px;
  border-radius: 7px;
  font-size: 10px;
  font-weight: 600;
  color: var(--bd-muted);
  background: #1B1F26;
  white-space: nowrap;
}
.bd-seg button.active { background: var(--bd-gold); color: #0B0E11; }
.bd-seg .filter {
  width: 27px;
  height: 25px;
  display: grid;
  place-items: center;
  padding: 0;
  background: transparent;
  border: 1px solid var(--bd-line);
  color: var(--bd-muted);
}
.bd-seg .filter svg { width: 13px; height: 13px; }

.bd-totals {
  display: grid;
  grid-template-columns: 1.2fr 0.94fr 0.87fr 0.99fr;
  background: #191D24;
  border-radius: 10px;
  padding: 11px 0;
  margin-bottom: 12px;
}
.bd-total { padding: 0 7px; }
.bd-total + .bd-total { border-left: 1px solid #23282F; }
.bd-total .k {
  display: block;
  font-size: 8.5px;
  color: var(--bd-muted);
  line-height: 1.35;
  white-space: nowrap;
}
.bd-total .v {
  display: block;
  margin-top: 7px;
  font-size: 12.5px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}
.bd-total .gauge {
  display: flex;
  align-items: center;
  gap: 5px;
}
.bd-total .gauge svg {
  width: 25px;
  height: 25px;
  flex-shrink: 0;
}

.bd-pos {
  display: grid;
  grid-template-columns:
    minmax(0, 1.6fr) minmax(0, 0.78fr) minmax(0, 0.98fr)
    minmax(0, 0.82fr) minmax(0, 0.82fr) 16px;
  align-items: center;
  gap: 4px;
  padding: 11px 0;
  border-top: 1px solid var(--bd-line);
}
.bd-pos-head {
  border-top: 0;
  border-bottom: 1px solid var(--bd-line);
  padding: 0 0 8px;
  font-size: 8px;
  color: var(--bd-muted);
  white-space: nowrap;
}
/* the P&L heading is wider than its column, so it borrows the menu gutter */
.bd-pos-head > :last-child { grid-column: span 2; }
.bd-pos-head .sort,
.bd-hist-head .sort,
.bd-log-head .sort {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.bd-pos-head .sort svg,
.bd-hist-head .sort svg,
.bd-log-head .sort svg { width: 9px; height: 9px; }

.bd-pos-id {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.bd-pos-id .crypto-avatar {
  width: 24px;
  height: 24px;
  font-size: 10px;
  flex-shrink: 0;
}
.bd-pos-id .nm {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 9.5px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}
.bd-dir {
  flex-shrink: 0;
  font-size: 7px;
  font-weight: 700;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1.3;
}
.bd-dir.long  { background: rgba(14, 203, 129, 0.16); color: var(--bd-green); }
.bd-dir.short { background: rgba(246, 70, 93, 0.16); color: var(--bd-red); }
.bd-pos-id .lev {
  margin-top: 4px;
  font-size: 9px;
  color: var(--bd-muted);
}

.bd-pos .num {
  font-size: 10px;
  color: var(--bd-white);
  white-space: nowrap;
}
.bd-pos .num.strong { font-weight: 700; font-size: 10.5px; }
.bd-pos .sub {
  margin-top: 4px;
  font-size: 8.5px;
  color: var(--bd-muted);
  white-space: nowrap;
}
.bd-pos .sub.pct { font-weight: 500; }
.bd-pos-more {
  width: 16px;
  height: 16px;
  color: var(--bd-white);
  justify-self: end;
}
.bd-pos-more svg { width: 14px; height: 14px; }

.bd-panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  padding-top: 11px;
  border-top: 1px solid var(--bd-line);
  font-size: 9px;
}
.bd-panel-foot .live {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--bd-muted);
}
.bd-panel-foot .live svg { width: 12px; height: 12px; }
.bd-panel-foot .sync {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--bd-gold);
  white-space: nowrap;
}
.bd-panel-foot .sync svg { width: 12px; height: 12px; }

.bd-empty {
  padding: 26px 0;
  text-align: center;
  font-size: 11px;
  color: var(--bd-muted);
}

/* ---------- Date range + pagination (History / Logs) ---------- */
.bd-range {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border-radius: 8px;
  background: #1B1F26;
  border: 1px solid var(--bd-line);
  color: var(--bd-white);
  font-size: 9.5px;
  font-weight: 500;
  white-space: nowrap;
}
.bd-range svg { width: 11px; height: 11px; color: var(--bd-muted); }

.bd-foot-note {
  margin-top: 12px;
  text-align: center;
  font-size: 9.5px;
  color: var(--bd-muted);
}
.bd-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
}
.bd-pager a,
.bd-pager span {
  min-width: 25px;
  height: 25px;
  padding: 0 6px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: #1B1F26;
  color: var(--bd-white);
  font-size: 10px;
  font-weight: 500;
}
.bd-pager .gap { background: transparent; color: var(--bd-muted); }
.bd-pager .is-on {
  background: transparent;
  border: 1px solid var(--bd-gold);
  color: var(--bd-gold);
  font-weight: 600;
}
.bd-pager svg { width: 12px; height: 12px; }

/* ---------- Trade history ---------- */
.bd-hist {
  display: grid;
  grid-template-columns:
    minmax(0, 1.3fr) minmax(0, 1.15fr) 34px minmax(0, 1.35fr)
    minmax(0, 1.15fr) minmax(0, 1fr) 30px;
  align-items: center;
  gap: 4px;
  padding: 10px 0;
  border-top: 1px solid var(--bd-line);
}
.bd-hist-head {
  border-top: 0;
  padding: 0 0 8px;
  font-size: 8px;
  color: var(--bd-muted);
  white-space: nowrap;
}
.bd-hist .d1 {
  font-size: 9px;
  color: var(--bd-white);
  white-space: nowrap;
}
.bd-hist .d2 {
  margin-top: 3px;
  font-size: 8.5px;
  color: var(--bd-muted);
  white-space: nowrap;
}
.bd-hist .pair {
  font-size: 9.5px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}
.bd-lev {
  display: inline-block;
  margin-top: 4px;
  font-size: 7.5px;
  font-weight: 600;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(240, 185, 11, 0.14);
  color: var(--bd-gold);
}
.bd-side {
  display: inline-block;
  font-size: 7.5px;
  font-weight: 700;
  padding: 3px 5px;
  border-radius: 4px;
}
.bd-side.buy  { background: rgba(14, 203, 129, 0.16); color: var(--bd-green); }
.bd-side.sell { background: rgba(246, 70, 93, 0.16); color: var(--bd-red); }
.bd-hist .amt {
  font-size: 9.5px;
  color: var(--bd-white);
  white-space: nowrap;
}
.bd-hist .pnl {
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.bd-result {
  display: inline-block;
  font-size: 7.5px;
  font-weight: 700;
  padding: 3px 5px;
  border-radius: 4px;
}
.bd-result.win  { background: rgba(14, 203, 129, 0.16); color: var(--bd-green); }
.bd-result.loss { background: rgba(246, 70, 93, 0.16); color: var(--bd-red); }

/* ---------- Logs ---------- */
.bd-logs-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.bd-logs-h h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
}
.bd-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  margin-bottom: 11px;
}
.bd-chips::-webkit-scrollbar { display: none; }
.bd-chip {
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: 14px;
  background: #16191F;
  border: 1px solid var(--bd-line);
  color: var(--bd-muted);
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
}
.bd-chip.is-on {
  background: transparent;
  border-color: var(--bd-gold);
  color: var(--bd-gold);
  font-weight: 600;
}
.bd-chips .filter {
  margin-left: auto;
  flex-shrink: 0;
  width: 28px;
  height: 26px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--bd-line);
  color: var(--bd-muted);
}
.bd-chips .filter svg { width: 13px; height: 13px; }

.bd-log {
  display: grid;
  grid-template-columns:
    minmax(0, 1.05fr) minmax(0, 0.9fr) minmax(0, 2.15fr) minmax(0, 1.9fr) 14px;
  align-items: center;
  gap: 4px;
  padding: 10px 0;
  border-top: 1px solid var(--bd-line);
}
.bd-log-head {
  border-top: 0;
  padding: 0 0 8px;
  font-size: 8px;
  color: var(--bd-muted);
  white-space: nowrap;
}
.bd-log .d1 {
  font-size: 9px;
  color: var(--bd-white);
  white-space: nowrap;
}
.bd-log .d2 {
  margin-top: 3px;
  font-size: 8.5px;
  color: var(--bd-muted);
  white-space: nowrap;
}
.bd-log-type {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 9px;
  color: var(--bd-white);
  white-space: nowrap;
}
.bd-log-type svg { width: 13px; height: 13px; flex-shrink: 0; }
.bd-log-type.success { color: var(--bd-green); }
.bd-log-type.info    { color: var(--bd-gold); }
.bd-log-type.down    { color: var(--bd-red); }
.bd-log-type.error   { color: var(--bd-red); }
.bd-log-type span { color: var(--bd-white); }

.bd-log .msg {
  font-size: 9px;
  font-weight: 600;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bd-log .sub,
.bd-log .det {
  margin-top: 3px;
  font-size: 8.5px;
  color: var(--bd-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bd-log .det.lead { margin-top: 0; }
.bd-log .det.green { color: var(--bd-green); }
.bd-log .det.red { color: var(--bd-red); }
.bd-log-go {
  width: 14px;
  height: 14px;
  color: var(--bd-muted);
  justify-self: end;
}
.bd-log-go svg { width: 14px; height: 14px; }

@media (max-width: 400px) {
  .bd-summary .crypto-avatar { width: 40px; height: 40px; font-size: 17px; }
  .bd-pair { font-size: 13.5px; }
  .bd-pnl-col { padding: 0 8px; }
  .bd-pnl-col .v { font-size: 11.5px; }
  .bd-metric { padding: 0 7px; }
  .bd-metric .v { font-size: 11.5px; }
  .bd-tab { font-size: 9.5px; gap: 4px; }
  .bd-kv-row { font-size: 9px; }
  .bd-kv-row .k { width: 62px; }
  .bd-panel { padding: 12px 8px 10px; }
  .bd-total { padding: 0 6px; }
  .bd-total .v { font-size: 11.5px; }
  .bd-pos .num { font-size: 9.5px; }
  .bd-pos .num.strong { font-size: 10px; }
  .bd-alloc-donut { width: 82px; height: 82px; }
}
