/* B-PG-018: BotSwitcher — pill-капсула в topbar */
.bs-capsule {
  position: relative;
  margin-right: 8px;
  z-index: 50;
}

.bs-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px 8px 12px;
  border: none;
  border-radius: 999px;
  background: #2a2b2f;
  color: #e2e4e9;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  white-space: nowrap;
  line-height: 1.2;
  height: 38px;
  box-sizing: border-box;
}

.bs-pill:hover {
  background: #35363b;
}

.bs-capsule.bs-open .bs-pill {
  background: #35363b;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.bs-icon {
  display: flex;
  align-items: center;
  color: var(--color-muted, #909091);
  opacity: .9;
}
.bs-pill:hover .bs-icon {
  opacity: 1;
}

.bs-name {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bs-chev {
  display: flex;
  align-items: center;
  color: #6b7280;
  transition: transform 0.2s;
}

.bs-capsule.bs-open .bs-chev {
  transform: rotate(180deg);
}

/* Dropdown */
.bs-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  background: #1e1f23;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 4px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  animation: bs-fade-in 0.12s ease-out;
}

@keyframes bs-fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.bs-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: none;
  color: #d1d5db;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: background 0.1s;
}

.bs-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.bs-item-active {
  background: rgba(255, 255, 255, 0.04);
}

.bs-item-icon {
  display: flex;
  align-items: center;
  color: #6b7280;
  flex-shrink: 0;
}

.bs-item-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.bs-item-name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #e5e7eb;
}

.bs-item-id {
  font-size: 11px;
  color: #6b7280;
  font-family: monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bs-check {
  color: #22c55e;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
  margin-left: auto;
}

/* Mobile: скрываем текст, показываем только иконку */
@media (max-width: 640px) {
  .bs-name { display: none; }
  .bs-chev { display: none; }
  .bs-pill { padding: 7px 9px; height: 34px; }
  .bs-capsule { margin-right: 6px; }
  .bs-dropdown {
    left: auto;
    right: -8px;
    min-width: 200px;
  }
}

/* ─── B-PG-019: Stats page ──────────────────────────────────────── */
.bs-stats-page {
  padding: 24px 28px 40px;
  max-width: 900px;
  margin: 0 auto;
  color: #e2e4e9;
}

.bs-stats-header {
  margin-bottom: 20px;
}

.bs-stats-back {
  background: none;
  border: none;
  color: #6b7280;
  font-size: 14px;
  cursor: pointer;
  padding: 4px 0;
  margin-bottom: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.15s;
}
.bs-stats-back:hover { color: #e2e4e9; }

.bs-stats-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bs-stats-bot-icon {
  display: flex;
  color: var(--color-muted, #909091);
}

.bs-stats-bot-name {
  font-size: 20px;
  font-weight: 600;
}

.bs-stats-badge {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(106, 95, 191, 0.2);
  color: #a5a0e0;
}

/* Period tabs */
.bs-stats-periods {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
}

.bs-stats-period {
  background: #2a2b2f;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  color: #9ca3af;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 16px;
  cursor: pointer;
  transition: all 0.15s;
}
.bs-stats-period:hover { background: #35363b; color: #e2e4e9; }
.bs-stats-period.active {
  background: rgba(106, 95, 191, 0.15);
  color: #c4bfff;
  border-color: rgba(106, 95, 191, 0.3);
}

/* Metric cards */
.bs-stats-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.bs-stat-card {
  background: #222328;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 16px 18px;
}

.bs-stat-val {
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.bs-stat-in { color: #22c55e; }
.bs-stat-out { color: #3b82f6; }

.bs-stat-label {
  font-size: 12px;
  color: #6b7280;
  margin-top: 4px;
}

/* Chart wrappers */
.bs-stats-chart-wrap {
  background: #222328;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 16px;
}
.bs-stats-chart-wrap h3 {
  font-size: 15px;
  font-weight: 600;
  color: #d1d5db;
  margin: 0 0 12px;
}

/* Tables */
.bs-stats-table-wrap {
  background: #222328;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 16px;
}
.bs-stats-table-wrap h3 {
  font-size: 15px;
  font-weight: 600;
  color: #d1d5db;
  margin: 0 0 12px;
}

.bs-stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.bs-stats-table th {
  text-align: left;
  color: #6b7280;
  font-weight: 500;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.bs-stats-table td {
  padding: 8px 10px;
  color: #d1d5db;
}
.bs-stats-table tbody tr:nth-child(even) {
  background: rgba(255,255,255,0.02);
}
.bs-stats-table .bs-num {
  font-variant-numeric: tabular-nums;
  text-align: right;
  font-weight: 500;
}
.bs-stats-table .muted {
  color: #6b7280;
  text-align: center;
}

/* Stats button on bot cards */
.bs-stats-btn {
  color: #6b7280;
  transition: color 0.15s;
}
.bs-stats-btn:hover {
  color: #a5a0e0;
}

/* Mobile */
@media (max-width: 640px) {
  .bs-stats-page { padding: 16px; }
  .bs-stats-cards { grid-template-columns: repeat(2, 1fr); }
  .bs-stat-val { font-size: 22px; }
  .bs-stats-bot-name { font-size: 17px; }
}
