* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  margin: 0;
  padding: 0;
  background: #f5f6fa;
  color: #333;
  line-height: 1.5;
}

header {
  background: #1a1a2e;
  color: #fff;
  padding: 16px 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

header h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

#cors-banner {
  background: #fff3cd;
  border: 1px solid #ffc107;
  color: #856404;
  padding: 12px 24px;
  font-size: 14px;
  white-space: pre-wrap;
}

#cors-banner.hidden {
  display: none;
}

section {
  background: #fff;
  margin: 16px 24px;
  padding: 16px 20px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.control-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.control-row:last-child {
  margin-bottom: 0;
}

.control-row label {
  font-size: 14px;
  color: #555;
  display: flex;
  align-items: center;
  gap: 6px;
}

.control-row input[type="text"],
.control-row input[type="date"],
.control-row select {
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  outline: none;
}

.control-row input[type="text"]:focus,
.control-row input[type="date"]:focus,
.control-row select:focus {
  border-color: #1a73e8;
}

.expr-input {
  min-width: 320px;
}

button {
  padding: 7px 18px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}

#btn-fetch {
  background: #1a73e8;
  color: #fff;
}

#btn-fetch:hover {
  background: #1557b0;
}

#btn-run {
  background: #28a745;
  color: #fff;
}

#btn-run:hover {
  background: #1e7e34;
}

button:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.proxy-row {
  gap: 8px;
}

.proxy-row input[type="text"] {
  font-family: "Consolas", "Monaco", monospace;
  font-size: 13px;
}

#btn-save-proxy {
  background: #6c757d;
  color: #fff;
  padding: 6px 14px;
  font-size: 13px;
}

#btn-save-proxy:hover {
  background: #5a6268;
}

.indicators {
  gap: 16px;
}

.indicators span {
  font-weight: 500;
  color: #444;
}

.indicators label {
  cursor: pointer;
  user-select: none;
}

.indicators input[type="checkbox"] {
  margin-right: 4px;
}

#stats-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

#stats-panel.hidden {
  display: none;
}

.stat-card {
  flex: 1;
  min-width: 120px;
  background: #f8f9fa;
  border-radius: 6px;
  padding: 12px 16px;
  text-align: center;
}

.stat-card span {
  display: block;
  font-size: 12px;
  color: #666;
  margin-bottom: 4px;
}

.stat-card b {
  display: block;
  font-size: 18px;
  color: #1a1a2e;
}

#chart-container {
  padding: 8px;
}

#main-chart {
  width: 100%;
  height: 720px;
}

#trades-panel h3 {
  margin: 0 0 12px 0;
  font-size: 16px;
}

#trades-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

#trades-table th,
#trades-table td {
  padding: 8px 12px;
  text-align: center;
  border-bottom: 1px solid #eee;
}

#trades-table th {
  background: #f8f9fa;
  font-weight: 600;
  color: #555;
}

#trades-table tr:hover {
  background: #f8f9fa;
}

#trades-table .positive {
  color: #ef232a;
  font-weight: 600;
}

#trades-table .negative {
  color: #14b143;
  font-weight: 600;
}

#syntax-reference {
  font-size: 13px;
}

#syntax-reference h3 {
  margin: 0 0 12px 0;
  font-size: 16px;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

#syntax-reference h3::before {
  content: "▶";
  font-size: 10px;
  transition: transform 0.2s;
}

#syntax-reference h3.open::before {
  transform: rotate(90deg);
}

#syntax-content {
  display: none;
}

#syntax-content.open {
  display: block;
}

#syntax-content table {
  border-collapse: collapse;
  margin-bottom: 12px;
  font-size: 13px;
}

#syntax-content th,
#syntax-content td {
  padding: 4px 12px;
  border: 1px solid #ddd;
  text-align: left;
}

#syntax-content th {
  background: #f8f9fa;
}

#syntax-content code {
  background: #f4f4f4;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: "Consolas", "Monaco", monospace;
  font-size: 12px;
}

#syntax-content .example {
  background: #f8f9fa;
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 10px;
}

#syntax-content .example-title {
  font-weight: 600;
  color: #444;
  margin-bottom: 4px;
}

#status {
  font-size: 13px;
  color: #666;
  margin-left: auto;
}
