.plot-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 3000;
  align-items: center;
  justify-content: center;
}

.plot-overlay.plot-visible {
  display: flex;
}

.plot-window {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  width: min(760px, 92vw);
  height: min(640px, 88vh);
  min-width: 380px;
  min-height: 320px;
  max-width: 96vw;
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  resize: both;
  overflow: auto;
}

.plot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: move;
  user-select: none;
  flex-shrink: 0;
}

.plot-title {
  font-family: 'Montserrat', Inter, system-ui, sans-serif;
  color: var(--primary);
  font-size: 15px;
}

.plot-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 16px;
  padding: 0;
  width: auto;
  min-width: unset;
}
.plot-close:hover {
  color: var(--text);
  background: none;
}

.plot-controls {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.plot-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 120px;
}

.plot-field-narrow {
  flex: 0 0 80px;
  min-width: 80px;
}

.plot-field label {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 0;
}

.plot-field input {
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 13px;
}

.plot-run {
  flex-shrink: 0;
  padding: 8px 16px;
  font-size: 13px;
}

.plot-body {
  flex: 1 1 auto;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  min-height: 0;
}

.plot-status {
  color: var(--muted);
  font-size: 13px;
}

.plot-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.plot-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.plot-stats {
  font-size: 12px;
  color: var(--muted);
  font-family: ui-monospace, monospace;
}

.plot-download-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

.plot-fmt {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  width: auto;
  padding-right: 30px;
}

@media (max-width: 600px) {
  .plot-window {
    width: 96vw;
    height: 90vh;
  }
  .plot-controls {
    flex-direction: column;
    align-items: stretch;
  }
  .plot-field, .plot-field-narrow {
    flex: 1 1 auto;
    min-width: 0;
  }
}

.plot-field-cols {
  flex: 2;
  min-width: 160px;
}

.plot-cols-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 70px;
  overflow-y: auto;
  background: #fff;
}

.plot-col-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  cursor: pointer;
  margin: 0;
}

.plot-col-check input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
}

.plot-cols-loading,
.plot-cols-empty {
  font-size: 12px;
  color: var(--muted);
}

.plot-col-select {
  padding: 7px 28px 7px 10px;
  border-radius: 8px;
  font-size: 13px;
}