:root {
  --bg: #0f1419;
  --panel: #1a2332;
  --text: #e7eef7;
  --muted: #8b9cb3;
  --border: #2a3a52;
  --long: #22c55e;
  --short: #ef4444;
  --flat: #64748b;
  --accent: #38bdf8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.25rem 1rem 2.5rem;
}

h1 {
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
}

.sub {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 1rem;
}

.toolbar label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.toolbar-price {
  font-size: 0.9rem;
  color: var(--muted);
  white-space: nowrap;
}

.toolbar-price strong {
  color: var(--text);
  font-weight: 600;
  margin-left: 0.25rem;
}

.toolbar-price .meta {
  font-size: 0.78rem;
  color: var(--muted);
}

input[type="text"] {
  background: #0c1118;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  min-width: 8rem;
}

button {
  background: var(--accent);
  color: #041018;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.status {
  font-size: 0.85rem;
  color: var(--muted);
  flex: 1 1 200px;
}

.status strong {
  color: var(--text);
}

.banner {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
}

.banner.warn {
  background: #2a1f14;
  color: #fdba74;
}

.banner.err {
  background: #2a1518;
  color: #fca5a5;
}

details {
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

details .table-wrap {
  border: none;
  border-radius: 0;
}

details .table-wrap table {
  min-width: unset;
}

summary.sec-title {
  font-size: 1.05rem;
  font-weight: 600;
  padding: 0.75rem 1rem;
  cursor: pointer;
  user-select: none;
  background: var(--panel);
  list-style: none;
}

summary.sec-title::-webkit-details-marker {
  display: none;
}

summary.sec-title::before {
  content: "▶";
  display: inline-block;
  margin-right: 0.5rem;
  font-size: 0.75rem;
  transition: transform 0.15s;
}

details[open] summary.sec-title::before {
  transform: rotate(90deg);
}

details > p.sub,
details > div,
details > h3 {
  padding-left: 1rem;
  padding-right: 1rem;
}

details .table-wrap {
  padding-left: 0;
  padding-right: 0;
}

section {
  margin-bottom: 1.5rem;
}

section h2 {
  font-size: 1.05rem;
  margin: 0 0 0.5rem;
  font-weight: 600;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  min-width: 640px;
}

th,
td {
  padding: 0.45rem 0.5rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

th {
  background: #121b28;
  color: var(--muted);
  font-weight: 600;
}

th:first-child,
td:first-child {
  text-align: left;
  padding-left: 0.75rem;
  white-space: nowrap;
}

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

.badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}

.badge.long {
  background: rgba(34, 197, 94, 0.2);
  color: var(--long);
}

.badge.short {
  background: rgba(239, 68, 68, 0.2);
  color: var(--short);
}

.badge.flat {
  background: rgba(100, 116, 139, 0.25);
  color: var(--flat);
}

.meta {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 0.15rem;
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.strat-name {
  font-weight: 600;
  color: var(--text);
}

.strat-sub {
  font-size: 0.72rem;
  color: var(--muted);
}

footer {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 2rem;
}

.trade-summary-bar {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.trade-summary-bar strong {
  color: var(--text);
}

#tbl-trades {
  min-width: 720px;
}

#tbl-trades tr.row-auto td:first-child {
  box-shadow: inset 3px 0 0 0 var(--accent);
}

.tbl-mini {
  min-width: 280px;
  margin-bottom: 1rem;
}

a.btn-nav {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.85rem;
  background: #334155;
  color: var(--text);
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--border);
}

a.btn-nav:hover {
  background: #3d516e;
}

.backtest-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}

.backtest-panel h2 {
  font-size: 1rem;
  margin: 0 0 0.65rem;
}

.bt-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.55rem 1rem;
  align-items: end;
  margin-bottom: 0.65rem;
}

.bt-form-grid label {
  font-size: 0.82rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.bt-form-grid input,
.bt-form-grid select {
  background: #0c1118;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  font-size: 0.88rem;
}

.bt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.bt-result {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: #0c1118;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.78rem;
  overflow-x: auto;
  max-height: 28rem;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--muted);
  font-family: ui-monospace, Consolas, monospace;
}

.bt-result.ok {
  color: var(--text);
}

.bt-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 0.5rem;
}

.storage-bar {
  font-size: 0.85rem;
  color: var(--muted);
  margin: -0.25rem 0 1rem;
  padding: 0.55rem 0.85rem;
  background: #121820;
  border: 1px solid var(--border);
  border-radius: 8px;
  line-height: 1.45;
}

.storage-bar strong {
  color: var(--text);
}

.storage-path {
  margin-top: 0.35rem;
  font-size: 0.78rem;
}

.storage-path code {
  font-size: 0.74rem;
  word-break: break-all;
}

.storage-ul {
  margin: 0.4rem 0 0 1.1rem;
  padding: 0;
  font-size: 0.82rem;
}

.storage-err {
  color: var(--short);
}

.interpret-zh {
  margin-top: 0.85rem;
  padding: 0.65rem 0.85rem;
  background: #121820;
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  font-size: 0.88rem;
  color: var(--text);
}

.interpret-zh .izh-title {
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.interpret-zh ul {
  margin: 0.35rem 0 0 1.1rem;
  padding: 0;
  color: var(--muted);
}

.interpret-zh .izh-caveat {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.bt-result pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.wecom-bar {
  margin-bottom: 1rem;
}

.wecom-bar details {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.wecom-form {
  padding: 0.75rem 1rem 0.85rem;
  background: var(--panel);
}

.wecom-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
}

.wecom-row label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.88rem;
  color: var(--muted);
  white-space: nowrap;
}

.wecom-row input[type="text"] {
  background: #0c1118;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.4rem 0.55rem;
  border-radius: 6px;
  min-width: 8rem;
}

.wecom-status {
  font-size: 0.85rem;
  color: var(--muted);
  min-width: 6rem;
}

.wecom-status.ok { color: var(--long); }
.wecom-status.err { color: var(--short); }

.wecom-test-row {
  display: flex;
  align-items: center;
  margin-top: 0.6rem;
}
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}
