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

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

.dashboard h2 {
  margin-bottom: 1rem;
  color: #2c3e50;
  font-size: 1.5rem;
}

@media (min-width: 768px) {
  .dashboard h2 {
    margin-bottom: 2rem;
    font-size: 2rem;
  }
}

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

/* @media (min-width: 768px) {
  .dashboard-grid {
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
  }
} */

.dashboard-card {
  background: #f8f9fa;
  padding: 1rem;
  border-radius: 8px;
}

@media (min-width: 768px) {
  .dashboard-card {
    padding: 1.5rem;
  }
}

.dashboard-card h3 {
  margin-bottom: 1rem;
  color: #34495e;
}

.dashboard-notice {
  margin: 12px 0 18px;
  padding: 14px 14px;
  border-radius: 10px;
  border: 1px solid #e9ecef;
  background: #f8f9fa;
}

.dashboard-notice.important {
  border-color: #ffe8a1;
  background: #fff8db;
}

.notice-title {
  font-weight: 700;
  color: #7a5a00;
  margin-bottom: 8px;
}

.notice-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: #5c4a00;
  font-size: 13px;
  line-height: 1.5;
}

.notice-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.notice-label {
  min-width: 70px;
  font-weight: 700;
}

.notice-value.ok {
  color: #1e7e34;
  font-weight: 700;
}

.notice-value.warn {
  color: #b04a00;
  font-weight: 700;
}

.notice-text {
  color: #5c4a00;
}

.entry-type-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.entry-type-line {
  margin-bottom: 6px;
  color: #444;
  font-size: 13px;
}

.entry-type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(0,0,0,0.08);
}

.entry-type-badge.limit {
  background: rgba(33, 150, 243, 0.12);
  color: #1565c0;
  border-color: rgba(21, 101, 192, 0.25);
}

.entry-type-badge.market {
  background: rgba(255, 152, 0, 0.14);
  color: #8a4f00;
  border-color: rgba(138, 79, 0, 0.25);
}

.entry-type-badge.unknown {
  background: rgba(158, 158, 158, 0.14);
  color: #555;
  border-color: rgba(0,0,0,0.18);
}

.account-info {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid #dee2e6;
}

@media (min-width: 768px) {
  .info-item {
    padding: 0.5rem 0;
  }
}

.info-item:last-child {
  border-bottom: none;
}

.info-item .label {
  color: #666;
  font-weight: 500;
  font-size: 0.9rem;
  width: 100px;
}

@media (min-width: 768px) {
  .info-item .label {
    font-size: 1rem;
  }
}

.info-item .value {
  font-weight: bold;
  color: #2c3e50;
  font-size: 0.95rem;
  text-align: right;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-direction: column;
}

@media (min-width: 768px) {
  .info-item .value {
    flex-direction: row;
  }
}

.position-bar-container {
  width: 100px;
  height: 8px;
  background-color: #e9ecef;
  border-radius: 4px;
  overflow: hidden;
  display: inline-block;
}

.position-bar {
  height: 100%;
  display: block;
  transition: width 0.3s ease;
}

@media (min-width: 768px) {
  .info-item .value {
    font-size: 1rem;
  }
}

.info-item .value.positive {
  color: #27ae60;
}

.info-item .value.negative {
  color: #e74c3c;
}

.trades-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.trade-item {
  display: flex;
  flex-direction: column;
  padding: 1rem;
  background: white;
  border-radius: 8px;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  border: 1px solid #e9ecef;
}



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

.trade-info {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  font-size: 0.85rem;
  color: #666;
  flex: 1;
}

@media (min-width: 768px) {
  .trade-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
  }
}

.trade-index {
  flex-shrink: 0;
  width: 2rem;
  min-width: 2rem;
  font-size: 0.9rem;
  color: #6c757d;
  font-weight: 600;
  text-align: center;
}

.trade-symbol {
  font-weight: bold;
  color: #2c3e50;
  font-size: 1.1rem;
}

@media (min-width: 768px) {
  .trade-symbol {
    font-size: 1rem;
  }
}

.trade-side {
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 500;
}

.trade-side.buy {
  background-color: #d4edda;
  color: #155724;
}

.trade-side.sell {
  background-color: #f8d7da;
  color: #721c24;
}

.trade-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-end;
}

@media (min-width: 768px) {
  .trade-actions {
    flex-direction: row;
    align-items: center;
    gap: 1rem;
  }
}

.trade-pnl {
  font-weight: bold;
  font-size: 1rem;
  text-align: right;
  padding: 0.5rem;
  background: #f8f9fa;
  border-radius: 6px;
}

.position-time-row {
  font-size: 0.85rem;
  color: #212529;
  margin-bottom: 0.5rem;
  font-weight: 500;
}
.position-time-row:empty { display: none; }

.entry-time {
  color: #999;
  font-size: 0.8rem;
  font-style: italic;
}

.price-change {
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  display: inline-block;
}

.price-change.positive {
  color: #28a745;
  background-color: #d4edda;
}

.price-change.negative {
  color: #dc3545;
  background-color: #f8d7da;
}

.stop-take-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.5rem;
  padding: 0.5rem;
  background-color: #fff3cd;
  border-radius: 4px;
  border-left: 3px solid #ffc107;
}

.stop-loss-info,
.take-profit-info {
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  border-radius: 4px;
}

.stop-loss-info {
  background-color: #fff5f5;
  border-left: 3px solid #dc3545;
}

.take-profit-info {
  background-color: #f0fff4;
  border-left: 3px solid #28a745;
}

.stop-header,
.take-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.stop-details,
.take-details {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: #666;
}

.stop-explanation,
.take-explanation {
  font-size: 0.75rem;
  color: #888;
  font-style: italic;
  margin-top: 0.25rem;
}

.stop-loss-info .negative,
.take-profit-info .positive {
  font-weight: 600;
}

.stop-loss-info .negative {
  color: #dc3545;
}

.take-profit-info .positive {
  color: #28a745;
}

.stop-price,
.take-price {
  color: #666;
  font-size: 0.8rem;
  font-style: italic;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.actual-price-badge {
  display: inline-block;
  background-color: #4CAF50;
  color: white;
  font-size: 10px;
  font-weight: bold;
  padding: 2px 4px;
  border-radius: 3px;
  margin-left: 4px;
  cursor: help;
  font-style: normal;
}

.positions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.positions-header h3 {
  margin: 0;
}

.positions-subtitle {
  margin: 0 0 10px 0;
  font-size: 12px;
  color: #6c757d;
}

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

.sltp-all-btn:hover:not(:disabled) {
  background: #175fb8;
}

.sltp-all-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.sltp-all-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: #95a5a6;
}

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

.close-btn:hover:not(:disabled) {
  background: #c0392b;
}

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

.close-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: #95a5a6;
}

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

.sltp-btn:hover:not(:disabled) {
  background: #175fb8;
}

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

.sltp-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: #95a5a6;
}

.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;
}

@media (min-width: 768px) {
  .trade-pnl {
    background: transparent;
    padding: 0;
    text-align: left;
  }
}

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

/* 优化后的持仓单样式 */
.trade-protection-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1.2; /* 给保护单列稍微多一点的宽度权重 */
}

@media (min-width: 768px) {
  .trade-protection-col {
    min-width: 200px;
    max-width: 300px;
  }
}

.open-orders-compact {
  padding: 8px;
  background-color: #f8f9fa;
  border-radius: 4px;
  border: 1px solid #e9ecef;
}

.open-orders-label {
  font-size: 11px;
  color: #868e96;
  font-weight: 600;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.order-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.order-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: white;
  border: 1px solid #dee2e6;
  gap: 4px;
  line-height: 1.4;
  white-space: nowrap;
}

.order-badge.sl {
  background-color: #fff5f5;
  border-color: #ffc9c9;
  color: #e03131;
}

.order-badge.tp {
  background-color: #ebfbee;
  border-color: #b2f2bb;
  color: #2f9e44;
}

.badge-type {
  font-weight: 700;
}

.badge-price {
  font-family: "SF Mono", "Roboto Mono", monospace;
  font-weight: 500;
}

.badge-tag {
  font-size: 9px;
  background: rgba(0,0,0,0.05);
  padding: 0 3px;
  border-radius: 2px;
  margin-left: 2px;
}

/* 交易统计卡片 */
.stats-card {
  grid-column: 1 / -1;
}

.stats-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 0.75rem;
}

.stats-card-header h3 {
  margin: 0;
}

.stats-export-btn {
  padding: 6px 12px;
  background: #607D8B;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.stats-export-btn:hover:not(:disabled) {
  background: #546E7A;
}

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

.stats-card h4 {
  margin-top: 0;
}

.stats-card h4 {
  font-size: 0.95rem;
  color: #555;
  margin: 1rem 0 0.5rem 0;
}

.stats-card h4:first-of-type {
  margin-top: 0;
}

.stats-section {
  margin-bottom: 1rem;
}

.stats-table-wrap {
  overflow-x: auto;
  margin-top: 0.5rem;
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.stats-table th,
.stats-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid #dee2e6;
}

.stats-table th {
  font-weight: 600;
  color: #495057;
  background: #f1f3f5;
}

.stats-table td.positive {
  color: #28a745;
  font-weight: 500;
}

.stats-table td.negative {
  color: #dc3545;
  font-weight: 500;
}

.stats-symbol {
  font-weight: 600;
  color: #2c3e50;
}

.stats-empty {
  color: #6c757d;
  font-size: 0.9rem;
  margin: 0.5rem 0;
}

.hourly-table .stats-table {
  max-width: 320px;
}

.suggestions-section h4 {
  margin-top: 1.25rem;
}

.suggestion-block {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
}

.suggestion-block.blacklist {
  background: #fff5f5;
  border-left: 4px solid #dc3545;
}

.suggestion-block.whitelist {
  background: #f0fff4;
  border-left: 4px solid #28a745;
}

.suggestion-block ul {
  margin: 0.5rem 0 0 1rem;
  padding: 0;
}

.suggestion-block li {
  margin: 0.35rem 0;
  line-height: 1.4;
}

.suggestion-symbol {
  font-weight: 700;
  color: #2c3e50;
  margin-right: 0.25rem;
}
