.config-panel {
  background: white;
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

@media (min-width: 768px) {
  .config-panel {
    padding: 2rem;
  }
}

.config-header {
  margin-bottom: 2rem;
}

.header-top {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.header-left {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.account-switch {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.account-label {
  font-size: 0.9rem;
  color: #666;
  font-weight: 700;
}

.account-switch select {
  width: auto;
  min-width: 180px;
  padding: 0.5rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
}

.account-hint {
  font-size: 0.85rem;
  color: #666;
}

@media (min-width: 768px) {
  .header-top {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 0;
  }
  .header-left {
    flex-direction: row;
    align-items: center;
    gap: 1rem;
  }
}

.guide-link {
  color: #2196F3;
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  border: 1px solid #2196F3;
  border-radius: 4px;
  transition: all 0.3s;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.snapshot-btn {
  background: #fff;
  cursor: pointer;
}

.snapshot-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.guide-link:hover {
  background: #2196F3;
  color: white;
}

/* 配置快照弹窗 */
.snapshot-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 9999;
}

.snapshot-modal {
  width: min(980px, 100%);
  max-height: 85vh;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.snapshot-modal-header {
  padding: 14px 16px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.snapshot-modal-header h3 {
  margin: 0;
  color: #2c3e50;
}

.snapshot-hint {
  margin-top: 6px;
  font-size: 12px;
  color: #666;
}

.snapshot-close {
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
}

.snapshot-toolbar {
  padding: 12px 16px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.snapshot-checkbox {
  font-size: 13px;
  color: #333;
  display: flex;
  gap: 8px;
  align-items: center;
}

.snapshot-actions {
  display: flex;
  gap: 8px;
}

.snapshot-pre {
  margin: 0;
  padding: 12px 16px;
  overflow: auto;
  background: #0b1020;
  color: #dbeafe;
  font-size: 12px;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
}

.preset-section {
  background: #f8f9fa;
  padding: 1rem;
  border-radius: 8px;
  margin-top: 1rem;
}

@media (min-width: 768px) {
  .preset-section {
    padding: 1.5rem;
    margin-top: 1.5rem;
  }
}

.preset-header {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

@media (min-width: 768px) {
  .preset-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
  }
}

.preset-section h3 {
  margin: 0;
  color: #34495e;
  font-size: 1rem;
}

.preset-guide {
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 10px;
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
}

.preset-guide-title {
  font-weight: 800;
  color: #2c3e50;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.preset-guide-list {
  margin: 0;
  padding-left: 1.1rem;
  color: #555;
  font-size: 0.9rem;
  line-height: 1.6;
}

.preset-guide code {
  background: #f5f7ff;
  border: 1px solid #e7ecff;
  padding: 0.05rem 0.35rem;
  border-radius: 6px;
  font-size: 0.85em;
}

.preset-groups {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.preset-group {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid #e9ecef;
  border-radius: 12px;
  padding: 0.9rem;
}

.preset-group-header {
  margin-bottom: 0.75rem;
}

.preset-group-title {
  font-weight: 800;
  color: #2c3e50;
  margin-bottom: 0.25rem;
}

.preset-group-desc {
  color: #666;
  font-size: 0.9rem;
  line-height: 1.5;
}

.current-preset-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status-label {
  font-size: 0.9rem;
  color: #666;
  font-weight: 500;
}

.status-badge {
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.3s;
}

.status-badge.preset {
  background: #4CAF50;
  color: white;
  box-shadow: 0 2px 4px rgba(76, 175, 80, 0.3);
}

.status-badge.custom {
  background: #FF9800;
  color: white;
  box-shadow: 0 2px 4px rgba(255, 152, 0, 0.3);
}

.preset-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

@media (min-width: 768px) {
  .preset-buttons {
    flex-direction: row;
    gap: 1rem;
  }
}

.preset-btn {
  width: 100%;
  padding: 1rem;
  border: 2px solid #dee2e6;
  background: white;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  text-align: left;
  touch-action: manipulation;
}

@media (min-width: 768px) {
  .preset-btn {
    flex: 1;
    min-width: 200px;
  }
}

.preset-btn:hover:not(:disabled) {
  border-color: #2196F3;
  background: #e7f3ff;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.preset-btn.active {
  border-color: #4CAF50;
  background: #e8f5e9;
  box-shadow: 0 2px 6px rgba(76, 175, 80, 0.2);
}

.preset-btn.active:hover:not(:disabled) {
  border-color: #4CAF50;
  background: #c8e6c9;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(76, 175, 80, 0.3);
}

.preset-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.preset-name {
  font-weight: bold;
  color: #2c3e50;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.preset-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  border: 1px solid transparent;
  white-space: nowrap;
}

.preset-tag--limit {
  background: #f5f7ff;
  color: #2b4cff;
  border-color: #dfe6ff;
}

.preset-tag--smart {
  background: #e7f7ff;
  color: #006c9c;
  border-color: #cfefff;
}

.preset-tag--legacy {
  background: #fff7e6;
  color: #a35b00;
  border-color: #ffe2b5;
}

.preset-tag--altcoin {
  background: linear-gradient(135deg, #ff6b6b 0%, #ffa500 100%);
  color: #fff;
  border-color: #ff8c42;
  font-weight: 900;
  box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
}

.preset-btn[data-preset="altcoin"] {
  border: 2px solid #ff6b6b;
  background: linear-gradient(135deg, #fff5f5 0%, #fff9f0 100%);
}

.preset-btn[data-preset="altcoin"]:hover:not(:disabled) {
  background: linear-gradient(135deg, #ffebeb 0%, #fff2e6 100%);
  box-shadow: 0 4px 12px rgba(255, 107, 107, 0.2);
}

.preset-btn[data-preset="altcoin"].active {
  border-color: #ff4444;
  background: linear-gradient(135deg, #ffe0e0 0%, #ffe8d9 100%);
}

.preset-group[data-group="altcoin"] {
  border: 2px solid #ff6b6b;
  background: linear-gradient(135deg, #fff9f9 0%, #fffaf5 100%);
  box-shadow: 0 4px 16px rgba(255, 107, 107, 0.15);
}

.preset-group[data-group="altcoin"] .preset-group-title {
  color: #ff4444;
  font-weight: 800;
}

.active-indicator {
  color: #4CAF50;
  font-size: 1.2rem;
  font-weight: bold;
}

.preset-desc {
  font-size: 0.85rem;
  color: #666;
}

.config-panel h2 {
  margin-bottom: 0.5rem;
  color: #2c3e50;
}

.config-info {
  background: #e7f3ff;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  border-left: 3px solid #2196F3;
}

.config-info p {
  margin: 0;
  color: #1976D2;
  font-size: 0.9rem;
}

.system-section {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid #e9ecef;
  background: #fff;
}

.system-header {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

@media (min-width: 768px) {
  .system-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

.system-section h3 {
  margin: 0;
  color: #34495e;
  font-size: 1rem;
}

.system-status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.system-status-badge {
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
}

.system-status-badge.running {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #c8e6c9;
}

.system-status-badge.stopped {
  background: #fff3e0;
  color: #e65100;
  border: 1px solid #ffe0b2;
}

.system-status-meta {
  font-size: 0.9rem;
  color: #666;
}

.system-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.system-btn {
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  border: 1px solid #dee2e6;
  background: #f8f9fa;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
  font-weight: 600;
}

.system-btn:hover:not(:disabled) {
  border-color: #2196F3;
  background: #e7f3ff;
}

.system-btn.primary {
  border-color: #2196F3;
  background: #2196F3;
  color: #fff;
}

.system-btn.primary:hover:not(:disabled) {
  background: #1976D2;
  border-color: #1976D2;
}

.system-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.system-hint {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: #666;
  line-height: 1.4;
}

/* 账号管理（超管） */
.accounts-admin-section {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid #e9ecef;
  background: #fff;
}

.accounts-admin-header {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.accounts-admin-header h3 {
  margin: 0;
  color: #34495e;
  font-size: 1rem;
}

.accounts-admin-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.accounts-admin-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.accounts-admin-card {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 10px;
  padding: 0.9rem;
}

.accounts-admin-card-title {
  font-weight: 800;
  color: #2c3e50;
  margin-bottom: 0.6rem;
}

.accounts-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.accounts-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: #555;
  font-weight: 600;
}

.accounts-form input,
.accounts-form select {
  padding: 0.6rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.95rem;
  background: #fff;
}

.accounts-inline {
  flex-direction: row !important;
  align-items: center;
  justify-content: space-between;
  padding: 0.2rem 0;
}

.accounts-form-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.accounts-table {
  overflow: auto;
}

.accounts-table table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
}

.accounts-table th,
.accounts-table td {
  padding: 0.6rem 0.65rem;
  border-bottom: 1px solid #eee;
  font-size: 0.9rem;
  text-align: left;
  white-space: nowrap;
}

.accounts-table th {
  background: #f5f5f5;
  font-weight: 800;
  color: #555;
}

.accounts-actions-cell {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.acct-badge {
  display: inline-flex;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.8rem;
  border: 1px solid transparent;
}

.acct-badge.ok {
  background: #e8f5e9;
  border-color: #c8e6c9;
  color: #2e7d32;
}

.acct-badge.off {
  background: #fff3e0;
  border-color: #ffe0b2;
  color: #e65100;
}

.accounts-empty {
  padding: 0.75rem;
  color: #666;
  font-size: 0.9rem;
}

@media (min-width: 768px) {
  .accounts-admin-header {
    flex-direction: row;
    align-items: center;
  }
  .accounts-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .accounts-form-actions {
    grid-column: 1 / -1;
  }
}

.message {
  padding: 1rem;
  margin-bottom: 1rem;
  border-radius: 4px;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.success {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.message.error {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.config-section {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid #eee;
}

.config-section:last-child {
  border-bottom: none;
}

.config-section h3 {
  margin-bottom: 1rem;
  color: #34495e;
}

.config-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 768px) {
  .config-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }
}

.config-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

.config-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.help-btn {
  padding: 0.25rem 0.75rem;
  font-size: 0.85rem;
  background: #2196F3;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s;
}

.help-btn:hover {
  background: #1976D2;
}

.help-btn:active {
  transform: scale(0.95);
}

.config-detail-popup {
  background: white;
  padding: 1rem;
  border-radius: 6px;
  border: 1px solid #dee2e6;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  line-height: 1.6;
  color: #555;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.config-input-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.config-input-wrapper input {
  flex: 1;
}

.percent-suffix {
  color: #666;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
}

.save-btn {
  padding: 0.5rem 1rem;
  background: #4CAF50;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.3s;
  white-space: nowrap;
}

.save-btn:hover:not(:disabled) {
  background: #45a049;
}

.save-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.save-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.config-item label {
  font-weight: 500;
  color: #555;
  font-size: 0.9rem;
}

.config-item input,
.config-item select {
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.3s, box-shadow 0.3s;
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
}

@media (min-width: 768px) {
  .config-item input,
  .config-item select {
    padding: 0.5rem;
  }
}

.config-item input:focus,
.config-item select:focus {
  outline: none;
  border-color: #2196F3;
  box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1);
}

.config-item input.editing {
  border-color: #FF9800;
  background-color: #FFF8E1;
}

.config-item input:disabled,
.config-item select:disabled {
  background-color: #f5f5f5;
  cursor: not-allowed;
}

.edit-hint {
  font-size: 0.75rem;
  color: #FF9800;
  margin-left: 0.5rem;
  font-style: italic;
}

.config-item .description {
  font-size: 0.85rem;
  color: #888;
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.25rem;
}

.help-icon {
  font-size: 0.75rem;
  opacity: 0.6;
}

.loading {
  text-align: center;
  padding: 2rem;
  font-size: 1.2rem;
  color: #666;
}

/* 移动端优化 */
@media (max-width: 767px) {
  .config-item label {
    font-size: 0.95rem;
  }
  
  .config-section h3 {
    font-size: 1.1rem;
  }
  
  .preset-btn {
    min-height: 60px;
  }
  
  .guide-link {
    width: 100%;
    text-align: center;
    padding: 0.75rem;
    font-size: 0.95rem;
  }
  
  .config-info {
    font-size: 0.85rem;
    padding: 0.75rem;
  }
  
  /* 确保按钮有足够的触摸区域 */
  button, .help-btn, .save-btn {
    min-height: 44px;
    min-width: 44px;
  }
}

/* 配置可行性检查样式 */
.feasibility-check {
  margin-bottom: 1.5rem;
  padding: 1rem;
  border-radius: 8px;
  border: 2px solid;
  animation: slideIn 0.3s ease-out;
}

.feasibility-check.feasible {
  background: #e8f5e9;
  border-color: #4CAF50;
}

.feasibility-check.infeasible {
  background: #fff3e0;
  border-color: #FF9800;
}

.feasibility-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.feasibility-header h4 {
  margin: 0;
  font-size: 1.1rem;
  color: #2c3e50;
}

.refresh-btn {
  padding: 0.4rem 0.8rem;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.3s;
}

.refresh-btn:hover:not(:disabled) {
  background: #f5f5f5;
  border-color: #999;
}

.refresh-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.feasibility-info {
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  color: #555;
  line-height: 1.6;
}

.feasibility-info p {
  margin: 0.25rem 0;
}

.feasibility-info strong {
  color: #2c3e50;
  font-weight: 600;
}

.warning-text {
  color: #d32f2f !important;
  font-weight: 500;
}

.feasibility-suggestions {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(0,0,0,0.1);
}

.feasibility-suggestions h5 {
  margin: 0 0 0.75rem 0;
  font-size: 1rem;
  color: #2c3e50;
}

.suggestion-item {
  background: white;
  padding: 0.75rem;
  border-radius: 6px;
  margin-bottom: 0.75rem;
  border: 1px solid #e0e0e0;
}

.suggestion-item:last-child {
  margin-bottom: 0;
}

.suggestion-header {
  margin-bottom: 0.5rem;
}

.suggestion-header strong {
  color: #1976D2;
  font-size: 0.95rem;
}

.suggestion-desc {
  margin: 0.5rem 0;
  font-size: 0.9rem;
  color: #666;
  line-height: 1.5;
}

.apply-suggestion-btn {
  margin-top: 0.5rem;
  padding: 0.5rem 1rem;
  background: #2196F3;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.3s;
}

.apply-suggestion-btn:hover {
  background: #1976D2;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(33, 150, 243, 0.3);
}

.apply-suggestion-btn:active {
  transform: translateY(0);
}

/* 杠杆分析表格样式 */
.leverage-analysis {
  margin-top: 1rem;
}

.leverage-table {
  margin-top: 0.75rem;
  overflow-x: auto;
}

.leverage-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  background: white;
  border-radius: 4px;
  overflow: hidden;
}

.leverage-table th {
  background: #f5f5f5;
  padding: 0.5rem;
  text-align: left;
  font-weight: 600;
  color: #555;
  border-bottom: 2px solid #ddd;
}

.leverage-table td {
  padding: 0.5rem;
  border-bottom: 1px solid #eee;
}

.leverage-table tr:last-child td {
  border-bottom: none;
}

.leverage-table .feasible-row {
  background: #f0f9f0;
}

.leverage-table .infeasible-row {
  background: #fff5f5;
}

.leverage-table .status-ok {
  color: #4CAF50;
  font-weight: 600;
}

.leverage-table .status-error {
  color: #f44336;
  font-weight: 600;
}
