.spy-mtm-app {
  --ink: #17202a;
  --muted: #667085;
  --line: #d9e0e8;
  --soft: #f5f7fa;
  --paper: #ffffff;
  --green: #16794b;
  --amber: #9a5a00;
  --red: #b42318;
  background: #eef2f6;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  padding: 24px;
}

.spy-mtm-app * { box-sizing: border-box; }

.spy-mtm-app button {
  border: 1px solid #cfd7e1;
  border-radius: 8px;
  min-height: 40px;
  padding: 0 15px;
  cursor: pointer;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-weight: 750;
}

.spy-mtm-app button:hover,
.spy-mtm-app .range-tabs button.active {
  border-color: #344054;
  color: #101828;
  background: #f8fafc;
}

.spy-mtm-app button:disabled { opacity: .55; cursor: wait; }

.spy-mtm-topbar,
.spy-mtm-panel-head,
.spy-mtm-actions,
.spy-mtm-app .range-tabs {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.spy-mtm-topbar,
.spy-mtm-panel-head { justify-content: space-between; }

.spy-mtm-topbar {
  gap: 24px;
  padding: 0 0 22px;
}

.spy-mtm-topbar > div:first-child { max-width: 760px; }

.spy-mtm-eyebrow,
.spy-mtm-signal span,
.spy-mtm-metrics > article > span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.spy-mtm-app h2,
.spy-mtm-app h3,
.spy-mtm-app p { margin: 0; }

.spy-mtm-app h2 {
  margin-top: 4px;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.05;
  letter-spacing: -.035em;
}

.spy-mtm-app h3 { font-size: 18px; }

.spy-mtm-subtitle,
.panel-note,
.spy-mtm-disclaimer {
  color: var(--muted);
  line-height: 1.55;
}

.spy-mtm-subtitle { margin-top: 10px !important; font-size: 15px; }
.panel-note { margin-top: 4px !important; font-size: 13px; }

.spy-mtm-signal,
.spy-mtm-panel,
.spy-mtm-metrics article,
.spy-mtm-notice {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.spy-mtm-signal {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
  padding: 24px;
}

.signal-primary { min-width: 180px; }

.signal-pill {
  display: inline-flex;
  margin-top: 7px;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 28px;
  font-weight: 850;
  letter-spacing: -.02em;
}

.signal-pill.long { background: #e7f6ed; color: var(--green); }
.signal-pill.cash { background: #fff3df; color: var(--amber); }

.signal-detail {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  text-align: right;
  color: var(--muted);
}

.signal-detail strong { color: #344054; font-size: 16px; }

.spy-mtm-notice {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-color: #f0c36d;
  background: #fff8e8;
  color: #7a4a00;
  font-size: 13px;
  font-weight: 650;
}

.spy-mtm-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.spy-mtm-metrics article,
.spy-mtm-panel { padding: 20px; }

.metric-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 14px;
}

.metric-compare > div + div {
  border-left: 1px solid #e6eaf0;
  padding-left: 16px;
}

.metric-compare small {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric-compare strong {
  display: block;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.spy-mtm-metrics article > p {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #eef1f4;
  color: #475467;
  font-size: 13px;
  font-weight: 700;
}

.spy-mtm-panel { margin-bottom: 16px; }
.spy-mtm-panel.chart-panel { min-height: 440px; }

.chart-legend {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  min-height: 24px;
  margin: 10px 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.chart-legend span { display: inline-flex; align-items: center; gap: 8px; }

.legend-line {
  display: inline-block;
  width: 28px;
  height: 4px;
  border-radius: 999px;
}

.legend-line.system { background: var(--green); }
.legend-line.buyhold { background: #98a2b3; }

.spy-mtm-app canvas {
  display: block;
  width: 100%;
  height: 330px;
  min-height: 270px;
}

.table-wrap {
  margin-top: 14px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  max-height: 520px;
}

.spy-mtm-app table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.spy-mtm-app th,
.spy-mtm-app td {
  padding: 10px 12px;
  border-bottom: 1px solid #e9edf2;
  text-align: left;
  white-space: nowrap;
}

.spy-mtm-app th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--soft);
  color: #344054;
}

.spy-mtm-app .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.spy-mtm-app .positive { color: var(--green); font-weight: 800; }
.spy-mtm-app .negative { color: var(--red); font-weight: 800; }

.spy-mtm-app .tag {
  padding: 3px 9px;
  border-radius: 999px;
  font-weight: 800;
}

.spy-mtm-app .tag.long { background: #e7f6ed; color: var(--green); }
.spy-mtm-app .tag.cash { background: #fff3df; color: var(--amber); }

.spy-mtm-disclaimer {
  padding: 2px 2px 0;
  font-size: 12px;
}

@media (max-width: 860px) {
  .spy-mtm-topbar,
  .spy-mtm-signal { align-items: stretch; flex-direction: column; }
  .signal-detail { align-items: flex-start; text-align: left; }
  .spy-mtm-metrics { grid-template-columns: 1fr; }
  .spy-mtm-app canvas { height: 280px; }
  .spy-mtm-panel.chart-panel { min-height: 400px; }
}

@media (max-width: 520px) {
  .spy-mtm-app { padding: 16px; }
  .spy-mtm-actions { width: 100%; }
  .spy-mtm-actions button { flex: 1 1 100%; }
  .metric-compare { gap: 10px; }
  .metric-compare > div + div { padding-left: 10px; }
}

.legend-marker {
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
}

.legend-marker.long {
  border-bottom: 10px solid var(--green);
}

.legend-marker.cash {
  border-top: 10px solid var(--amber);
}

.range-activity {
  margin: 0 0 10px !important;
  color: #475467;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.45;
}

.trade-summary {
  display: inline-flex;
  align-items: baseline;
  gap: 9px;
  margin-top: 14px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.trade-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.trade-summary strong {
  font-size: 21px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}


.spy-mtm-cash-note {
  margin: 2px 2px 10px !important;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: #475467;
  font-size: 12px;
  line-height: 1.55;
}

.spy-mtm-cash-note strong { color: #344054; }
