/* Screenshot-accurate refinements (473px mobile designs) */

:root {
  --phone-w: 473px;
  --bg: #0B0E11;
  --card: #181A20;
  --card-2: #1E2026;
}

body { background: #000; }
.app-shell { background: #000; }
.app-frame {
  background: #0B0E11;
  box-shadow: none;
}
.app-content { padding: 0 14px 88px; }

/* —— Bots page hero —— */
.bots-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.bots-hero-left {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}
.bots-hero-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--yellow);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.bots-hero .page-title { font-size: 26px; }
.bots-hero .page-subtitle { font-size: 12px; margin-top: 2px; line-height: 1.35; }
.btn-create-bot {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: var(--yellow);
  color: #0B0E11;
  border-radius: 12px;
  padding: 10px 12px;
  min-width: 88px;
  font-weight: 700;
  font-size: 11px;
  line-height: 1.2;
  text-align: center;
  flex-shrink: 0;
}
.btn-create-bot svg { width: 18px; height: 18px; stroke-width: 2.5; }

/* —— 4 equal stat cards —— */
.stats-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.stats-4 .stat-card {
  background: var(--card);
  border: 1px solid #1E2329;
  border-radius: 10px;
  padding: 10px 8px;
  position: relative;
  overflow: hidden;
  min-width: 0;
}
.stats-4 .stat-card .label {
  font-size: 10px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stats-4 .stat-card .value {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stats-4 .stat-card .value.lg { font-size: 18px; }
.stats-4 .stat-card .sub {
  font-size: 10px;
  margin-top: 3px;
  font-weight: 500;
}
.stats-4 .ghost-icon {
  position: absolute;
  right: -4px;
  bottom: -6px;
  opacity: 0.08;
  pointer-events: none;
}

/* —— Filter tabs row —— */
.filter-tabs-row {
  display: flex;
  align-items: center;
  border-bottom: 1px solid #1E2329;
  margin-bottom: 12px;
}
.filter-tabs-row .tabs {
  flex: 1;
  margin: 0;
  border: none;
  gap: 0;
}
.filter-tabs-row .tab {
  padding: 10px 12px;
  font-size: 13px;
}
.filter-tabs-row .filter-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* —— Bot list row (screenshot columns) —— */
.bot-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1.35fr) minmax(72px, 0.75fr) minmax(72px, 0.75fr) 52px 22px;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid #1E2329;
  border-radius: 12px;
  padding: 12px 10px;
  margin-bottom: 8px;
}
.bot-row .pair {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.bot-row .meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.bot-row .col-stat .lbl {
  font-size: 9px;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.bot-row .col-stat .val {
  font-size: 12px;
  font-weight: 700;
}
.bot-row .col-stat .pct {
  font-size: 10px;
  font-weight: 500;
}
.bot-row .spark { width: 52px; height: 28px; }

.pill-futures {
  background: var(--yellow);
  color: #0B0E11;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  line-height: 1.3;
}
.pill-spot {
  background: rgba(14, 203, 129, 0.15);
  color: var(--green);
  border: 1px solid rgba(14, 203, 129, 0.35);
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  line-height: 1.3;
}
.pill-futures-outline {
  background: transparent;
  color: #F0B90B;
  border: 1px solid #F0B90B;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
}

/* —— Promo banner —— */
.promo-banner {
  background: linear-gradient(105deg, #141414 0%, #1c1810 50%, #141414 100%);
  border: 1px solid #2a2418;
  border-radius: 14px;
  padding: 14px;
  margin: 14px 0 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.promo-banner h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--yellow);
  margin-bottom: 4px;
}
.promo-banner p {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 10px;
}
.promo-banner .btn-yellow-outline {
  padding: 6px 14px;
  font-size: 12px;
  border-radius: 8px;
}

/* —— Bot summary (detail header) —— */
.bot-summary {
  background: transparent;
  border: none;
  padding: 0 0 8px;
  margin-bottom: 4px;
}
.bot-summary-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.bot-summary-pair {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}
.bot-summary-strategy {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}
.bot-summary-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin-top: 14px;
  padding: 12px 0;
  border-top: 1px solid #1E2329;
  border-bottom: 1px solid #1E2329;
}
.bot-summary-metrics > div {
  text-align: center;
  padding: 0 4px;
  border-right: 1px solid #1E2329;
}
.bot-summary-metrics > div:last-child { border-right: none; }
.bot-summary-metrics .label { font-size: 10px; display: block; margin-bottom: 4px; }
.bot-summary-metrics .value { font-size: 12px; font-weight: 600; color: #fff; }

.profit-block { text-align: right; }
.profit-block .label { font-size: 10px; }
.profit-block .amt { font-size: 16px; font-weight: 700; }
.profit-block .pct { font-size: 11px; font-weight: 500; }

/* —— Actions sheet matches screenshot —— */
.modal-overlay {
  z-index: 400;
}
.modal-overlay.open {
  display: flex;
  z-index: 400;
}
.modal-overlay.open ~ .bottom-nav,
.app-frame:has(.modal-overlay.open) .bottom-nav {
  display: none;
}
.modal-sheet {
  background: #1A1D24;
  border-radius: 20px 20px 0 0;
  padding: 8px 16px 36px;
  max-height: 72vh;
  overflow-y: auto;
  width: 100%;
  max-width: var(--phone-w);
}
.modal-sheet .action-item {
  padding: 13px 2px;
  border-bottom: 1px solid #252830;
  cursor: pointer;
}
.modal-sheet .action-item:last-child {
  border-bottom: none;
}
.modal-sheet .action-icon {
  width: 42px;
  height: 42px;
}
.modal-sheet .action-body .title { font-size: 15px; }
.modal-sheet .action-body .desc { font-size: 12px; margin-top: 2px; }

/* Overview details under modal */
.overview-details {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 12px;
  margin-top: 8px;
}
.overview-details .detail-list .row {
  padding: 5px 0;
  font-size: 11px;
}
.overview-details .detail-list .k { color: var(--text-muted); }
.overview-details .detail-list .v { color: #fff; font-weight: 500; }

.alloc-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.alloc-legend {
  width: 100%;
  margin-top: 8px;
}
.alloc-legend .legend-item {
  font-size: 11px;
  justify-content: flex-start;
}

/* Recent trade row */
.recent-trade {
  display: grid;
  grid-template-columns: 32px 1fr auto auto auto;
  gap: 10px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #1E2329;
}
.recent-trade:last-child { border-bottom: none; }
.recent-trade .pair-line {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.recent-trade .stat {
  text-align: right;
  min-width: 58px;
}
.recent-trade .stat .label { font-size: 9px; display: block; }
.recent-trade .stat .val { font-size: 12px; font-weight: 700; }

@media (max-width: 400px) {
  .bot-row {
    grid-template-columns: 36px minmax(0, 1.2fr) minmax(64px, 0.7fr) minmax(64px, 0.7fr) 44px 18px;
    gap: 6px;
    padding: 10px 8px;
  }
  .stats-4 .stat-card .value { font-size: 13px; }
  .stats-4 .stat-card .value.lg { font-size: 15px; }
  .overview-details { grid-template-columns: 1fr; }
}
